View Full Version: Demo System

CloneKeenPlus > Programming > Demo System


Title: Demo System


pizza2004 - December 9, 2009 03:37 PM (GMT)
I figured outthe way to make demos work, and while it will be version compatible, it might not always agree if we change how the physics work.

Basically, when you start to record a demo (we can make it like the god cheat, hold down D E M and O and it will start or stop the demo) it creates a savegame just like a regular one. Then it begins to log your keypresses, recording what you push and how long you push it. If you die it exits demo mode, if you exit the level it exits demo mode. Once ithas recorded all that it stores it to a file. When a demo plays it loads the save file and then flushes all keystrokes (if you press anything, the demo ends, and the press anything box might just stay visible) then it "plays back" your keystrokes by simulating keypresses to match yours, when it reaches the end of the file it stops for a second or two at most and then goes to the next demo. A file would tell how many demos there are, and use that to randomly select a demo to play. We would include roughly 10 to 14 demos per game, just to make sure they aren't monotonous.

Once we figure this out we will have a stable demo system. We will only have to worry about having the physics change therefore ruining a particular demo. We will want to have 8 single player demos, 2 two player demos, 2 three player demos, and 2 four player demos. Only the one and two player demos are important though. Once we have the multiplayer modes implemented, then it will be 2 of each of them, and 8 of regular.

gerstrong - December 9, 2009 05:20 PM (GMT)
[/QUOTE]
I figured outthe way to make demos work, and while it will be version compatible, it might not always agree if we change how the physics work.

Basically, when you start to record a demo (we can make it like the god cheat, hold down D E M and O and it will start or stop the demo) it creates a savegame just like a regular one. Then it begins to log your keypresses, recording what you push and how long you push it. If you die it exits demo mode, if you exit the level it exits demo mode. Once ithas recorded all that it stores it to a file. When a demo plays it loads the save file and then flushes all keystrokes (if you press anything, the demo ends, and the press anything box might just stay visible) then it "plays back" your keystrokes by simulating keypresses to match yours, when it reaches the end of the file it stops for a second or two at most and then goes to the next demo. A file would tell how many demos there are, and use that to randomly select a demo to play. We would include roughly 10 to 14 demos per game, just to make sure they aren't monotonous.

Once we figure this out we will have a stable demo system. We will only have to worry about having the physics change therefore ruining a particular demo. We will want to have 8 single player demos, 2 two player demos, 2 three player demos, and 2 four player demos. Only the one and two player demos are important though. Once we have the multiplayer modes implemented, then it will be 2 of each of them, and 8 of regular.
[QUOTE]

This sounds like a good implementation. It's similar to the old (sucky) Demo system with one difference. You need to pass a command parameter to record and you only can record in the level. Let me think about your idea. Maybe we can combine that with the savegame structure. Getting one state, recording command input adn save that data together.

I'm not sure. And if we type DEMO and DEMO again to finish recording? Would be another idea.

One thing is sure. It will be more work. I'd rather prefer finishing the support of all the episodes back again and implement demo mode is last implementation.
I also think, the support doesn't need to exist in the release. Well, we can discuss this more about...

pizza2004 - December 9, 2009 06:32 PM (GMT)
I just realized, this method wouldn't work well, due to the unpredictability of enemies and other such things. We need to study the demo system from Keens 4-6 to figure out a way to more effectively do demos. I get the feeling we are going to have to actually record a video of sorts to have proper demo system. I think we should start working on implementing things from Keens 4-6, mainly the imf music so that the original music can be used in the game rather than something we made ourselves.

gerstrong - December 10, 2009 10:45 AM (GMT)
QUOTE
I just realized, this method wouldn't work well, due to the unpredictability of enemies and other such things.

Good Point. Everything using random functions can't be predicted. That's true...
QUOTE

We need to study the demo system from Keens 4-6 to figure out a way to more effectively do demos. I get the feeling we are going to have to actually record a video of sorts to have proper demo system. I think we should start working on implementing things from Keens 4-6, mainly the imf music so that the original music can be used in the game rather than something we made ourselves.

Or we check out, how to generally create demos. Videos would be the easiest solution, yet, it will mean, we need another library bind into CG.



Hosted for free by InvisionFree