I'm wondering if anyone has implemented something like a replay function in their game (for use in the following concept game), and can give me some tips or advice.
I have a game concept that is turn-based with a real-time component. In other words, the player will plot his movement on the screen like in a turn-based game. After finishing setting up his movement, the game then generates a series of keypress tests to determine whether the player can successfully shoot targets of opportunity, dodge enemy shots, etc., during the turn. After all of this, the game will then show the results of the turn (like a movie), including the results of the players keypresses.
What I need help with is an efficient method of storing all of the movements/actions during the first two phases of the game. I can't think of any way to do this without creating several huge arrays or types to hold all of the info, running through the turn during the keypress phase (with no graphical updates except for the keypress stuff), recording all of that info in a second copy of the arrays/types, and then finally repeating the run through of the turn, with results and graphical updates.
This whole structure is very similar to a "replay" function, and I was wondering if anyone had made replays work without taking up a huge amount of memory (for the multiple copies of data)? Would I be better off creating a swap-file on the hard drive instead of keeping all of the info in memory?
Any advice would be welcome. This is the largest project I've attempted so far (I'm hoping to release a techdemo... with my crappy programmer's graphics... at some point, just to gauge if the concept would actually be "fun" to play), and I'm stumped at how to do this without creating 3 full copies of all of the data for a level (and each level might contain 30-40 "actors" that would have to be stored...).
Any brainstorms or advice from folks would be greatly appreciated...
|