woensdag 29 juni 2011

Baking data..

During development of the zombie shooter we were experiencing an increasing amount of loading times due to all of the new features which got added. This isn't unusual, since it is something logic as cause and effect. But the loading times were getting a bit too long. So we decided to take a look at it to find out where we possibly could find a speed up.


Some technical systems in the game use a lot of data calculated/generated during the loading stage, which takes time. One of those is the pathfinding system which uses the most data at the moment. It generates all of the node data needed for the zombies to walk from A to B during startup. As you can imagine, having a decent amount of nodes to be processed every time the game loads up takes time. Too much time in fact for our needs.


So how to solve this. Since it is a system which is 'calculating' things to be stored in the computer's memory for realtime use after loading, it is possible to capture this calculated/generated data. The trick is to save this generated data and store it in some sort of file from where it can be loaded directly during startup of the game.


Now having the data we need saved in a file, it doesn't need to be recalculated/regenerated anymore during loading. We could say, the (navigation) data is baked into a file. With the data already present in a file, it is possible to directly load the data into the computer's memory instead of calculating it first during startup. This is much faster than calculating/generating the data on every startup of the game.


The main drawback of doing things like this is the need of recalculating and saving data everytime something relevant to that data has changed in the game. The plan is to create a system which automatically detects changes, or at least is possible to force into a mode where the already saved data needs to be overwritten by new generated data.


A lot of technical talk, hopefully next post some more images ;)


-Joep

Geen opmerkingen:

Een reactie posten