So, I'm making a game for PC. The game is a tile based vertical platformer with intertia physics. It has ladders and enemies. For the purposes of this thread, think resyncing a game like NES Ice Climber.
It has proven to be very difficult to program an AI that can play the level optimally, or even find the right path to the end (there may be dead ends). So I implemented input sequence recording for my own use. I play the level once, so the AI has at least one valid solution as to how to reach the end of the level. This is working perfectly.
Now for the next step, I want to program some simple terrain movement algorhythms so the AI can get off track and do some stuff that would be different on each playthrough (mainly fight enemies). It is a multiplayer game, so the other player causes unpredictable things to happen. I'm now thinking how to make it resync to the input sequence.
For each keyframe (that is, a frame where a difference in input has been detected), I save not only each button state, but also x, y, xspeed, yspeed and frame difference from the last keyframe.
I'm thinking this may prove to be very difficult to resync, but there are some points that I can consider:
- Some waypoints are easier to sync than others. Those waypoints where xspeed and yspeed are zero are really easy to resync to. The waypoints where at least one of these is zero may be hard to sync, and those where neither is 0 may be very difficult to sync.
- This may be prone to programming oversights where some situations were not foreseen and the AI can't sync. I hope can debug and refine this if it happens.
- Slight variations on x, y, xspeed or yspeed may be rounded if it is close enough, so the AI can resync without the user noticing (the character "snaps" into place on resync).
Does anyone have any ideas?