Nanocrisis is a 3d platformer with aspects of "Zelda" and "Castlevania: Symphony of the Night." In this postmortem, you will learn a little bit about useful steps you can take to make a similar game, and what pitfalls you can avoid to help you save time. I am going to shortly go over the game's design, and then the technical aspects of making the game: the game's engine and the workflow used to create content. Nanocrisis was entered into uDevGames 2004, and I will also note some specific things to watch out for if you are also interested in entering this contest.


Scale down!

My first step in creating the game was to figure out exactly how the game would play. I decided on making a 3d platformer game, because I had not previously tried making a game of this genre. My intention was to make a game that would at least be fun for me to play, so I added a lot of RPG (role-playing game) features, such as the ability to upgrade your character as you moved through the game. The original design was more similar to Secret of Mana, and two-player support was planned. This turned out to be much too lofty of a goal, so the game was ultimately single-player, and not anywhere near as long as originally planned. Thus, the same lesson you hear a lot in the indie game world persists here- scale down your plan! There's no way to make a 3d game like the newer Zelda series, or Mario 64 within this short of a time period, and those are even single-player.

Design a story with characters that stand out.

I wrote up an initial design document, and a friend filled in the story. The story was also scaled down a great deal, and what remains in the game are only really some elements of the story that caught my eye. I really don't have a whole lot to say about the story, but I feel that making memorable characters in the game was very worthwhile- you of course always have a main character or several who are memorable, but including a memorable villian or a character who shows up a lot adds a lot more fun to a game.

To appeal to casual players, keep it simple.

I am not really sure how successful the actual in-game design was, because a lot of people got stuck at the title screen (see uDevGames section below) and there really were not all that many comments about it. I think a lot of people were confused about this style of game, because the game didn't really tell you what to do- you had to explore and try to find money and items to get further along. Those who got far into the game tended to like it, so there seems to be a certain hump to overcome, at which point you understand what the game is about and how it is to be played. Presumably a lot of people didn't have time to try and mess around to get over this hump.


Never start from scratch!

Rule number one for actually making this sort of game is that you should NEVER START FROM SCRATCH, unless you have years, and an interest in how the guts of game engines work. With this in mind, I next picked out some libraries to start with- in particuarly I started with the code of Devlib, which is an open-source, minimalist game engine. This was a great idea, as it gave me an idea how to glue these separate open-source libraries together. Devlib by itself was not sufficient enough to do what I wanted, so I had to hack it like crazy, so I would not recomment using it without modification. For making a 3d platformer game, I would actually recommend you start with a more high-level engine, if possible, such as Torque. If you are very serious about making a 3d game, of course there are a lot of other great commercial engines as well, and again I would advise against starting from scratch unless you have lots of time and interest in low-level details.

Devlib incorporates: SDL for setting up a drawing context. This is a great choice for the MacOS X platform, and is becoming a lot more popular and stable. I would recomment it to anyone.

DirectX and OpenGL for drawing. I chose OpenGL since I wanted to work well with the MacOS X platform- any cross-platform developer would want to do the same.

DevIL for image loading (Relevant to me were the JPG, PNG and TGA supports.) This library worked great for what I wanted, and I recommend it. Quicktime is also popular for loading images, but I was interested in making the game as cross-platform as possible.

FreeType for True-type font drawing. This library is also fine, and by the way, there are plenty of free True-type fonts you can find on the web, such at those at Tom7. I would not recommend using Devlib's build-in font drawing support, which is quite inefficient and has a lot of overhead. Instead, OpenGl FreeType is a much better choice, tailored towards OpenGL rendering.

ODE for physics. All-in-all, this library was acceptable for what I wanted to do, but it is somewhat quirky and difficult to get to work exactly the way you want it to. A game-specific physics library might be a better choice, but I haven't played around too much with it. ODE definitely will get the job done, though, but it may cost you some time.

Lua for scripting. This was the first time I wrote a game with scripting, and I was amazed at how much this helped speed-up game creation. Lua is one of the best choices you can use for a game scripting engine- so much that I have dedicated a section to it below.

Fmod is what Devlib used for sound, but I ended up using SDL_mixer, because I was trying to avoid the cost of licensing Fmod- Fmod itself is supposed to be fairly good if you actually do use it. However, using SDL_mixer turned out to be a poor choice- SDL_mixer is not as good about using audio hardware acceleration, and can sometimes introduce clicks and pops; also, it has limited features. You should use OpenAL instead.

Devlib also has several other components that I did not use, such as its mesh loading support, resource loading support, and font support. Devlib's mesh support is not very flexible, so I wrote my own mesh/geometry code- this is a fairly simple linear-interpolation system; each mesh file is a group of keyframes- each keyframe has all the vertex positions for a given pose of the model. Then, in animation files, keyframe weights are listed with time deltas. You can see this in the 'ani' files of the data folder. I created these models and animation files with my own modeler, OpenTeddy, which I describe a little further in the work flow section.


