Some time after I put my last update about game progress, new ideas came to my mind. I opened game code, went through it and... saw some "things" that I have not noticed before. These things were the source of several errors that occurred in the game from time to time. I couldn't resolve them (despite many attempts) so far, and I just left them as they were...
I updated the code, made some tests and finally successfully resolved below issues:
1. Sometimes fight system did not work properly. Sometimes fight took far less than 1 second. This was so quick, that player did not have a chance to teleport his miner and save him if he was losing. Now everything is correct, and your miners life during fights depends on your perception and reflex only.
2. Sometimes, danger sound (played when for example miner fall into the water) was played multiple times without a brake in 1 second, what of course was not pleasant to listen. This is solved.
3. Sometimes, shortcut for running in "platform style movement mode" stopped working. Now, this of course is solved and player can move miners without any problems.
After dealing with above mentioned topics I had another idea how to improve performance of my game engine. As an introduction I can say that during creation of a game, on early stages I have issues with performance. Problems were solved in many ways, mainly by rewriting game code in better way, what consumed less CPU. Efficiency of a game engine was at desired level and game was fully playable. However, later when I created bigger maps, and played for some time, dig more and more tunnels, FPS have dropped. Game was still playable... but it was significantly slower. This was obvious for me that this is caused by amount of terrain objects that were created and used by a game, but I couldn't do anything with that. As occurred recently solution was very simple (but contrary to appearances it was not simple to find it). So, what is it?
Basically game uses blocks to create a game map - 1x1 blocks. Main part of all maps creates mineable dirt blocks. I have added 2x2, 3x3, 4x4 and 5x5 blocks to the game what allowed to decrease amount of used objects. While program is loading new map from the file, it automatically choose and use the best size of blocks to reduce number of created objects to the minimum. Amount of used objects, depending from the map, has decreased by... 50-70%! That is huge save in the memory. As a result, all my FPS issues has gone. I have to say, that I'm very proud of this optimization. You can see how it works in attached screenshot.
Last thing that I would like to mention is not a bug. On previous update I wrote that in general nothing has changed in achievements. Well, now, I added additional 24 achievements, so now there are 72 in total!
|
|