Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

[Released] Ultimate Replay - Complete state based replay system

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

  1. flomaaa

    flomaaa

    Joined:
    Apr 12, 2019
    Posts:
    3
    Hi @scottyboy805, thanks for outlining this. I'll talk with the others from our research group to see what we are going to do in the near future - but the asset you provide looks really valuable for us. Thank you for providing it! Regarding your other points: That is strange.. that is not the behaviour I've faced. I need to resize the window every time to get the GUI working, however, not a big deal! :)
     
  2. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    533
    No problem.
    I am not sure what could be causing the GUI scaling problem. All I could think of would be some script modifying the GUI matrix. Apart from that I am not sure what the issue could be as it seems to be working perfectly on our end with no scaling issues.
     
  3. qerdoriovox

    qerdoriovox

    Joined:
    Oct 16, 2019
    Posts:
    1
    Hi, @scottyboy805,
    I have already bought your plugin. The format of the recording is ReplayData.replay.
    What I should do to use uitimate replay to share the record video to youtube so that others can see it?
    Is the data ReplayData.replay can only be review in the game?
     
  4. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    533
    HI,
    Yes the file format is only usable by Ultimate Replay and cannot be converted to any video formats because it does not contain the necessary data. The file format only stores object data such as positon and rotation so that it can recreate the scene at a later date. All playback is rendered at realtime. You will need to use another tool that can generate an mp4 file from the cameras rendering while playback is occuring to achieve what you want.

    I hope this help you. Let me know if you have any more questions.
     
  5. justaddice83

    justaddice83

    Joined:
    Sep 19, 2012
    Posts:
    28
    I am a paid user.

    What I would like is record from 2 prefabs that contain several ReplayTransform classes on them. I then want Replay on a mock up scene, with non-prefab objects (they are slightly different to the Prefabs), that have the same ReplayTransform.

    I've managed to manually update the non-prefab object ReplayIdentity.Id values (there are 20+), in which case the replay works perfectly.

    However the problem is the Ids change everytime I record from the Prefab based scene. This very time-consuming to manually update.

    What would be the best way to seed, or otherwise generate the same Ids each time on the Prefab based scene?

    I am looking through the code, but my initial attempt to seed ids did not work.

    Your help would be appreciated.

    Thank you.


    Update:
    I had a bit more of a hack on added the following to ReplayBehaviour and ReplayObject
    classes:

    Code (CSharp):
    1.  
    2.     public bool SerialIds = false;
    3.     public virtual void Awake()
    4.     {
    5.         if( SerialIds == true)
    6.             replayIdentity = new ReplayIdentity(ReplayIdProvider.GetNextId());
    7.  
    8.         ReplayIdentity.RegisterIdentity(replayIdentity);
    9.         ...
    10.  
    Depends on this new class:
    Code (CSharp):
    1. namespace UltimateReplay
    2. {
    3.     public class ReplayIdProvider
    4.     {
    5.         private static int idHead = 23000;
    6.         public static int GetNextId()
    7.         {
    8.             idHead++;
    9.             return idHead;
    10.         }
    11.     }
    12. }
    This is not quite working however.

    Curious if you may have a better way to do this as you are more familiar with how the ReplayIdentity class works.

    Update 2:
    This now works if I take a copy of the Prefabs (from the scene), while recording, and them paste them into the playback scene, make the changes and change SerialIds = false in the inspector. I have no idea why and doubt this is a robust solution.
     
    Last edited: Nov 4, 2019
  6. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    533
    Hi,
    This is not something that is currently supported and requires a bit of work as you have discovered. The replay ID of an object is assignable so it would probably be better for upgradability if you left the ReplayIdentity class alone and added an extra script to handle your custom ID's and assign as needed. I have not tested but something like this should work OK:

    Code (CSharp):
    1. using UnityEngine;
    2. using UltimateReplay;
    3.  
    4. class CustomID : MonoBehaviour
    5. {
    6.     static int idGenerator = 0;
    7.  
    8.     void Awake()
    9.     {
    10.         GetComponent<ReplayObject>().ReplayIdentity = new ReplayIdentity(idGenerator++);
    11.  
    12.         foreach(ReplayBehaviour replay in GetComponentsInChildren<ReplayBehaviour>())
    13.         {
    14.             replay.Identity = new ReplayIdentity(idGenerator++);
    15.         }
    16.     }
    17. }
    You would just attach this script to the prefab at the same hierarchy level as the ReplayObject component and it should sequentially assign ids.

    Also there are ReplayID's for all recorder components such as ReplayTransform so you will need to ensure that they remain the same as well. This is handled in the above script by enumerating all ReplayBehaviours (The base class for all recorded components).
     
    Last edited: Nov 4, 2019
  7. sourav4000

    sourav4000

    Joined:
    Jun 14, 2014
    Posts:
    10
    Hello @scottyboy805,
    I would like to use this asset to create a Killcam for Multiplayer FPS (using Modular Multiplayer FPS Engine from Asset Store). I downloaded the trial and attached ReplayObject & ReplayTransform/ReplayAminator to few prefabs. My problem is that I want the whole scene to be recorded and replayed on demand. It is very tedious to attach the record scripts to all prefabs and gameobjects and their children in the scene so, is there any automated option to accomplish this.

    Also, I would like to get some advice on using this asset with my existing setup Photon PUN.
     
  8. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    533
    Hi,
    There is no automated way to add the replay components however since they are just normal script components you can write a simple editor script to do this. I may be able to help you out with this when I have more time but you should be able to just create a menu driven editor script which cycles through all objects in the scene and adds the necessary replay components. Also you say you want to record the whole scene. You may already know this but I would not recommend recording objects that are not going to be moving (or animated in some way) as that would just waste memory and performance. You may be able to filter non-moving objects in an editor script by checking if the object is marked as static. Ofcourse if you use this approach you will need to ensue that scene objects are properly identified as static or not.

    As for the networking help: Did you receive the email we sent to you on the 7th of this month? I can go into more detail if needed.
     
  9. sourav4000

    sourav4000

    Joined:
    Jun 14, 2014
    Posts:
    10
    Thank You for that suggestion I was thinking the same.

    No, I did not receive your email regarding this. Please, guide me on this.

    I would also like to discuss another aspect that is about ReplayAnimator. I think it is in experimental stage therefore I don't expect it work bug free but can you suggest me an alternative to it. Like can I add ReplayTransform to Skeleton(Bones) GameObjects and observe them with a ReplayObject on root of player.

    What I want to achieve is simple when a player is killed I want to show a killcam replay similar to COD following a projectile from killer to player. BTW spawned object can be replayed quite good with your asset.
     
  10. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    533
    I am away from the office now but I can resend the email or pm you on the forum. Maybe check your spam folder too incase it ended up there.

    Regarding the animation: Yes the replay animator is experimental and does lack some features but if you are using rigged animation then you would probably be better off just using the ReplayTransform component on all joints. This has the added benefit of being able to record ragdolls if you are using them. If you use this approach then you should only add one ReplayObject component to the root level of the object and it will manage all child recorders.

    A killcam like COD will certainly be achievable using our asset :)
     
  11. sourav4000

    sourav4000

    Joined:
    Jun 14, 2014
    Posts:
    10
    Hello @scottyboy805,

    I believe that PhotonView Script is not disabled by the default preparer.

    What I was thinking can we destroy the components other than Transform and MeshRenders while playback. This is only possible if we can always instantiate a clone of the ReplayObject when it comes to ReplayScene (BTW all my ReplayObject are prefabs). Manipulating the original clone by disabling/enabling scripts does not make sense as it is networked. When we go live it will not be at same place that it was before starting playback.

    Please, help me in this.

    This is working good.

    Another problem I discovered that I have few prefabs (Weapons) which are instantiated as child of another prefab (Player) while recording but this Parent - Child relationship is not maintained in playback. Is it possible to also record this event of parenting or detaching child?
    As after the player is killed the Player Third Person View (a prefab) is detached from Player (another prefab).

    I appreciate a response from you.
     
    Last edited: Nov 14, 2019 at 7:27 AM
  12. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    533
    Hi,
    The PhotonView component should be handled by the default replay preparer as it is just a mono behaviour script. If it is not working then it sounds like a bug.

    Disabling components should be fine for this purpose. I would suggest that your multiplayer objects just need to listen for playback end events and resync object positions over the network and that should solve the problem. I am not overly familiar with photon but I can try and help with this if needed.

    Maintaining object parents during playback is supported but there are some requirements: The child object (the weapon in this case) must have a replay object component plus any recorder components required such as ReplayTransform. The immediate parent object (the players hand bone I would imagine) must have a ReplayObject component attached but requires no other replay components (unless needed). If the transform of the child is being recorded you should make sure it is set to use local position if the parent object is also recording its transform.

    I hope this helps you. Let me know if you have any more questions.
     
  13. sourav4000

    sourav4000

    Joined:
    Jun 14, 2014
    Posts:
    10
    In this way the parent-child relation is correct but for few players and not for others (same prefab). I believe it is due to Script Execution Order. So, which scripts should I add after default time? only ReplayManager or else?

    Edit: You can see in the screenshot (Paused playback of a recording) that one player has the weapon attached to WeaponInHandHolder GB but other weapons are on root (Shotgun_TP, etc.)

    BTW I am setting all ReplayTransform to local.
     

    Attached Files:

    Last edited: Nov 14, 2019 at 6:19 PM
  14. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    533
    HI again,
    I assume that your weapon game objects have a ReplayObject script attached too? If that is the case then it looks like there may be a bug because the ReplayObject for the 'WeaponsInHandHolder' is picking up recorder components on the weapon objects (BARR_TP and Pistol_TP). This should not happen. The weapon objects components should be registered only with the ReplayObject script attached to the weapon game object. Ie. if you have a ReplayTransform on the BAAR_TP object is should be managed only by the ReplayObject component attached to the same object and not the 'WeaponsInHandHolder' object. I hope that makes sense.
     
  15. sourav4000

    sourav4000

    Joined:
    Jun 14, 2014
    Posts:
    10
    Yes, that makes sense. I have ReplayObject on Player GB (Parent of All) observes all the transform components down to BAAR_TP when it is instantited as a child. So, can I solve this bug if I get the Full Version.

    I have noticed another glitch that is in playback mode when the child prefab clone is instantiated it comes from far space stretching the mesh wierdly. I think it is caused by the same bug.

    It works great when only one ReplayObject is at root and all child has ReplayTransform but I have prefab as child therefore it is compulsory to add ReplayObject to them. So, it is a kind of deadlock.
    What do you think?
     
  16. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    533
    We will have to look into this further as it is not intended behaviour. The trial version and the full version share mostly the same codebase so upgrading will not fix the issue unfortunately. I don't know what to suggest in the meantime but we will work on this as soon as possible.
     
  17. sourav4000

    sourav4000

    Joined:
    Jun 14, 2014
    Posts:
    10
    It would be great if that is fixed quickly. Meanwhile can I extend ReplayObject and implement this ReplayObject. RebuildComponentList Method to not observe ReplayTransform of child and its children with ReplayObject. I hope this works. What do you think?
     
  18. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    533
    Hi again,
    I believe we have now fixed this issue. If you send an email to info(at)trivialinteractive.co.uk then we can send you an update with the fix so we can confirm that everything is working properly on your end too. It will save a few days waiting for the asset store approval process.