Caching is a powerful method for resources.

Though I used Devlib's resource support, I wrote my own resource management system. The system is simply a cache- instead of having separate variables for each data pointer I want to store, I have a table for each type of data (e.g. sounds, images, keyframe data) and ask the system to give me a resource with a given name. The resource is loaded if it is not already in memory, and if not, it is loaded, but if it already is, a pointer to it is returned. To use this effectively, you need to preload a certain amount of resources to avoid delays when something new appears- for example, there is a noise for when the player swings a weapon; this sound is loaded when the game starts by requesting it instead of the first time the player actually swings, so there is no delay in case it takes a while to load the file.

Another consideration you might be worried about is taking up too much memory from loading all these data. Not to worry! In modern operating systems (MacOS X, Windows NT or higher) when your program takes up too much memory, the operating system starts using the disk to store your excess memory that hasn't been used in a while (this is called 'virtual memory') and it brings the memory back into your program when it is accessed. This is all done transparently, behind your back. So, you can load all you want, and if you load too much you should be fine, as long as you don't work with a really big set of resources in a small time window. For those that use C++, here is a snipped of code from the system. PRall_lookup is a templated hash table, where you choose the type of the pointer to return- it also has a method find_or_load(), which returns a pointer to the loaded version of a data file you request. When g_all_music below is destructed, its destructor from PRall_lookup will free all the loaded music files.

struct PRmusic : public PRcopystr {
	Mix_Music *music;

