0 Favourites

Time Rewind

  • Hey~!

    I'm making a game where player has the abillity to travel back 10sec in time.Player should be able to activate his time rewinding watch anywhere on a layout.I tried saving position in a variable every tick and restoring player position..but it didn't work.

    I also need the world to rewind 10sec back in time too!

    Can anyone please help me here?Time rewind mechanics?

    Thank You~

  • You dont need ONE variable, you will need an array, because you must store many positions. I would also recommend to store position data every second and not every tick.

  • Thanks for your reply :)

    I don't have good experience with array..But I'll give it a try.

  • Here's an example I made last week showing how to rewind time at different speeds. It should be close to what you're looking for. It's not limited to 10 seconds, but you could limit the width of the recording array to 10 seconds worth of information (600 cells assuming 60 fps).

    Demo

    Capx

    EDIT: I've since uploaded an improved capx that attempts framerate independence. View it here.

  • zatyka good one!

  • zatyka

    Awesome! Thanks for sharing <img src="smileys/smiley1.gif" border="0" align="middle" />

  • zatyka

    This is a spectacular sample! Do you are doing a tutorial?

  • zatyka

    AWESOME! just thing i was looking for! thank you soooo much :D

  • zatyka

    I can ask for an explanation about it? could not understand how you can store that amount of data in a single array.

    Where is the magic?

  • Sorry, been away on business for a while. I'm glad you guys found the example useful.

    @TELLES0808

    Regarding a tutorial, I'd consider it, but I'd feel more comfortable if the rewind effect was framerate independent. I haven't tried to figure out how to do it, so I don't know how difficult/possible it would be to implement.

    As far as the amount of data stored in the array, I don't think it's an unreasonably large amount. At 60FPS, 25200 elements of data are stored every minute in my demo. I don't believe this would cause any drop in FPS, as we're really just adding, deleting, reading, or writing the last column of the array. Unless you're recording for about 4 months straight, you won't come near the limit of an array's size. The only concern I can think of is memory usage, but I don't think this would be an issue unless your recording spans a very large amount of time (hours). Perhaps someone more knowledgeable on the subject of array memory usage can comment.zatyka2013-05-20 21:53:08

    EDIT: Added my attempt at frame rate independence to my earlier post.

  • Wow,thanks! I've got a question,how can i clean an array,for example if i need a restart of the game? I tried but main character teleporting to x,y(0,0),Could you please help?

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • FYI - I updated my earlier post to reflect an improved capx that attempts frame rate independence.

    @arthymon

    You can delete X elements of the array to clear it, but be sure to leave at least 1 X element with valid coordinates (usually the starting position of the character). If you completely delete the array, the game will read a non-existent element as 0.

  • zatyka

    Awesome example. any tutorial for it?

  • erec91

    I haven't written any tutorial. I'm happy to answer questions regarding how it works, but writing a full tutorial is not something I'm interested in at this time.

  • zatyka

    Hello, I used for my game project Time Rewind, its working well for my player but how make the world rewind? for exemple leafs falling with sine behavior? and also enemy moving lef to right with sine behavior?

    Thank you

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
234 61,255
DARKSETH's avatar
DARKSETH
Unread hot topic
0 Favourites
Time to move forward?
110 9,563
GG-Works's avatar
GG-Works
Unread hot topic
0 Favourites
[PLUGIN] Time manager
76 33,828
SondeepH's avatar
SondeepH