Monday, August 8, 2011

Miner Wars - development progress - 8th August 2011

Rastko Stanojevic (3D Artist) works on the intro video for Miner Wars 2081. I don't want to spoil too much so here's is just a small preview - not revealing the details!


Filip Novy (3D Artist) has prepared these great scenes - just by configuring in-game prefab modules. It took him only 15 minutes. Every Miner Wars player will be able to do the same thing very soon!



Next release of Miner Wars is coming this month - we are stabilizing and finishing as many features as possible. Not really adding new stuff, just making existing features stable and polished.

We've also been taking care of a few garbage collection issues: For those who don't know, if you allocate new object, depending on your situation in heap, it may trigger garbage collector to free up unused memory - which can show up as a small halt in execution. The game would just stop for couple of milliseconds.

Our goal is to avoid these situations, so we have very simple rules:
  • don't allocate new objects during gameplay
  • allocating objects during loading time is OK, the player won't see any halting
  • allocating structures is fine, because that's done on the stack.
Programmers sometimes incidentally use code that internally allocates new objects. For example:
  • using LINQ expressions
  • enum as a key to a dictionary
  • casting collection to an interface and then iterating via foreach
  • Or they just make a mistake and don't realize the code is being used within gameplay
I can't track all these places manually by analyzing the source code, so I use "Memory Profiling" tools.


Here's list of those we use:
  • Scitech .NET Memory Profiler - very good, we can see real-time allocations per second and see the call stack that led to the allocation
  • Yourkit Profiler - same as Scitech, but cheaper
  • Microsoft CLR Profiler - free and also very useful, although not real-time data and not as user-friendly as Scitech and Yourkit
  • Equatec Profiler - only performance profiling, but with very good and transparent results
  • ANTS Performance Profiler - probably the best performance profiler, although not that cheap

What I usually do is launch the profiler, let it attach MinerWars.exe, and look for new allocations. If that's not possible then I make a memory screenshot, wait 1 minute, make another memory screenshot, and let the profiler compare results. Final report shows the list of objects created between the first and second memory snapshots. Next, track down the code where those allocations were executed and let know the programmer about it.

The lucky thing is that we don't need to do performance profiling, the game is running really well. But just for curiosity I did the analysis, and to my surprise the most expensive method we use is the calculation of sound occlusions. That's our own method which calculates "visibility" between a sound and the player. The result is then used to set DSP/RPC parameters to the sound - so those who are behind an obstacle are more "occluded" to the sound.

No comments:

Post a Comment