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

4 years ago by Krisjet

I've been thinking about implementing a replay system ala Starcraft or Heroes of the Storm for one of my action games lately, but I'm foreseeing a lot of problems with it. What I was thinking of doing was to make sure that all gameplay specific calls to random() follow a seed which is saved with the recording, and then I record every input the player makes with a timestamp. Upon replaying a recording, it would basically just be playing the game with pre-recorded input.

My concern is that the framerate and other things will introduce tiny disrepancies in the playback, and the game will desync sooner or later. What do you guys think, have any good ideas for a different approach I could be taking, or should I just go for it and see how it goes?

4 years ago by FelipeBudinich

I say you should try to check how much does stuff desync, that way you can get an approximation on how much time you get to replay.

I don't think that framerate will cause desync, but floating number accuracy certainly will.

4 years ago by stahlmanDesign

This replay idea would be a good way to record gameplay and play it back as a demo. But as you have noted, what if you have entities that move randomly and they don't always end up in the right place...

4 years ago by drhayes

I've had exactly those thoughts. I'm not so much worried about random numbers (there's good libraries out there for seeded PRNGs) as I am the drift from floating point calculations building up over time. You get into similar territory when building a multiplayer game, I'd think. Dead reckoning as a method of catchup doesn't work when the position calculations will drift over time.

One thing I've thought about is taking a snapshot of the sprite's position, velocity, and acceleration every nnn milliseconds and flat out tweening the sprite over time to simulate playback. You could snapshot sprites during collision to ensure you've got the deltas correctly there.

At that point, though, you're not using Impact's physics system. That's yet another problem. :/

4 years ago by stillen

You could go in a really different direction too. I did something similar for a game I was working on.

Basically what I did was copy the image of the game canvas data every second. I placed the data into an array that would continue to overnight it self as the game played.

When I needed a replay, I would feed the image data array into a separate canvas. This made a slow mo snap shot type of replay feel. I did this and had it go black and white with canvas effects, so it was very styled. It was a game over/level over type of replay.

I bet you could take this idea as well, that way you're not effecting your game at all.

4 years ago by drhayes

Quote from stillen
Basically what I did was copy the image of the game canvas data every second. I placed the data into an array that would continue to overnight it self as the game played.

When I needed a replay, I would feed the image data array into a separate canvas. This made a slow mo snap shot type of replay feel. I did this and had it go black and white with canvas effects, so it was very styled. It was a game over/level over type of replay.


stillen, I'magonna steal that. What a great idea.

4 years ago by Krisjet

That's a cool idea for a game where you don't want to be able to save the replays, but I was thinking that the data would be saved to a server, and then a snapshot approach will take a lot of space really fast. I might steal that idea too for a different game though, smart way of doing it :)

4 years ago by Apiheld

Quote from stillen
Basically what I did was copy the image of the game canvas data every second. I placed the data into an array that would continue to overnight it self as the game played.

How long was one game round? Canvas data * seconds = a lot of space, if the game lasts like 30 minutes or so.

4 years ago by stillen

I was only saving the last 15 seconds, with 1 image/per second, so essentially it was only 15 images worth of data. I would just keep overwriting the data with new data. I actually got it working on an iPhone without the B&W effect, since most canvas effects seem to kill the phone.

This was on a regular iPhone 5, so the image size wasn't huge, but also the allotted memory wasn't a lot either. I'm sure there is a threshold on desktops, but it would be larger.
Page 1 of 1
« first « previous next › last »