Jump to content

Instant replay


Recommended Posts

So the other day I was taking off but I forgot about another plane I left at the end of the runway. Needless to say it didn't end well. At that point though an idea struck me. What about an instant replay system so you can study what when wrong and review the footage. Also you could save your best clips and leave them in a tape library building. That way your very best moments can be saved to be viewed again and again!

Link to comment
Share on other sites

Who needs replay when you can just replicate.

That makes almost no sense whatsoever.

I was orbiting Mun really low, in the map mode planning my maneuver. Suddenly there was an explosion and the flight was done.

How exactly do I replicate that, in such a way as to see exactly how my ship crashed?

Link to comment
Share on other sites

An instant replay kind of thing would be extremely resource-heavy, and likely only even vaguely useful on the most beefed-up computers, in my opinion. It would have to be considerably different and more robust in order to drain as little resources as possible if it's going to be integrated into KSP, in my opinion. That is, of course, if it were recorded as a movie file, frame by frame. There are other options which are likely considerably more useful, though probably exponentially more problematic to code.

Link to comment
Share on other sites

Thre reasons that make implementing of such system really hard:

1. As vexx32 aready metioned such system would require lots and lots of resources (memory or disk space).

Go check out your savegame directoy and see how big is one of your savegames.

If we asume that half of the savegame file actually contains needed information about current position of any craft in your save (it probably uses lots more than half of the savegame file) then we could say that for storing crafts position in certain time you woul need half the size of your savegame. Now multiply this by a few hundred thousands (frames of your recording) and you will quickly see how much disk space you would need to store such recordings.

2. Now you could make this so that you store initial position and any further controll inputs so you actually simulate whole thing again.

While this would indeed require much less resource it needs the game to be able to simulate everything without any deviations in calculations (extreme precision).

But this could not be done in current game system that KSP uses. Why? Becouse currently KSP uses special system which is able to overcome temorary FPS slowdowns in case if some program in the background uses a lot of CPU power by temporarily reducing calculations precision. (everytime the mission clock blinks in yelow).

So for perfect replication of your mission you will have to replicate this behavior also.

3. The biggest problem in implementing something like this is the fact that you would no longer be able to use time warp as it would screw up everything due to using simplified calculations dueing time warp.

So currently the best option is to record the video of your gameplay using Fraps or similar programs.

If your computer is not powerfull enough to run both Fraps and KSP at same time and if you have another computer which might not even be able to use KSP in first place but still enough powerfull to run Fraps you could use this second computer to do video recording. Of course this second computer would need to have some TV card to be able to record video from output sorce and you would need sone VGA/HDMI duplicator to duplicate your screen signal (one goes to your monitor and another goes to your TV card on another computer).

Link to comment
Share on other sites

That's not how replay features are implemented. They don't store complete information about everything going on every frame. They store deltas.

There's no need to keep a copy of the craft every frame if the craft doesn't change. You just store the change if and when it happens.

There's no need to store your position every frame. You just make note of when a change occurs, and by how much.

KSP should actually be able to have extremely tiny replays, since much of in-game time is spent in rails warp, which means everything is deterministic and there's *no need to store anything* for those frames. The only time you need to be writing to the save file is when the player is providing input, plus a keyframe for position, velocity, etc every so often.

The size of a video file is vastly, vastly, VASTLY greater.

Edit: The timer going yellow when "physics lag" is high is not a reduction in precision. It's a slowing down of game time relative to real world time so that the the game can spend more time doing physics per change.

There is a game called "DCS". It is an extremely high fidelity flight simulator, and it's multiplayer. It has replay files. The file size for an hour long mission is measured in megabytes, not gigabytes. The file size for a video of same is hundreds of gigabytes.

Edited by allmhuran
Link to comment
Share on other sites

Aye. Can be done, and I'd love to see it happen, actually. I just wonder exactly how complex the code for all of it would be. It seems whenever someone things something is simple, it turns out to be infinitely more complex when you pick it apart. Nonetheless... as OP stated, it would be quite useful. Might even be good as a general debugging tool, at a stretch.

Link to comment
Share on other sites

Coding for a replay is actually quite straightforward.

All information sent by the player comes via something called the windows message loop, and the events being forwarded by that loop are handled by input processing routines. So the only thing required to be able to replay player input is for the input processing routines to also write those messages out, along with the time they were processed, to a storage object, which is written to the hard drive either synchronously or, for better performance, with a lazy writer. The timer object uses the computer's high performance counter for maximum fidelity (returns information in the form of cpu cycle counts, extremely high precision).

