suggestion: replay backward/forward

suggestion: replay backward/forward

Requests for features in the spring code.

Moderator: Moderators

Flaka
Posts: 64
Joined: 23 Jan 2018, 18:34

suggestion: replay backward/forward

Post by Flaka » 17 Dec 2018, 09:27

would be nice if replay could play not only forward but also backward. guess that is probably not even too difficult todo. It would sometimes help identiyfying bugs cause u can literally "replay"critical situations over and over without starting the replay from zero.
1 x

dansan
Server Owner & Developer
Posts: 1187
Joined: 29 May 2010, 23:40

Re: suggestion: replay backward/forward

Post by dansan » 17 Dec 2018, 09:44

I don't think that's possible.
It would require the engine to keep a log of all destroyed units (and thus deleted objects) in memory additionally to keeping undo-data for operations that are not strictly arithmetic - like value assignment. That would probably not only blow you RAM, but also your HDD.
1 x

Flaka
Posts: 64
Joined: 23 Jan 2018, 18:34

Re: suggestion: replay backward/forward

Post by Flaka » 17 Dec 2018, 11:06

well the save file from replays are very small so i guess everything it does it is just saving all the inputs from Players like command, text etc. and the rest is calculation. so it must be possible to revert it somehow.
1 x

dansan
Server Owner & Developer
Posts: 1187
Joined: 29 May 2010, 23:40

Re: suggestion: replay backward/forward

Post by dansan » 17 Dec 2018, 11:38

Exactly: the replay file contains no state, only actions.
So the state of the simulation must be calculated for every step.
To go back a step, you'd need a reverse operation.
For addition that's substraction - simple.
But what if I select all units and right-click somewhere on the map?
The active operation for all units will be set (overwriting the previous command) to "move" or "attack" and they will compute a way there (or start to attack immediately) and change the direction of their bodies etc.
No calculation can get you back to the situation before the click, only saving all parameters of all units - that means the complete game state - that's hundreds of mega bytes of data. Now that was just for one frame - that's a fraction of a second. To go back a few minutes, you'll have to have saved thousands of game states - petabytes of data.
In case you know how video compression works: imagine a video file with no i-frames.
2 x

Flaka
Posts: 64
Joined: 23 Jan 2018, 18:34

Re: suggestion: replay backward/forward

Post by Flaka » 17 Dec 2018, 19:56

so if you Right click Units somewhere on the map…. (fucking automatic writing correction on Edge which i have turned out at least 10 times and after a while it enables itself- probably at every update)…. so u Right click and Units move somwhere and is arriving at new destinition. u have all commands, u have new and old Position and then start reading the commands backward. only Thing that is needed is a backward Simulation which inverts Speed, direction, and the visible movement. Maybe its more work than i thought but it should be possible.
1 x

User avatar
Silentwings
Moderator
Posts: 3558
Joined: 25 Oct 2008, 00:23

Re: suggestion: replay backward/forward

Post by Silentwings » 17 Dec 2018, 20:03

It isn't workable, for the reason explained by dansan.

Commands change the state, but not always in a way that can be reversed - they can overwrite information, after which this information cannot be recovered without looking (typically very far) back into the past and then re-performing very many calcuations.
4 x

Kloot
Spring Developer
Posts: 1858
Joined: 08 Oct 2006, 16:58

Re: suggestion: replay backward/forward

Post by Kloot » 18 Dec 2018, 12:39

that is probably not even too difficult todo
I suspect you may be in management, so here are some free tips to improve your style and relations with your underlings:
  • If something seems easy or obvious to you but has not been done yet, assume that it is probably hard.
  • If you want to show this assumption is wrong, do some initial work on your own as a proof of concept and let others pick it up from there.
  • If you can't do the work yourself, accept the opinions of people who can when they tell you it is actually hard.
9 x

Google_Frog
Moderator
Posts: 2428
Joined: 12 Oct 2007, 09:24

Re: suggestion: replay backward/forward

Post by Google_Frog » 20 Dec 2018, 03:48

Here is a relevant metaphor: https://www.youtube.com/watch?v=cSbyCI32CH0

The roadmap for better replay controls looks something like this:
  • Engine save/load (feasible but extremely involved).
  • Optimization of save/load to allow for brief autosaves (probably impossible).
  • Integration of autosaves into replays to allow people to, say, snap back to back to whole-minute timestamps (relatively easy).
From talking to hokomoko, the timeframe for save/load ranges from a few years to never.
2 x

Flaka
Posts: 64
Joined: 23 Jan 2018, 18:34

Re: suggestion: replay backward/forward

Post by Flaka » 21 Dec 2018, 11:02

@Kloot i dont want to breaks ball nor it is true what u might want to say that i cant accept other opinions. i had an idea - i posted it and discussed it. trough a discussion there might be different sight, meaning Knowledge for this reason it is a discussion otherwhise it is a monologue. a discussion helps to understand Things - in this case me - how sth work. so no reason the be offended. thanks dansan and silentwing for explanantions.
0 x

