Other > Game Development

The thread of programming questions, advice, and secrets.

(1/4) > >>

Do you unit test?

One of the greatest features about AI War is the ability to join "hot seat," meaning you can join during the middle of an existing game.

I've seen so many very promising games riddled with crashes and desyncs.  One such game was Sins of a Solar Empire, which was unparalleled in multiplayer (competitive) depth.  A proper game would last 1 to 2 hours.  However, most games ended in 45 minutes and were always decided by factors such as players disconnecting, crashing, desyncing, etc.  If the game did last long enough memory leaks began to slow the game to an unbearably slow pace.  When a player disconnected the AI took over for them (a good feature), but it would have been even better if another play could "hot seat" join and take over the AI.  All the games troubles could have been solved by hot seats.  Disconnect?  Just reconnect.  Crash?  Reconnect.  Memory filled with memory leaks?  Quit and reconnect.  Desync?  Hopefully it's detected, and then everyone can resync with the host (or a randomly chosen player).

How does the hot seat in AI War work?  Any trouble implementing it?  Why do you think it's such a rare feature despite it being a universal solution to many RTS problems?

AI War may be simpler than many RTS games, since there are only units and positions; no simulated environment to speak of.  Would you consider it more difficult to have a hot seat in a game like Age of Empire where the environment is more complex?

Lastly, the title does mention secrets, so tell us something we don't know about your games.  :)  About the programming that is.


I think you're looking for this section of my blog: http://christophermpark.blogspot.com/search/label/Programming ;)

A lot of your questions are things that I'll have to address in greater depth in later blog posts (I only do a few a month, due to the immense time required to create them), if there's interest in the nitty gritty details.  But, to give at least basic answers to your questions:

- There weren't any particular problems with the hotseat stuff at all.  Pretty trivial, really.  I don't know why more game developers don't support this; Age of Empires II did, and then other games that came after pretty much dropped it.  You also get really (pardon me, but) moronic types of save systems like the one in Neverwinter Nights 1, which just was essentially a memory dump.  To me, this speaks of nothing but poor planning and possibly cutting for scope.  I can't stress too much how trivial and simple this is when planned-for from the start.  It does make certain things like recorded games not possible (or at least simple) when spread across multiple sessions, but... so? I think that it's just something that pvp RTS developers tend not to care about because honestly who needs to save a game that lasts 20-40 minutes on average?

- Yes, we unit test, we do profiling, and so forth.  Though, we don't have any automated test cases that we run for mathematical correctness; we aren't using any testing software or anything.  Our unit testing involves a programmer firing up one of several savegames that we keep handy, and looking at profile data, performance, correctness and overall feel, etc.  Or if it's a brand new feature, then simply having the programmer fire up a game and test that out in a few situations, etc.  We use the prerelease betas for purposes of what we call integration testing, essentially using our core fanbase to help us balance and do the core testing.  They don't seem to mind (and in fact seem to really enjoy having input), and it's the only way for a tiny company like us to get by since we don't have a staff of hundreds (or even one or two) testers.  The programmers also play the game recreationally, which helps to find things and keep things clean, too.  Mostly we have an emphasis on clear software design and bug-avoidance techniques, which also works largely because of the low number of programmers working on it.  For things like balance, we do have the simulation that we run for strong/weak data, and we do some computer-assisted analysis of balance with that, but a lot of it also boils down to intuition and user testing because ships can be used in so many nonstandard ways.

- I would definitely not call AI War simpler than most RTS games -- the simulation itself for all the unit interactions, etc, is several orders of magnitude more complex than... well, any other RTS game, I feel confident saying.  However, we have no physics simulation to speak of, and obviously almost no environmental simulation to speak of, also.  So it's vastly simpler in a few areas (non-gameplay-related, mostly, just environmental), and it's vastly more complex when it comes to the core gameplay itself.  These factors don't matter one whit to having hotseat functionality if you design it properly -- in fact, most of those sorts of environmental factors can be completely ignored for most purposes as things like birds chirping or trees blowing in the wind, etc, are typically not synchronous in an RTS game, anyway; cosmetic, non-simulation-affecting stuff is run on an entirely different random seed that is not synchronous, typically -- same for 3D animations for units, and anything else that doesn't affect where stuff is, who lives and dies, etc.  There's no good reason not to just re-seed that for anyone who joins late in hotseat play, unless your game architecture is just designed in a nonideal fashion from the ground up.

- For secrets, check out the blog if you want a lot of inside stuff.  I don't have anything readily handy to tell you off the top of my head, honestly; I tend to be pretty open about most stuff with the game, so there tend not to be a lot of huge secrets to whip out. ;)

Thanks, I didn't know about your blog and will have to visit it from time to time.  Looks like there's plenty posted to keep me busy already. :)

There's a ton of AI stuff there (and here: http://arcengames.com/mediawiki/index.php?title=AI_War_-_AI_Design) too, which has been really popular around the Internets -- Slashdot, Reddit, Hacker News, MSDN, How Stuff Works, etc.

Also, for more design-oriented stuff, you might like this section of the wiki: http://arcengames.com/mediawiki/index.php?title=AI_War:Fleet_Command#Design_Philosophy

I'm definitely always interested in new potential topics for the wiki or the blog, though, so questions are always welcome.  I just have to balance that with the time it takes to make such posts. :)

Any opinions of F#?  I've been wanting to study O'caml which is very similar.


[0] Message Index

[#] Next page

Go to full version