Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
8
Question by Milad · Mar 13, 2010 at 04:41 PM · rewind

Rewind and Forward the Game

Hi guys,

How can i rewind and forward my game?not a animation,whole of a game.like the footbal games that have rewind and forward buttons.

so thanks

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image JaneHafelman · Apr 05, 2016 at 12:07 PM 0
Share

Seems like this guy made exactly what you need. You can ask him https://www.youtube.com/watch?v=S_j3NHiocuU

3 Replies

· Add your reply
  • Sort: 
avatar image
13
Best Answer

Answer by Lipis · Mar 14, 2010 at 05:09 PM

We have to understand first that is not the easiest thing in the world, and it's really depends on what kind the game it is. It's easier to implement it for a chess game and a little bit harder for a football game.

A general solution that could cover any kind of game would be the most obvious one. We should keep a record in a list of at least these things:

  • Frame Count - If you want to be able to skip frames.
  • Delta Time - You need to know for how long you should stay on that frame.
  • Time Since Level Load - To be aware of the exact time the actual game was on that frame.
  • Current state of your game - Easy to describe, but hard to implement. Let's see it in details.

So for each of these records we need to save the current game state which will include, all the GameObject that you have in the game and for each one you'll need to know:

  • Position
  • Rotation
  • Scale
  • Animations
  • Sound effects
  • Particle Systems
  • ...
  • Things that we can't even imagine
  • ...
  • Lots more

If we managed to store somehow the above information, then the next step would be start implementing our player and examine some of the implications that we might have here.

The simplest thing that the user should be able to do is to replay the game in x1 speed. But we have to decide if we want to replay each frame that happened in the original game or we want to synchronize it with the real time.

  • In the first case, the total replay time in the speed x1 would be different than the original game time, because the new frame rate will not be the same.
  • In the second case it will be much harder, because we might need to synchronize the original time with the current, so we need to be able to skip frames or waiting longer in some of them.
  • In any case we need to apply the recorded information to our current game and we have to do that very fast, because we are dealing with it in per frame basis.

To be able to seek to specific time of the game or playing it with different speeds wouldn't be that hard, because all we have to do is to find the correct record, apply the information and continue from there if not paused. We should also probably will be able to include in our current scripts the information if we are in a normal game or during a replay, because we have to disable the normal flow of the game.

Another completely different approach would to save only the information from the Input of the Player with the exact time-stamp. In order to replay the game afterwards would be starting the game normally, disabling the Input and sending the correct Input to the game at the correct time.

As a conclusion I would like to add that we have to trust completely the Unity Engine/Physics as it should react exactly the same way on each run. But even if we had, because of some time synchronizations problems we most likely will have a completely different outcome of the game (based on true facts).

It is possible, just start by trying to re-play one game object for a minute and if manage to do that, then you are good to go for trying to do it with two game objects for 2 minutes, and if you manage to do even that, then I guess you know how to continue... :)

Good luck and have fun..

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Milad · Mar 17, 2010 at 02:35 PM 0
Share

Thanks my friend.good answer. i do it and give you the result.

avatar image
2

Answer by Ony · Mar 13, 2010 at 08:31 PM

There's no built-in way to do this in Unity as it would be up to you as the programmer to figure out what and how to record what you need.

Basically the idea would be to keep a record of everything that happens to an object in the game as it progresses, and then when you need to fast forward or rewind you would just feed that recorded info back into the system.

There may be a script or something out there that would help out for the initial setup, I'm not sure. Since every game is different and would need different things recorded, again it's up to you as the programmer to figure out the most efficient way to do it.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Milad · Mar 14, 2010 at 05:42 AM 0
Share

i want every where and everytime that i want do it.

can you help me more?what must i do excactly?

so thanks.

avatar image
2

Answer by RElam 1 · Aug 09, 2010 at 09:30 AM

Lipis did an excellent job layout out the basics of the approach you'd want to use. I would add that in most games it's best to do both snapshots of game sates as well as player inputs driving additional changes. When I worked with PhysX, which was admittedly several years ago, it was not deterministic (meaning that given the same inputs in two simulations they were not guaranteed to produce the same result), and I'd wager that has not improved enough to be reliable (just as likely it's gotten worse). While you can in theory rely on recording only player input (or any 'unpredictable' states in your simulation) you will pull your hair out trying to create a deterministic game in most cases, and that's with a 100% deterministic engine, which you likely don't have. But player input takes virtually no data, and would generally dramatically reduce recording file sizes.

Also, if a physics heavy game, consider saving a cumulation of passing time to trigger saving a snapshot, and adding to it when objects collide based on their mass. The biggest variations are generally due to object interaction variation, so trying to do a snapshot after a collision is good. This will also give you more snapshots as more is happening within your scene.

One additional question I have related to this is that if you have a timeline a player can 'scrub' on, how would you go about applying that play time in a desired zero 'real' time. IOW, if you have a snapshot at frame 100, but want to scrub to 150, you jump to 100, restore, then how do you pass 50 frames instantly? Would you set time scale to something crazy high then try to set it back in the appropriate fixed update, or would that cause other issues?

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Related Questions

How do you rewind an animation that isn't playing? 2 Answers

Playing a Video in Unity 0 Answers

Rewind button works but not fast forward button? 1 Answer

Rewind() does not reset Model to original position in a Nested Animation Model Rig 0 Answers

Timer Rewind Script not counting time correctly 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges