Search Unity

[Depreciated] Ultimate Replay - Complete state based replay system

Discussion in 'Assets and Asset Store' started by scottyboy805, Jun 28, 2017.

  1. fssdev

    fssdev

    Joined:
    Jan 16, 2017
    Posts:
    50
    That gets the ball working. We have another item that has the Replay attached to it that is not working as we'd like. When the ball launches there is an object prefab that gets instantiated behind it over and over again, that we are using to mimic a ball trail, so there is possibly hundreds of these behind the ball.
    The replay system is only instantiating 1 of these objects, only the first one. Does this have something do to with them all being named the same thing? they are just clones of a prefab.
     
  2. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    My initial thought is that each of those replay trail objects have the same ID for some reason which could cause the problem you describe. The name of the object does not matter as it is not used by the replay system. You can check whether that is the case by looking at your ball trail objects during recording to see whether each these objects has the same replay identity for the ReplayObject component. Each instance should have a unique replay id.
     
  3. fssdev

    fssdev

    Joined:
    Jan 16, 2017
    Posts:
    50
    Yes, they all have the same replay ID
    In code, all I'm doing is this:
    Code (CSharp):
    1. GameObject trailObj = (GameObject)Instantiate(Resources.Load("BallClone"), tee.transform);
    Should I manually generate a new ID for each object after I instantiate them?
     
  4. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    No you should not need to generate an ID manually. The replay system should handle all of that for you so it is indeed a bug on our end. I will have a look at the problem first thing tomorrow and try to get a fix for you asap.
     
  5. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    For now you may be able to get around the problem by forcing the id to be updated like so:

    Code (CSharp):
    1. trailObj.GetComponent<ReplayObject>.ReplayIdentity.Generate();
     
  6. fssdev

    fssdev

    Joined:
    Jan 16, 2017
    Posts:
    50
    The code:
    Code (CSharp):
    1. trailObj.GetComponent<ReplayObject>().ReplayIdentity.Generate();
    Does not seem to be generating a new number.
     
  7. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    Ok that is strange. The id will not be regenerated if the replay system thinks it is already unique so I will need to look into it further to find the problem.
     
  8. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    @fssdev I have had a chance to do a bit more testing and everything seems to be working as expected for me. I setup a scene where I instantiated a number of objects from the same prefab and each object had its replay ID updated with a unique value and they all replayed properly.

    I do have a few of things for you to try:
    • See if the included stress test demo works for you. This uses the same principle of instantiating from the same prefab multiple times.
    • Check if the prefab your are instantiating is registered in the replay manager prefab list.
    • Check that you are instantiating your objects during recording and not before. I expect you already are though.
     
  9. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    Version 1.0.5 has been submitted to the asset store. This version fixes a bug where prefabs created by dragging from the scene into the project folder could not be registered as a replay prefab.
     
  10. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    Version 1.0.6 has been submitted to the asset store. This is just a small patch version and fixes an issue where Unity Color structs would not be serialized correctly.
     
  11. mertakbal

    mertakbal

    Joined:
    Jun 19, 2013
    Posts:
    9
    Hello,
    We are recording the first person camera position and orientation with ultimate replay and have now a pradoxal camera problem and a collider problem:

    1. when playback starts Replay Manager creates its own camera at the position of the last camera position and orientation of fps camera. I can see in the scene view that my player controller and camera are replayed, but i dont get in my gameview the point of view of fps camera replayed.
    2. when the replay finishes my player controller starts a free fall down of my scene. (probably because some colliders are deactivated?)

    it would be great, if you could suggest me a solution.
    best wishes Mert
     
  12. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    Hi,
    The camera that the replay system creates is only there to act as a demo and to show that you can move around the scene and is created as part of the 'ReplayControls' script. If you find the script in the editor and disable 'Allow Playback Free Cam' then this should fix your first issue. You are able to use any camera you wish to view the playback.

    The second issue I will need a bit more information about. Ultimate Replay will disable any collides that could cause problems during playback but it should also re-enable them when you switch back to live mode. What collides are you using? also are they 2d or 3d? do they ever get re-enabled after playback or are they left disabled? anything else you feel may be a contributing factor?
     
  13. mertakbal

    mertakbal

    Joined:
    Jun 19, 2013
    Posts:
    9
    Thank you very much. setting Allowplayback Free Cam false solved my first issue!

    Concerning the second problem:
    My floor/room collider is a 3D Mesh collider. I tried to put a new cube with rigid body component to the scene as well as replay object and transform components. but this cube doesnt start to fall from the scene like the fps controller after the playback finishes.
    So I checked if something is wrong with my fps controller (on which i have additional components). for that i put a new fps from standart assets. unfortunately this fps also shares the same fate with my fps, loosing the collider ground and falling into the void as soon as the playback finishes.
     
  14. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    Glad to hear the the first issue is solved.

    Your test cube is probably not falling because it does not have a rigid body component but i suspect I may already know what the issue is now. If i remember correctly I think the first person controller script manually applies gravity which may be causing the problem. If the collider and rigid body are disabled during playback but the controller script is still running and adding gravity it will cause the controller to go through the floor. I will have to test this to make sure this is the problem but I will get back to you and let you know.

    If that is the case then it can be resolved by either coding in some checks in the controller script to only apply gravity when playback is not occurring or by disabling the controller script during playback.
     
  15. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    @mertakbal I have done some testing with the first person controller in the standard assets and everything appears to be working fine for me. The camera position gets recorded and replayed as expected and the player shows no signs of falling through the mesh collider floor. I have a Replay manager with Replay controls in the scene and the fps character camera has a ReplayTransform component to record the movement. Is this how your scene is setup or are you recording anything else on the player controller?
     
  16. mertakbal

    mertakbal

    Joined:
    Jun 19, 2013
    Posts:
    9
    I see. I have also a replay object and replay transform component on the player controller object (the parent of the camera), else the position of the camera, doesn't chang since it is still attached to the parent. Also only pitch rotation is recorded, but not the yaw, since it is connected to player controller object.
    I also tried the setting on the demo scene, nevertheless it doesnt work.
    i.e.
    either player controller with replay object and replay transform components then after replay player falls down
    or player controller with replay object and replay transform components then on replay camera doesnt replay location or yaw rotation, replays only pitch rotation.

    I am now updating from 5.5.2 to 5.5.4, maybe there is some issues with my standard assets.
     
  17. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    Sorry for the delay. I added a replay transform to the player object and everything appears to be recording properly for us. The full movement of the object is recorded along with the camera X and Y rotation. The only slight issue is that the mouse look script is fighting the playback and trying to re-position the camera every frame causing a flickering between 2 positions. This can easily be fixed though.

    Is there any chance you can send me your project or a repro project that shows the same issues to info@trivialinteractive.co.uk as I cant seem to replicate it at the minute. I will keep trying some different things though.
     
  18. stoogebag

    stoogebag

    Joined:
    Jan 30, 2013
    Posts:
    5
    Hi

    I was getting the nullreferenceexception in replay playback same as the guy above. In my case it seems to have been caused by my gameobject having a missing script attached (ie a component on the go for which the scrtipt had been renamed/deleted - I didn't notice because this really has no consequences until you do something like loop through all components attached and ask their type in an unsafe way).

    Removing the empty component seems to have solved the issue.
     
  19. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    Thanks for letting me know. We will add some better error checking in the next update
     
  20. king27

    king27

    Joined:
    Jun 11, 2016
    Posts:
    2
    Hi ScottyBoy805,

    Ultimate Replay looks great! Thanks for creating it :)
    I was wondering if there is any way to playback a replay while continuing to record? I am hoping to play back the slow-motion replay in a window without stopping the record, using your rolling buffer configuration.

    Thanks for your help,
    Mike
     
  21. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    Hi Mike,

    At the minute there is no support for recording and replaying at the same time but it has been requested a few times now so we may add it in a future update.
     
  22. king27

    king27

    Joined:
    Jun 11, 2016
    Posts:
    2
    OK awesome! Thanks for the great asset! I'll keep an eye out for an update down the road.
     
  23. jhsu

    jhsu

    Joined:
    May 12, 2014
    Posts:
    4
    Does this work with skinned mesh objects?

    I downloaded the trail to see if I could record and playback a third person controller. I simply pasted the 'ReplayCommon' object from the demo into my scene, but I don't understand what I should apply the 'Replay Object' component to.

    If I have a third person character in the scene, should I apply it to the mesh or the skeleton? Do I add a 'Replay Transform' component or something else?
     
  24. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    Yes skinned objects are supported. You can either use the experimental ReplayAnimator component to record the animation state or use the Replay Transform method to record each bones position and rotation. The ReplayAnimator component is easier to setup but may still be buggy and lacking features so I will cover the second method:

    You will need to add a ReplayObject component to the highest level object you want to record, in this case the root character game object. You can then add a ReplayTransform along side this ReplayObject component to record the characters world position. You then need to identify each bone object in the hierarchy (Or each bone you want to record) and add a ReplayTransform component that records position and rotation. Once this is done you can re-select the root object that you added the ReplayObject component to and verify that all child components are in the observed list and then you should be able to record and replay your third person controller.

    You may also find that the animator is interfering with the replay by trying to modify the position of the bones according to the animation state. If this is the case then you can simply disable the animator while playback is occurring.

    I hope this helps you. Let me know if anything is unclear.
     
  25. GilbertLau

    GilbertLau

    Joined:
    Dec 3, 2017
    Posts:
    26
    Is there any way to save a replay to file/JSON etc?
     
  26. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    Replays can be saved to file using the 'ReplayFileTarget' component (which is currently in beta) however the format is a custom binary format which is optimized for load time and reduced file size. I think if we added support for saving to JSON then the read performance would be too slow causing a buffering effect not to mention the drastic increase in file size.
     
  27. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    Version 1.0.7 has been submitted to the asset store. This version includes:
    • Bug fixes in the ReplayFileTarget component
    • Added foundations for future ReplayFileTarget features
    • Bug fixes to the ReplayAnimator component
    • A few other small bug fixes
    Unfortunately we have had to disable the ReplayParticles component in this version as we have been unable to accurately replay them properly yet. Instead a replay of a particle system is choppy and not nice too look at because we are not able to explicitly set the current frame of the particle system. We will be working on a much better way of implementing this however.
     
  28. mertakbal

    mertakbal

    Joined:
    Jun 19, 2013
    Posts:
    9
    Dear scottyboy,
    finally I managed to I send you our unity project with descriptions about problems on 8th February. The issues are concerning the Player falling out of the scene after replay is finished, describing the issues as well. It would be great if you can have a look on the scene.
    Thank you a lot in advance
     
  29. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    Sorry for the delay. Yes I will take a look at the project as soon as possible and let you know what I find.
     
  30. mertakbal

    mertakbal

    Joined:
    Jun 19, 2013
    Posts:
    9
    Thank you very much.
     
  31. unity3dat

    unity3dat

    Joined:
    Aug 9, 2017
    Posts:
    88
    I have a Unity WebGL first person shooter. At the end of a run, the score is sent to a database using Ajax (to make a highscore table). Because the games runs on the client, it's not that hard to cheat for users who know a thing or two about programming. So I thought about automatically recording the game, and then manually checking the top5 by replaying the game. This way, I can see that the player indeed deserves the score that was put into the database.

    Would this asset enable me to do this? It must be WebGL compatible.

    I'm not sure how it works, didn't go through all the docs, but I basically want it to record everything in the background, send it to my server, after which I can replay the game the user played.

    Is this something Ultimate Replay can do? How would it work?

    Thanks!
     
    Last edited: Feb 27, 2018
  32. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    Hi. We have only tested the asset on windows and mac platforms but I see no reason why it should not work in web gl but we do have a free trial version of the asset here so you can try it out before you buy and see if it fits your requirements.

    It certainly sounds like Ultimate Replay would be suitable for your needs. Basically you would add replay components to all game objects in the scene that you want to record and then use the replay system to record to file (which uses a custom binary format) while the game is playing. After the game has finished you would upload the replay file to your server so you can download it on your end into the same Unity project (Each scene object is given a unique replay id which must match with the recorded data in order for playback to work properly) in order to validate the gameplay.

    I hope this helps you.
     
  33. unity3dat

    unity3dat

    Joined:
    Aug 9, 2017
    Posts:
    88
    Thanks for your reply!

    I'll try the free trial to see if it works on webgl.

    Something else: how can I access the binary so I can send it to my server? Does it get saved somewhere as a txt or does it exist inside unity as variables or...?
     
  34. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    You can specify the location of the replay file either in the inspector or via code using the ReplayFileTarget.
     
  35. unity3dat

    unity3dat

    Joined:
    Aug 9, 2017
    Posts:
    88
    Thanks for your reply. I download the trial version, but all scripts are DLL files, which my mac doesn't seem to be able to open, so I can't go through the demo files. Any tips?
     
  36. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    The source code is not included in the trial version, only in the full version. The trial version is only meant to be used to see if the asset fits your requirements and so you can see how the asset works so source code should not be needed.
     
  37. unity3dat

    unity3dat

    Joined:
    Aug 9, 2017
    Posts:
    88
    I understand. The thing is I need to know for sure I can send the recording to my database, so I need to know how it looks like and whether or not I will be able to send it to my server with an Ajax call.
     
  38. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    The replay data is a custom binary format that stores chunks of snapshots using time stamps. You should be able to generate a replay file with the trial version and try sending that to your server to make sure everything works OK.
     
  39. unity3dat

    unity3dat

    Joined:
    Aug 9, 2017
    Posts:
    88
    OK, then I'm clearly not looking at the right thing... Could you maybe tell me where in the inspector (for which gameobject) I can specify the location of the replay file using ReplayFileTarget?
     
  40. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    If you open the demo scene located in 'UltimateReplay/Experimental/ReplayFileTargetTest.unity' you should be able to see how the ReplayFileTarget component is used on the ReplayManager game object which is located under the ReplayCommon root game object. You will see that the component has 2 fields which affect where the file is generated called 'File Directory' and 'File Name'. Simply update those fields as required and when you run the scene the file will be generated at that location.
     
  41. unity3dat

    unity3dat

    Joined:
    Aug 9, 2017
    Posts:
    88
    Thanks! I was looking at a different demo scene. Found the Directory and File name. By default, the directory is set to ReplayFiles. I can't find such a directory though, and when I test the scene in Unity, the recording works but I can't seem to find the folder where it was stored. Should I add the folder upfront? And where should I add it? The Assets folder, the UltimateReplay folder, the Experimental folder, ...?
     
  42. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    Since the default folder directory (ReplayFiles) is relative it will be created inside the project folder next to the 'Assets' folder. If you right click on the Assets folder in Unity and then select 'Show in Explorer' it will open the project location and you should see the folder. You can also change the value of 'File Directory' to a rooted path such as 'C:/Recordings/ReplayFiles' so you know exactly where it is being created.
     
  43. Saeleas

    Saeleas

    Joined:
    Sep 23, 2017
    Posts:
    11
    Hello, this asset looks really cool, but I have a question, I am using the trial version and trying to setup a replay system which would be able to start the playback as the replay file is being written (or as it is downloading the file from the internet).

    Right now I am copying the bytes from a replay file in a location to the one that the replay should be played back (to simulate it being downloaded), as soon as I hit "play" I get "IOException: Sharing violation on path ..." this seems to be because I open the file to which I write with
    Code (CSharp):
    1. File.Open(path, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite)
    and apparently the FileShare needs to be the same also on the reader of the replay file.
    Is there an intended way to do what I am trying to do, which is replay while the replay file is being written (or even while recording)?
     
  44. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    Hi,
    At the minute the file format does not support reading partially downloaded files but it is something that we should be able to add in the future fairly easily since the file format is chunk based. Even if we changed the file access we use when creating the file, you will then likely receive invalid chunks from the file which may cause unexpected behaviour.
    We are however working on implementing simultaneous recording and replaying (although using different replay targets) if this would be of any use to you however we have no timeframe for this feature yet.

    I hope this helps you.
     
  45. dabaimifan

    dabaimifan

    Joined:
    Mar 1, 2018
    Posts:
    2
    Hi~
    I have purchased the official version,and I have an urgent question I want to consult. I use the "FileFileTarget" class, but I found a bug in the stored procedure. The first storage is normal,However, when the memory is clicked for the second time, the object will be misplaced and will be confused with the first time.
    Looking forward to your reply
     
  46. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    Hi,
    I am not sure I understand exactly what is going wrong. Do you mean that replaying the replay file multiple times gives different results or is something else happening? If objects appear to be misplaced then it will likely be an issue with the replay identity given to the objects which must be unique.
     
  47. dabaimifan

    dabaimifan

    Joined:
    Mar 1, 2018
    Posts:
    2
    The first recording was successful, but the second and subsequent recording, the playback will not be normal, and the first recording will be repeated. I guess the cache is not cleared the reason
    I have already solved this problem, After each recording, the recorded file will be opened again locally, ensuring that the recording is just recorded. Hope you can solve this local storage play issue in later versions. Thank you very much!
     
  48. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    Ok thanks for explaining. We will take a look at the issue and see if we can reproduce and fix it because as you say, all replay data should be overwritten if you start recording again.
     
  49. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    Ultimate Replay version 1.0.8 has been submitted to the asset store for review. This version includes:
    • Added support for recording and replaying using fixed update. Simply add 'ULTIMATEREPLAY_FIXEDTIME' to the scripting define symbols in the player settings to enable this feature. Note that this is not available in the trial version
    • Added support for custom replay preparers which will be called by the replay system when an object should be switched between live and playback mode. An attribute is used to indicate custom replay preparers
    • Fixed a bug where components would not be returned to there current state when switching between live and playback modes
    • Implemented chunk prediction for the ReplayFileTarget so that chunks that have a good chance of being needed during playback will be pre-loaded by a background thread so that they are ready when needed. This has made the playback performance of the ReplayFileTarget much more acceptable.
    • Fixed a few minor bugs in ReplayFileTarget
     
  50. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,193
    @dabaimifan We were not able to reproduce the issue. They playback seems to be consistent on our end when using a ReplayFileTarget as a storage method. Would you be able to send us a repro project to info(at)trivialinteractive.co.uk and we will look into it.