Then you need a keyframe every so often as a master, because even the high performance counters can be slightly off, and when running dynamic physics things may not behave precisely the same way (watch an overly-heavy craft fail on the launchpad several times and note that it's not always the same kind of failure even with no input being provided). The keyframe needs to store all state data... basically, exactly what is stored in a quicksave now, with some simplifications (primarily, there is no need to store all of the part details of all craft every keyframe, since these can only change by an event like decoupling, collision, etc).

Link to comment
Share on other sites

I'm not sure what you're saying there 5thHorseman, but just to make things clear: I do on occsaion record my gameplay (using dxtory, way better than fraps), and I also play DCS, starcraft, and many other games that have replay functionality. I am keenly aware of the difference in file sizes, and I am not exaggerating when I say that hour long replays are in the megabytes, video recording is hundreds of gig for the same duration (you can't do two pass VBR compression in real time).

Oh, and I've also coded games, including replay functionality.

Link to comment
Share on other sites

Oh, aye, but coding a replay system as you describe is likely to be very different depending on the code base you're working with, I'd imagine. Sometimes it'll be easy, sometimes it could conceivably be a nightmare. As such, it's not generally a good idea to assume it's going to be a simple thing when you're not familiar with the code of the game we're discussing. Still, it is a good idea. I'd like for Squad to at least have a look at it and see if it's worth the time. Might help us pin down some bugs, in the end, actually.

Link to comment
Share on other sites

The early '90's game Tie Fighter had a build in record function. It was able to replay your entire mission and allowed you to view it from pretty much any angle. It was always on and did not impact game-play.

If a 486 PC with just 8MB memory was able to do it back then, I am sure a modern PC can do the same.

Link to comment
Share on other sites

The early '90's game Tie Fighter had a build in record function. It was able to replay your entire mission and allowed you to view it from pretty much any angle. It was always on and did not impact game-play.

If a 486 PC with just 8MB memory was able to do it back then, I am sure a modern PC can do the same.

It recorded all your keypresses and then played the game again using this recording instead of using keyboard input. That of course can be used if the game engine is deterministic. That's not so true in KSP where your rocket may have 50% chance of breaking up right on launchpad before you even do anything.

Link to comment
Share on other sites

I'm not sure what you're saying there 5thHorseman, but just to make things clear: I do on occsaion record my gameplay (using dxtory, way better than fraps), and I also play DCS, starcraft, and many other games that have replay functionality. I am keenly aware of the difference in file sizes, and I am not exaggerating when I say that hour long replays are in the megabytes, video recording is hundreds of gig for the same duration (you can't do two pass VBR compression in real time).

Oh, and I've also coded games, including replay functionality.

It sounds, actually, like we're in agreement. Megabytes versus Gigabytes is the huge exaggeration I was talking about when I (poorly, now that I read it back) was pointing out that you don't need to (or want to) record FMV in order to have a replay system.

And while I don't code games, do record KSP with Fraps in fullscreen 30fps and yeah, I have 200 gig devoted to recording and never record more than an hour at a time :D

Link to comment
Share on other sites

  • 4 months later...

I'm going to necro this thread as IMO replay would be an really good feature to add. I would make making videos so much easier as well as taking screen shots for challenges ect. While making replay functionality for something physics based as KSP is not as strait forward as it would be for some other types of games is should be more then feasible and should have less of an performance impact compared to strait up video recording.

The way I would approach it in KSP would be to basically run it as an animation recording. That is to say record location/rotation or "key frames" for each part at 15 or 30 fps (and then in play back that would be interpolated). While not 100% accurate especially if running very low capture FPS it would probably be pretty decent.

As far as performance goes. Just give us a slider for the capture rate and the option to disable it. That way people who want it and have the needed hardware can use it and thous who are running slower system can disable it in order to get the best FPS.

Link to comment
Share on other sites

  • 1 year later...

Holy necro, Batkerman!

I totally +1 this. For those saying it's too resource-heavy, I disagree. Have a look at Falcon 4:Allied Force, you can record and replay missions with literally thousands of entities. And it's older tech than KSP, and would run just fine on 10 year old PCs.

On a site note, what would be the best way of watching a launch from the launchpad? Or, watching a reentry from a fixed point on the ground? I'd really love to see something like this:

Link to comment
Share on other sites

That makes almost no sense whatsoever.

I was orbiting Mun really low, in the map mode planning my maneuver. Suddenly there was an explosion and the flight was done.

How exactly do I replicate that, in such a way as to see exactly how my ship crashed?

HA-Ha yes I agree:D

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...