MasterBel
Posts: 107
Joined: 18 Mar 2018, 07:48

Re: suggestion: replay backward/forward

Post by MasterBel » 22 Dec 2018, 01:58

Flaka wrote:
21 Dec 2018, 11:02
a discussion helps to understand Things - in this case me - how sth work
I think what Kloot says still stands, however I might add: If your aim is to gain knowledge, a question is probably what you want. And it's still useful to assume that it's going to be hard. It's also useful to keep in mind that it might have even been suggested before – this is why you're supposed to check before reporting bugs.
0 x

Flaka
Posts: 64
Joined: 23 Jan 2018, 18:34

Re: suggestion: replay backward/forward

Post by Flaka » 27 Dec 2018, 18:21

yeah, ok i got it!
2 x

NeOmega
Posts: 62
Joined: 15 Dec 2010, 11:06

Re: suggestion: replay backward/forward

Post by NeOmega » 20 Jan 2019, 04:46

Does this mean there are no random numbers used in spring engine?
Or is it maybe a seed?
0 x

User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10135
Joined: 24 Jan 2006, 21:12

Re: suggestion: replay backward/forward

Post by PicassoCT » 20 Jan 2019, 09:43

There are no real random numbers in computation? unless you have external sensors too non deterministic real world data. And as the sim has to be sync aka the same after all input steps on all computers, random has to be the same for machines. Spring uses the Mersene Twiste for random, and although the results are slightly biased due to luas number range skewing the outcome its overall a very good random.

No, why does spring not have backwards replay ability and why do lots of other commercial engine do not have that as well or just some approximation like jump to replaysafe point at fixed time XY (like Halo 1 Engine).

Because the replay does not contain what happened in the game. It only contains all input.
Your replay for a deterministic simulation engine only contains all inputs, be it chat, mouse movements and keyboard inputs. If used with the same engine and the same game, the input can replay the game. Replay as in fast forward all input steps and simulation to the point in time the player wants. To speed that up, you can create subsavegames, as in points in time from where to start from. But let's say you want to actually reverse the flow of time. How to do that? Because that would make it necessary to really save all that happened since last input and then inversing them chronological.
And that one is hard.
Real hard as in a lot of game engines for money don't do that, cause so little is gained by it. Sometimes people don't do simple stuff not because they are lazy or evil. They don't do it because you demand water to flow up the river.
0 x

User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7009
Joined: 16 Nov 2004, 13:08

Re: suggestion: replay backward/forward

Post by zwzsg » 21 Jan 2019, 20:40

Save/Load is doable, has even been implemented a couple times. Including autosave. They're imperfect (no projectile, unit scripts reset, etc..) but still serviceable. Wouldn't work with replays though, since replays works with absolute exact state replication.
0 x

User avatar
ThinkSome
Posts: 259
Joined: 14 Jun 2015, 13:36

Re: suggestion: replay backward/forward

Post by ThinkSome » 22 Jan 2019, 00:09

Can save/load not be implement as an open-ended replay? That way there'd be no special handling required.
0 x

User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14542
Joined: 17 Nov 2005, 02:43

Re: suggestion: replay backward/forward

Post by Forboding Angel » 22 Jan 2019, 11:35

tbh, luasave should be adequate. Just save positions, queues, and resource levels. Understand that projectiles and nanoframes will be lost when saving. That is good enough.
0 x

Google_Frog
Moderator
Posts: 2428
Joined: 12 Oct 2007, 09:24

Re: suggestion: replay backward/forward

Post by Google_Frog » 22 Jan 2019, 15:02

Losing anything while saving is not good enough for replay save/load. However, it may be good enough for standard save/load if your players aren't trying to exploit anything.
0 x

dansan
Server Owner & Developer
Posts: 1187
Joined: 29 May 2010, 23:40

Re: suggestion: replay backward/forward

Post by dansan » 22 Jan 2019, 15:46

I can imagine that it'd be handy to setup missions.
0 x

User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14542
Joined: 17 Nov 2005, 02:43

Re: suggestion: replay backward/forward

Post by Forboding Angel » 23 Jan 2019, 04:11

Google_Frog wrote:
22 Jan 2019, 15:02
Losing anything while saving is not good enough for replay save/load. However, it may be good enough for standard save/load if your players aren't trying to exploit anything.
oh no, I meant just for general use case save load
0 x

User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7009
Joined: 16 Nov 2004, 13:08

Re: suggestion: replay backward/forward

Post by zwzsg » 23 Jan 2019, 19:57

dansan wrote:
22 Jan 2019, 15:46
I can imagine that it'd be handy to setup missions.
Indeed.
Except I would use past tense instead of conditional.
0 x

Post Reply

Return to “Feature Requests”