Lemmings Boards > Tech & Research

How does NeoLemmix handle fast-rewind?

(1/2) > >>

LJLPM:
Hi,
I found a bug in my Android game's fast-rewind option, and levels may not be well saved/restored :(
How does NeoLemmix handle fast-rewind/saved "snapshots" in RAM? How does NeoLemmix keep tracks of level modifications, during the game?
Maybe I could use the same method in the Android game?
Thank you for your help!
 

Nepster:
namida has coded this part, so he knows better why this was coded the way it is. If you want to look at the actual code, you should search for TLemmingGameSavedState in LemGame.pas. The RAM-intensive parts of it are the TerrainLayer and the PhysicsMap, which both are TBitmap32s (a tightly packed byte array of the bitmap info). Apart from that we still save a TByteMap for zombies, though this should be obsolete by now.
Regarding how often this is saved, I have found some comment in the code:

--- Code: ---  // What we want to save:
  // -- Last minute: One save every 10 seconds
  // -- Last 3 minutes: One save every 30 seconds
  // -- Beyond that: One save every minute
  // -- Additionally, a save immediately after the level is initially rendered
  // This will result in 11 saved states, plus one more for every minute taken
  // that isn't in the most recent 3 minutes. This should be manageable.
--- End code ---
and every now and then the list of save states is cleaned and the no longer needed save states are deleted.
On huge maps that go on for 10 minutes or more, this might take about 100MB storage or even more. But as NeoLemmix targets actual computers and not smartphones, this is acceptable for NeoLemmix.

LJLPM:
Thank you for your reply!
I also save level's bitmaps (actual level's image + level's mask), and I hoped for a less RAM-expensive method, in NL...
In the Android game, I've done tests using up to 3 recyclable saves -as I can't use 100MB in RAM-. Since it's a very convenient feature, it's too bad I can't allow many saves in RAM, for the game (unless I find a lighter, and more reliable, way to save level's bitmaps... As a matter of fact, level modifications only deal with few pixels...)

namida:
The amount of saves NeoLemmix makes is probably excessive. Even saving perhaps (where N = now) N - 20 seconds, N - 40 seconds, N - 60 seconds plus a save every 2 minute mark, is probably enough. It's worth noting that NeoLemmix's processing / rendering was far from optimal at the point where this feature was first implemented, so it benefitted much more from having more-frequent saves. I suspect that the amount of saves kept could be greatly reduced on the current version with no noticable degradation in performance except maybe on particularly large levels with a lot of action going on at once.

EricLang:
Actually rewind could be implemented just replaying the game without updating the screen. This is quite fast and does not need any buffering / saving.

Navigation

[0] Message Index

[#] Next page

Go to full version