	PRmusic(const char* i_filename) : PRcopystr(i_filename){
		music = Mix_LoadMUS(i_filename);
PRall_lookup<PRmusic> g_all_music;

PRmusic* p = g_all_music.find_or_load("title.ogg");


Scripting helps speed up your development.

I should note that half of my code is lua (in the data folder- game.lua, title.lua) and the other half is C++. Because I added scripting, I was able to add a lot of new behavior and features very quickly. By the way, make sure you are getting full output from your scripting interface- you need to know what line and what file you are having a problem from, and a full stack trace if possible.


What I found to be the easiest (possibly not the most efficient) way to do the interface is have my Lua procedures each take in one argument, which is a table- this way I can quickly change my interface and allow default values. For example, I might have:

render_billboard( [x=50, y=20, texture="mytex.png"] )

and then if I decide to allow a color, I can make the default color white if it is unspecified and the user could also specify it:

render_billboard( [x=50, y=20, texture="mytex.png", color=[1.0,0.0,0.0]] )

There is still some annoying manual labor you have to do to implement this. For each argument you obviously have to try to look up the string in the table, and if it's there, use it instead of the default argument.

I would NOT use Luabind ([url]http://luabind.sourceforge.net/[/url]) - it makes your compliation time incredibly slow, and if you start increasing the maximum number of arguments in your interface, it starts running into too-deep template errors. I tried it out and wasted a lot of time trying to use it out.


I found it useful (though it's somewhat slow) to represent vectors with tables. You can see in my previous code example how this works. The way to do this is really easy- in lua, you push a table, then push the number 1, push the first value, push the number 2, push the second value, then the third value. I use vectors of size 2 through 4. All my vector math is implemented in lua. If this is too slow you can of course push it up into the engine layer, but again you still have this sort of overhead by converting to a table. But again, I found it incredibly easy and flexible to do it this way.


The way my system works is that when you ask for a new object, you get an integer handle to the object. You can then refer to it by the handle:

local ob = create_object( [model="test.model", loc=[0,1,0]]) ... set_object( [index=ob, loc = [1,1,1]] )

In my system, objects are the only things with handles. You could do a lower-level version of things where textures have handles, models have handles, etc. I find though you may just want to always specify what you want each time and just use a cache. So for example instead of passing a texture to a handle, then using that handle, you just mention the name of the texture every time, and the system is smart enough to internally cache that texture so that it doesn't have to load it each time the draw texture is called. This is described in the above resource management section.

There are of course a lot of programs that use LUA, and I have actually not looked at any other ones (which is probably to my disadvantage... but my engine is working fine so far, except being somewhat slow on older systems.) One recent game I am aware of because I was looking at rpgdx.net is Gia ([url]http://luaforge.net/projects/gia/[/url]) though I haven't looked at how he does things.


Start simple as possible, and slowly grow a full game.

The first thing I did was try to make a simple program using Devlib- once I got that to work, I made more and more complicated programs, that first loaded my meshes, animated them, added physics support, and then scripted them. This sort of continual evolution is a very good way to develop a program, because you know that what you currently have is working fine, so when you add something new, you know that's probably the culprit. I used a memory checking system (called MMGR.h) and turned out checking all the time, so whenever a memory bug came up, I could fix it right away. Once I got scripting working, I made a simple demo where the character could walk around on another mesh. From here I tried to make sure I had all the features I wanted, by adding more and more interactions with other objects. At this point I started making the actual game levels.

Use a professional toolchain.

Making character and monster models was done in OpenTeddy, which I developed myself previously in the year. The reason was surprisingly not that I wanted more power from a modeler, but I actually, despite being a computer graphics student, do not know how to use professional modeling packages, such as Maya, as I never learned them. I would recommend against making your own modeler- I had tons of trouble with my modeler, and it was really insufficient for making level (room) models. Instead, you should learn how to use Maya, for example, and you could write some plug-ins for it in order to do things specific to your game. This is certainly the best approach, but rather difficult if you don't know too much about it. So start learning how to use a professional 3d package as early as possible.

A lot of the level data is in my scripts, which is also a fairly bad idea- this meant that I had to type in the location of exits and entrances, which was a huge nuisance. It would have made a lot more sense to store this data inside the level meshes, or make a special level format just for rooms.

I had a lot of fun making characters and monsters, however, which is a lot of what motivated me to keep going. This was the only advantage of my own tool, because OpenTeddy is specialized in making organic shapes. As an aside, OpenTeddy is based on the work of Takeo Igarashi- his team created an easy-to-use 3d modeling tool based on creating mesh blobs with 2d strokes. I extended the concept to include boolean operations, which made it a lot more usable, and allowed me to make (debatably) much more professional-looking models. I hear there is a Teddy plug-in in several professional 3d packages, and I would recommend using such a tool to save you time.

Music for the game was created with FruityLoops- I had a lot of fun with this, and would recommend it to anyone. It is, however, PC-only. I felt that the music added a lot of mood to the game, but from the uDevGames results, people either didn't like the music that much, or didn't like the sounds that much. It's difficult to tell, because I didn't receive many comments about it.

Audio was created by finding free sounds, and then modififying them with Audacity. This is fairly straightforward, so I won't say much about it, but you should remember that ogg is a good sound format to use, though you will need to get the correct libraries for this.


Make sure your opening interface is simple and comprehensive.

When I received my scores for uDevGames, I was disappointed, because I expected to do somewhat better. However, I did something really stupid- at the title screen, I opted for somewhat of a consistent keyboard interface, but this was a very bad idea, because people didn't know to press a key, since in most computer games you would click the mouse instead. I had not built in mouse support, and didn't really want to, but I really should have, because it would have gotten me probably a good deal more votes. So the tip here is you should definitely make your out-of-game interface both mouse and keyboard- a standard interface is best. Probably instructions all along the way (even CLICK THE MOUSE TO CONTINUE at the beginning might even help) are a great idea- in-game instructions are the best, and I think it was helpful for me to include them. If you've played the fairly recent "Prince of Persia-Sands of Time" game, it has fairly sufficient in-game instructions, which gives you an idea about that.

Simpler games appeal to the public.

About gameplay, again I received very few comments, and what comments I did receive I fixed gameplay for, so it's very difficult for me to gauge what people actually thought about it. My personal opinion is that I received a mediocre score because the game was too complicated- remember that for uDevGames you are being judged by the public, and a game that will be most successful with the most number of people is one with a simple interface, so nobody has trouble playing it. I should also note that historically, RPGs have not placed all that highly in uDevGames for what I feel is this same reason of complexity. I also encountered some game crashes despite testing with a reasonable number of people- because again my game was somewhat complicated, it was almost impossible to anticipate these bugs coming up.

Try your sound on headphones, and on different systems.

For audio, one comment I heard is to make sure things aren't too loud or too soft- there should be an audio adjustment menu and you should test the game with headphones. I did neither of these things. Another problem I came across is that a few people felt the music was somewhat monotonous- however, I was only alotted 10 megs of space for the whole game, so each song was only a minute and a half to two and a half minutes- it would have been a better idea to just make one or two pieces of longer music, and leave the other music out to decrease download size. Small downloads can lead to more votes, because non-broadband users probably will download smaller games first in the interest of time.

The best-rated graphics are clean and consistent.

Finally, about graphics, I think I was judged somewhat harshly because I had a lot of repeating textures- since I didn't have the time to make really detailed levels, I went for levels that were just comprehensible but not really detailed. This was probably not such a good idea, because I think it introduced the perception that I was just being sloppy. The fact that I had animated models did not seem to help me all that much, and you can probably get a lot of mileage out of 2d graphics that look good.