Development blindness

When you develop a game for long enough, you become blind to how difficult or how much fun the game really is. This happens because you learn the game inside out and could play it with your eyes closed. It becomes very difficult to tell how difficult or logical the game is to the average player. This can easily cause you to waste time iterating when you can’t actually tell if the game is improving or not.

You are the Steve Wiebe of your game
You are the Steve Wiebe of your game

This mostly applies to the first quarter of the development when you’re still working out whether the idea works or not and when you add new major gameplay features. I think most of it also applies to web or business applications too. Anything where you have a customer who you want to experience the product as smoothly as possible.

Ways to fight it:
1) Show your game(or app)- and have other people play it. Do not interfere or give them pointers or explain things! Try not to get involved with explaining and pointing things out because you won’t be there to explain what to do to the people who buy the game so the feedback won’t be authentic. You don’t want the first time you hear about the controls being confusing to be when the game is out and you start getting bad reviews. Take notes and try to see where people get stuck or what they liked. The second best option is to release a alpha version or a one level demo and ask for feedback online. People of the internet are known for being blunt.

1b) If you had a great idea but you’re seeing that no-one you show it to gets it without you explaining it – you have to either make it clearer or cut it out. Try to differentiate between one persons opinion and real problems. If it seems well thought out and well-reasoned or if a lot of people have the same complaint – it’s definitely something that needs addressing.

2) Take time away from playing your game. At least a week – preferably longer. It’s good if you have another side project going or maybe you can focus on building tools or prepare some marketing plans or one of the other 100 things you have to do after the game is “ready”. You are the best player in the world of your game right now, the closer you get to the beginner level every now and then the better you understand new players (literally everyone who will buy your game). You usually don’t have to make the decision to go ahead with a game so quickly that you can’t put it away and look at the idea again with a fresh pair of eyes. You can keep doing this every time a new major features is added.

3) Use different levels or maps when iterating. If you iterate on the same level for too long, it will start to feel dull and you’ll lose your intuitive feel for whether the mechanics are improving or not. Again you’re learning the level like the back of your hand so you start losing judgement on how the game is shaping. I recommend building “obstacle course” levels, which are just collections of different “edge-case”-obstacles etc. Like the highest possible jump in a platformer game. If you are tweaking gameplay values and can’t jump over the highest platform anymore, something went wrong. Also creating fun dumb levels where you for example test out your effects and particles by adding hundreds of explosive barrels can help see how much fun the game can be during the most intense moments.

4) Compare to other games in the same genre or with the kind of feel you’re looking for. Pay attention to the details. Like for controls, does the action happen when you press down the button or when you release it. Switching between the reference and your game brings out the differences and weaknesses in both. This was the most surprising one to me, when I opened my game after playing another game in the same genre, I could tell some parts were too sluggish in mine and some parts were already better. Don’t copy but try to learn from classics like Super Mario. It’s all physics and motion – once you know what feels and looks good to the player, you can start making it your own. In 1989 the developers of Prince of Persia for example used a primitive “motion-capture” technique (rotoscoping on top of video footage of one of the staff members) to get the feeling right.

Tecmo Cup Soccer / Captain Tsubasa – Football RPG

Old Weird Games digs up forgotten weird games from the past and takes a peek at the interesting and unique game design in them.

Platform: NES
Genre: RPG / Sports
Tecmo Cup Soccer was the westernized version of the Japanese game Captain Tsubasa, I’m using it because it was translated to English for the NES. They’re basically the same game though.

Tsubasa is really taking the RPG genre and stretching the definition to its limits. How do you take a set of RPG rules that add value to a different and unrelated genre like sports without alienating people who play sports games? It’s quite refreshing to see a RPG that is not themed with wizards and dragons or robots. The graphic style is impressive for the NES, obviously taking cues like camera angles and visual effects from classic anime style. Kind of reminds me of 8-bit Phoenix Wright.

Nintendo World CupWhen me and my brother bought this game in the early 90’s, we were expecting it to be like Nintendo World Cup – a simple side scrolling “arcade” football game. We didn’t totally grasp all the mechanics at first but after the initial disappointment of finding out it wasn’t what we expected, it ended up being maybe even a more memorable experience than the multiplayer Nintendo World Cup matches. I don’t think I understood that the players stats were going up after each game until coming back to the game years later. Obviously not being a native English speaker and being a kid meant that we rarely understood anything but the basic game mechanics and then explored from there.

It is a unique concept and offers hours of gameplay that is still a lot of fun these days. And sports games haven’t tried out new things like this in forever. Or maybe in Japan they have? As a mostly turn based game it shows how to create tension and dramatic situations for the player without real time action.

Tecmo Cup soccer title screen snap0001
Title screen and a shot from the intro animation.
Continue reading “Tecmo Cup Soccer / Captain Tsubasa – Football RPG”

What is an Interface in OOP? Example in ActionScript 3

