We’ve been optimising our arses off for the past month or so leading up to release, and the good news is, it’s been successful!
We’re currently on the fence with regards to the JIT compiler, we got it working but it has two side effects: code ran slightly differently, meaning subtle, hard to find bugs were introduced to all scripts; and it C++11 support was required, meaning anyone on old debian or centos would be out of luck running the new game without patching their libstdc++ manually. We’re currently running without it but keeping it as an option in the future if we really need to squeeze more performance out – for the moment it’s looking like we wont need to though!
With all the fancy new stuff KAG beta does, it starts at ~8% CPU usage (mid range dedi box) for 1 player (0.1% for zero players because the game gets completely paused with a new serverside option).
Now, that might sound like bad news; fortunately, it scales really, really well with the number of players (performance is contingent more on the number of complicated objects in the game now, rather than number of players), with our server pushing ~10% CPU for 4v4 (about 0.25% increase per player).
This is largely due to a massive netcode rewrite that’s still partially underway. We’ve learned a lot about networking this kind of game over the past few years, and the way we were doing it initially (based on the quake 3 model) isn’t optimal for a game with a large number of objects – it’s fine for classic where the majority of objects are players, but in the beta the number of game objects is easily into the hundreds, with trees, bushes, inventory items… As such it has been almost completely gutted out.
Long story short, bandwidth up and down per player at 1kBs up, 3kBs down (client end, for 8 players), compared to before the rewrite 2kBs up and 70 kBs down. This means KAG beta outperforms KAG classic in bandwidth utilisation, even though there’s a lot more going on!
We’ve still got to sort out some desync and disconnection issues, as is to be expected with a large network rewrite, but it’s gone very smoothly so far.
We’re going to be crunching all weekend to see whether we can get something together for a semi-public release (hint: watch the forums) because all the major technical hurdles have been stomped, there’s just gameplay issues to iron out now