mooege/mooege — Issue #282: Game ticking inconsistent/inefficient
Author: xsochor
Created: 2011-11-02 21:24:54+00:00
State: open

Currently:
- Game is ticking +6 units, update all scenes and sleeps for 100ms.
- Real duration of 1 tick is dependant on number of scenes in all worlds in game.
- Game's Update is iterating all worlds and those are iterating all scenes
- every scene in every world is checking, if any player is in it.
- problem when player is on border of scene (scene in visible proximity should be updated too)
(currently even with 1 player on main world it means 288 scenes searching through QuadTrees)

more efficient way:
- Game AND World already have infos on players present, why not just iterate players and make combined list of scenes in any players' proximity
- then iterate and Update only this combined list of scenes
(this would mean max 4 searches through QuadTrees)

Also for real consistency of ticking it would require to setup real-time ticking:
saving starting time of updating scenes, update scenes, and then sleeping for UpdateFrequency - (current time - start time)