This is written for ActionScript 3 but also works for most similar languages. If you can read the code examples, it will probably apply to you.
In Object-Oriented Programming languages – including AS3, there are special “classes” called Interfaces (it is also a keyword in many languages). You might have noticed some of them in the basic library included with the language. They’re easy to identify because the name always starts with an uppercase I; like IEventDispatcher.

To understand what an Interface class is, you must first know understand what is meant when we talk about an interface of a object.

Coffee machineLet’s say you walk out of your office into the breakroom and find the simplest coffee maker in the world. It only has one button labeled [COFFEE]. You press it and it dispenses a cup of hot and tasty coffee for you. To you as a user the interface of the coffee maker is that button. You only want a cup of coffee, you don’t want to think about what goes on inside every time you use it.

Another simple interface would be a e-reader with just one book in it. It only has two actions you can use on it, go one page left or go one page right. It still has to form the pages on the LCD screen and store and decode the content of the book, but you only see two points of interaction with it. Left and right. If the users could also access the algorithm to render the text to the screen or change the voltage from the battery, they would be very confused and probably break it soon enough.

You sit back to your desk and decide to write your own coffee maker in ActionScript. The pseudo-code for the first revision of your coffee maker class looks like this.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package com.designoidgames.interfacetut
{
    public class CoffeeMaker
    {
        public function CoffeeMaker()
        {
                       // Constructor in ActionScript
        }
 
        public function makeCoffee():void
        {
            grindBeans();
            heatWater();
            runWaterThroughBeans();
            coffeeComplete();
        }
 
    }
}
package com.designoidgames.interfacetut
{
	public class CoffeeMaker
	{
		public function CoffeeMaker()
		{
                       // Constructor in ActionScript
		}

		public function makeCoffee():void
		{
			grindBeans();
			heatWater();
			runWaterThroughBeans();
			coffeeComplete();
		}

	}
}

Continue reading “What is an Interface in OOP? Example in ActionScript 3”

Unity objects in right z-order but still overlapping – Render Queue Index

Recently I had a problem where I had set up some background gameobjects and sorted them on the z-axis thinking this would automatically render them in the right order always. When the camera moves they start flickering/overlapping each other. At least for the most basic shaders this is not always the case and you should instead set the renderQueue value for the objects that have a strict z-order you want to render them in.

Smaller renderQueue index means it’s closer to the camera and should be drawn on top of anything with a bigger index number.

1
2
3
4
public int renderQueueIndex = 3000;
    void Start () {
        gameObject.renderer.material.renderQueue = renderQueueIndex;
    }
public int renderQueueIndex = 3000;
	void Start () {
        gameObject.renderer.material.renderQueue = renderQueueIndex;
	}

Simple one-way platform in Unity

This is a simple trick to create a Mario-style platform where it’s open when you jump from below but you will collide with it when you’re above the platform. The good thing about this solution is that it’s very simple and clear what it’s doing, and takes like 10 seconds to set up. It is not perfect and if your game relies a lot on this type of platforms I would suggest a more advanced solution. Something where you take into account what direction is the character moving towards etc.

  1. Create the platform.
  2. Duplicate the platform and child this one to the platform. Call the child AboveTrigger.
  3. On AboveTrigger, make sure that under the Collider “Is Trigger” is set to false.
  4. Move the AboveTrigger up about the height of the platform and a little extra room so they’re not touching (or down if you want a top-open block). When the player is touching this trigger, the platform will turn its collider on – otherwise it’s always off.
  5. Attach the component at the bottom of the post to AboveTrigger.
  6. (Optional) Scale the AboveTrigger down by 5% or so to improve the character entering from the edges of the block – this depends on the game and should always be tested and tweaked to fit your character and controls.
Simple one-way platform
Setting the platform up in editor
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
using UnityEngine;
using System.Collections;
 
public class OneWayPlatform : MonoBehaviour {
 
    void OnTriggerEnter(Collider player)
    {
        transform.parent.collider.isTrigger = false;
    }
 
    void OnTriggerExit(Collider player)
    {
        transform.parent.collider.isTrigger = true;
    }
 
    // Use this for initialization
    void Start () {
        transform.parent.collider.isTrigger = true;
    }
 
}
using UnityEngine;
using System.Collections;

public class OneWayPlatform : MonoBehaviour {

    void OnTriggerEnter(Collider player)
    {
        transform.parent.collider.isTrigger = false;
    }

    void OnTriggerExit(Collider player)
    {
        transform.parent.collider.isTrigger = true;
    }

	// Use this for initialization
	void Start () {
        transform.parent.collider.isTrigger = true;
	}

}

Masters of Doom audiobook

The first 45 minutes of the story of id Software, John Carmack and John Romero. Read by Wil Wheaton.

Hearing the stories behind some of the most impressive game experiences of my childhood (Commander Keen, Wolfenstein, Doom, Quake) and the technological breakthroughs of the two Johns is very cool.

