Nick:  
Pass:     
Help Register


Post Reply 
Dwelvers Journal 2013.09.28 - Framerate increased. The game runs faster!
Author Message
Rasmus Offline
Main developer of Dwelvers
Dwelvers Developers

Posts: 3.619
Joined: Sep 2013
Reputation: 502
Post: #1
2013.09.28 - Framerate increased. The game runs faster!
Pew, finished with the framerate decrease issue and the battle bugs.. I gotta say that they were very close related to each other :/
Well, now the battle works too good, so I had to increase the Dark Dwarfs health, otherwise they got slain to easily..

Time to get technical for those that are interested Smile

So after some bottleneck searching I made these changes:
- As described above a lot of items on the ground caused a frame decrease because all item have a pick-up job related to it.. Now I did so that if there are a lot of similar jobs next to each other some of them will be toggled on and off, this can make the imps prioritise a job farther away than necessary, but I don't think it will be noticeable in gameplay, maybe if the player have 60 farmspots spread out all over the dungeon, but otherwise I think it will be okay..
- And of some weird reason, lightning up walls tiles in cyan colour took 25 % of the processing power.. Now it takes 0.0001% as it should do Tongue
- I also optimised and made the work spreading algorithm faster (this is the one that make creatures knows about a certain jobs).
- And most importantly the creatures seeking, fleeing and fighting algorithm have rewritten, so now the creatures fight and run away as they should and not just stand there. The previous algorithm was very bad written, or lets just say that I was tired and made a little mistake Tongue The searching for enemies algorithm had the time complexity O(n^2) meaning that the calculation time was exponential depending on the viewing / smelling distance and the number of creatures. So now I made it linear, having 100 calculation instead of 100x100 = 10000 calculation with the same result.

Okey, this little adjustment gave the framerate a push from 30fps to 170fps.

[IMG]replace_photbucket_link/IncreasedFPS.png[/IMG]

As seen in the picture this situation is what caused a frame-decrease, a lot of creatures hunting each other and a lot of items laying on the ground in an open area. Currently in the picture there are 639 available jobs that the imps have to choose from, it takes 1,5 ms for the computer to make them available for the creatures to choose from, and 1,5 ms for the creatures to prioritise between them (well, some other stuff is included here as well). This may not sound as much, but at 170 fps one frame is rendered in 5,9 ms meaning that the jobs takes more than 50% of the total update/rendering time.. I haven't started threading this algorithms yet, so there is still a lot of space left for improvement, but this will have to do for the upcoming update.

Okey, three issues left, and maybe some suggestions, after that it is updating time Big Grin

But there have been very little talk about how smooth the game is running on your computers, I would very much like to start a thread about this after the next update as I feel like it is a very important part of the game as well..

Doors solved, the storage room clogging issue have been moved to a be fix in future updates because of the reason explained here: http://forum.dwelvers.com/showthread.php?tid=61
(This post was last modified: 22-03-2014 10:10 PM by Sebt.)
28-09-2013 01:42 AM
Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)


© 2013-2017 Dwelvers | Contact