Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by CACUser

How can I create a demo for my game? I would like to create a short 30 second demo show casing a few features of my game. Something like what Dominic did at http://html5-benchmark.com/.

I am also assuming that is set at 60 fps and the demo will be slower on slower machines.

Thanks for any input.

1 decade ago by Joncom

I'm curious too how someone would go about recording a demo like the one in the link.

I imagine running into the following difficulty when attempting such a thing:

My games perform slightly different on each PC. And this sometimes has a noticable effect on the behavior of entities. For example, in Scary Chicken (if you keep running) you won't see the chicken until just before the third egg. But on slower devices like a cellphone where the FPS is quite low, the chicken can be spotted before the second egg.

If performance affects game behavior then it seems it would be a challenge to have a demo replay exactly the same each time. Hmm.

1 decade ago by ArcadeHype

Thats pretty cool, i wouldn't mind knowing myself how such a demo is created with Impact.

I think Dom can best answer this question for us...Dom shed some light on this :]

Thanks.

1 decade ago by CACUser

Hi Dominic - It would be nice to know how you created the demo at http://html5-benchmark.com/ : I have looked at related forum posts and haven't found a solution. It is crucial for my project to implement a demo version. Any help would be greatly appreciated!
I also looked at the book by Jesse Freeman - no help there either.

Thanks!

1 decade ago by y0ungb0b

In theory, you record and store your input and use that data in your game loop instead of reading the keyboard/touchscreen.

Storing input for every frame could result in large amounts of data, so storing each input only when it changes might be better solution.

You have to be aware of any random stuff (ie: stuff that can kill the player) that could happen in your level, otherwise the 'play through' could be cut short.

1 decade ago by CACUser

That seems to be the direction to take. Dealing with the other stuff that can kill the player is going to b tough. Thanks for your input.

1 decade ago by Krisjet

Looking at Doms code it looks like he recorded input per frame, and stored it all in one int. As far as I can tell he assigned different values to each of the four possible actions, left, right, jump and shoot, and assigned them the values 1, 2, 4 and 8, and then used a bitwise operator to check if one or more buttons were pressed at the same time.

update: function () {
var f = BiolabGame.FRAMES[this.frame];
this.frame++;
var left = f & 1,
right = f & 2,
jump = f & 4,
shoot = f & 8;
ig.input.presses['jump'] = jump && !ig.input.actions['jump'];
ig.input.presses['shoot'] = shoot && !ig.input.actions['shoot'];
ig.input.actions['left'] = left;
ig.input.actions['right'] = right;
ig.input.actions['jump'] = jump;
ig.input.actions['shoot'] = shoot;
this.parent();
this.camera.follow(this.player);
},

His replay is stored in BiolabGame.FRAMES and looks something like this:

BiolabGame.FRAMES = [0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 10, 10, 10, 10, etc.

It's superlong of course, since it's 60 ints per second, but it seems like a reasonable way of doing it. I'm not sure what will happen if you have framerate issues though, I guess you will have to ask Dom about that, or do some tests on your own.

1 decade ago by CACUser

Thanks! This forum thread: http://impactjs.com/forums/help/deterministic-game-loop
talks about how to deal with the frame rate. I will try to combine the two and see if I come up with a working solution. I will still have to test and see how other entities behave with varied frame rate.

1 decade ago by Joncom

CACUser: I'm curious if you came up with anything. The subject still interests me.

1 decade ago by vincentpiel

I will soon (<2 weeks) release here a revamped version of ig.input that allows recording keys/replaying them. This part works fine and is framerate independant, but i still need to work on the 'touch' features of the lib.
I'll post here to let you know.

1 decade ago by Joncom

I look forward to seeing what you come up with vincentpiel.

1 decade ago by fulvio

In order to do something like the demo you would have to capture each input as a frame value and store them in an array.

If you peek at the source code, you'll notice that the update() method executes input presses depending on frame values and the camera simply follows and replays its movements.

FRAMES = [0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 10, 10, 10, 10, 10, 2, 2, 2, 2, 10, 10, 10, 10, 10, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 10, 2, 2, 2, 2, 10, 10, 10, 10, 10, 10, 2, 2, 2, 2, 2, 10, 10, 10, 10, 10, 10, 10, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8...];

update: function () {
    var f = FRAMES[this.frame];
    this.frame++;
    var left = f & 1, right = f & 2, jump = f & 4, shoot = f & 8;
    ig.input.presses['jump'] = jump && !ig.input.actions['jump'];
    ig.input.presses['shoot'] = shoot && !ig.input.actions['shoot'];
    ig.input.actions['left'] = left;
    ig.input.actions['right'] = right;
    ig.input.actions['jump'] = jump;
    ig.input.actions['shoot'] = shoot;
    this.parent();
    this.camera.follow(this.player);
}

1 decade ago by vincentpiel

I promised a library allowing to record the player's movement two weeks ago : i see that this time elapsed, and i could not work on this project. My client has an emergency, and hence so do i.
One has to eat i guess, and i cannot take time for this exiting stuff right now.

I can, still, provide the code 'as-is', with little support, and with a non-disclosure agreement to, say, the people who allready posted here, contact me if interested.

I'll get back to code the final version when things gets more calm in my work.

1 decade ago by Joncom

Quote from vincentpiel
I'll get back to code the final version when things gets more calm in my work.

Take your time man, and work on whatever you feel like working on. ^^
Page 1 of 1
« first « previous next › last »