Understanding Recursion

This quote is from the great book about mathematics, logic and art: Gödel, Escher, Bach: An Eternal Golden Braid.

It’s a very elegant and easy to understand explanation of recursion which is one of the basic building blocks of programming. This explains more how a recursive function will traverse and branch out to different function calls, usually in a recursive function after hanging up on one person, you would return the data you learned from that call to the previous level which is missing in the example.

One of the most common ways in which recursion appears in daily life is when you postpone completing a task in favor of a simpler task, often of the same type. Here is a good example:

An executive has a fancy telephone and receives many calls on it. He is talking to A when B calls. To A he says, “Would you mind holding for a moment?” Of course he doesn’t really care if A minds; he just pushes a button and switches to B. Now C calls. The same deferment happens to B. This could go on indefinitely, but let us not get too bogged down in our enthusiasm. So let’s say the call with C terminates. Then our executive “pops” back up to B, and continues. Meanwhile A is sitting at the other end of the line, drumming his fingernails against some table, and listening to some horrible Muzak piped through the phone lines to placate him … Now the easiest case is if the call with B simply terminates, and the executive returns to A finally. But it could happen that after the conversation with B is resumed, a new caller – D – calls. B is once again pushed onto the stack of waiting callers, and D is taken care of. After D is done, back to B, then back to A.

Hofstadter, Douglas R. Gödel, Escher, Bach: An Eternal Golden Braid. New York: Basic Books, 1979.

Unity: Is your 2D character pointing right or left?

A Vectors dot product tells if another vector is pointing in the same direction. It can be used for a very quick check to see if a character is pointing in a certain direction. In this code for example I don’t want the character to move along it’s transform.right if it’s pointing left because he’s always supposed to be moving right.

1
2
3
4
Some common dot-products:
Vectors are at a 90 degree angle (normal): 0
Vectors are pointing exactly the same direction: 1
Vectors are pointing exactly the opposite directions: -1
Some common dot-products:
Vectors are at a 90 degree angle (normal): 0
Vectors are pointing exactly the same direction: 1
Vectors are pointing exactly the opposite directions: -1
1
2
3
4
if(Vector3.Dot(Vector3.right, transform.right) > 0)
{
    Debug.Log("Pointing right");
}
if(Vector3.Dot(Vector3.right, transform.right) > 0)
{
    Debug.Log("Pointing right");
}

Vectors in games Part 1

Vector’s are one of the most used tools in games. At first glance it might seem like there is a lot of magic that goes into them but actually they are very simple structures.

Here is an example of a two dimensional vector:

1
Vector A: 0, 2
Vector A: 0, 2

It only has two pieces of data! 0 is the position on the x-axis, 2 is the position on the y-axis.
If we take another two dimensional vector:

1
Vector B: 1, 4
Vector B: 1, 4

We can have a look at some of the basic operations, add and substract.

Addition:
A + B

1
2
3
4
5
0, 2
+
1, 4
=
1, 6
0, 2
+
1, 4
=
1, 6

If you read it column by column you can see that it just adds the x of the first vector to the x of the second vector and on the other set of numbers it adds the y’s together.

Substraction:
A – B

1
2
3
4
5
0, 2
-
1, 4
=
-1, -2
0, 2
-
1, 4
=
-1, -2

This is really how simple vectors are at their heart. In Part 2 we will look at how the length of a vector is calculated and what different types of vectors there are.

Game Programming basics – Time

One of the most important lessons I learned as a young game maker was how to harness Time for your games. Before that me and my friends had been mostly doing simple QBASIC text adventures or other games where the game logic was:
[ show text/graphic -> wait for player input -> run through a if/switch clause to determine next step -> show text/graphic… ]
Around this time I also once created a new project in QBASIC and created a new Subroutine called Football and tried to run it hoping for some bare-bones sports game to appear. Starting programming before having the internet or almost any English skills was definitely interesting and very rewarding since every little discovery felt like a huge Eureka! moment.

For game development the single most important concept in my opinion is time. Without time you are extremely constrained in what you can do. How time works in games at it’s core is you have a game loop that gets called 30-60 times a second. In the game loop you can give life to everything that’s inside the game. In this pseudo-code example a spaceship flies from left to right (along the x-axis). Once you have that tool, it’s easy to build upon it to create player controls, enemy AI, graphical effects, pretty much anything in a game.

1
2
3
4
function gameLoop()
{
  spaceship.x++;
}
function gameLoop()
{
  spaceship.x++;
}

If you run this code once, the ship will simply move one pixel to the right. If you run it continuously, the ship gains a life of it’s own and will fly further right “forever”. As a beginning young programmer this really blew my mind when I saw it happen on my screen.

Everything that happens in a game looks smooth and real-time but it is actually just a second that can be sliced into 60 pieces of incremental action.