Search Unity

Record player's screen with minimal impact on performance

Discussion in 'Scripting' started by citron8000, Aug 1, 2019.

  1. citron8000

    citron8000

    Joined:
    Nov 25, 2014
    Posts:
    22
    Hi there,

    I have been thinking about this for quite some time and built some prototypes but I am still not happy with the result. What I would like to do is to record the screen of a player during the game (the output should be a video and could be several minutes to an hour long, with sound).

    Of course, we could use one of the various plugins on the Asset Store that capture the screen and encode it on the fly. But it is very performance heavy and one of the requirement is to have very minimal impact on performance on the client's computer.

    Another way I tried is to record the position of the GameObject in the game every X seconds, as well as some properties of the game and write it out regularly to a file. The file can then be loaded and replayed on top of the scene later on. It works quite well and is not very performance heavy. But the problem is that the file is very sensitive to further changes in the game and can become "incompatible" as soon as we make some small changes.

    Another way is to use the fact that the game support multiplayer to have an external client (a "bot") connect to the game and record the POV of the player. This external client could use performance-heavy screen capture plugin and it would not affect the player's performance.

    My questions are the following:

    1. Where should I host this external client? I am thinking about on a VPS on Microsoft Azure since it can run Windows and would probably be easier to set up than AWS?

    2. With many different game session going on at the same time, could a VPS handle several at the same time? Obviously, having a lot of VPS sitting around just to do that could be very expensive.

    3. Is there another good way to do record the screen of play that I have missed?

    Thanks in advance for all responses!
     
  2. FlashMuller

    FlashMuller

    Joined:
    Sep 25, 2013
    Posts:
    451
    I'd say that every game that supports Replays is using the "Store Coordinates at TimeStep"-Solution. It's efficient on the CPU and the Memory side. Another benefit: The player can choose different views for the replay - like those "TV-Moments" from FIFA or Racing Games.
    You could use something like replay versions, so that your program knows how to interpret older files.

    I wouldn't recommend storing actual video and using Azure to do so would be over the top. At least financially.
     
  3. palex-nx

    palex-nx

    Joined:
    Jul 23, 2018
    Posts:
    1,748
    That's not the case. Often replays are made via storing only player inputs during the session and making simulation deteministic.
     
    Joe-Censored likes this.
  4. citron8000

    citron8000

    Joined:
    Nov 25, 2014
    Posts:
    22
    Thanks for the recommendations. "Store Coordinates at TimeStep" is a good idea and my game is deterministic too so that would work.

    But the problem is that the game is dependent on collisions to trigger events (animation, sound, menu and so on). By using just using coordinates recorded at regular interval (or player input, as an alternative), the replay might miss a collision because it does not exactly reproduces the original session. A solution would be to record event as well as coordinates, but then, the problem is that it becomes complicated and hard to maintain. Also it means we cannot jump to another time in the replay (unless we replay all previous events and replay all previous player input very quickly).

    It is doable I suppose but it is a lot of maintenance and headaches I feel. And since replaying with different point of view is not a requirement either, somehow it always look like the video recording is the easiest solution to implement and maintain?
     
  5. doctorpangloss

    doctorpangloss

    Joined:
    Feb 20, 2013
    Posts:
    270
    Have you tried?

    On a Windows computer, it should be straightforward to ensure you only use a hardware accelerated compressor.

    On macOS, it's super easy, hardware accelerated is your only option!
     
  6. citron8000

    citron8000

    Joined:
    Nov 25, 2014
    Posts:
    22
    I would like the solution to be future-proof, for example for any mobile devices.

    I know that using a software like Frap is very CPU intensive. nVidia has a some hardware accelerated solutions (https://developer.nvidia.com/capture-sdk or https://developer.nvidia.com/Highlights) but they are either only usable through "professional" GPU like the Quadro (for Capture SDK) or not exactly flexible and have to go through their GeForce experience interface (Highlight).
     
    Last edited: Aug 2, 2019
  7. LindaOlson

    LindaOlson

    Joined:
    Jan 13, 2021
    Posts:
    2
    I agree with you. Honestly, in order to start making money on this, you need a little investment to order good sound equipment. Indeed, it is very important that your first customers remain pleased with your work. Nothing makes a better advertisement than the word of mouth. Really, if you make a good impression on the people they will definitely come back and advise you to their friends. If you have a limited budget, you can search on the internet the best turntable under 500. My brother took a Victrola Record Player some years ago and he is very pleased with it. He also selected it according to the reviews.
     
    Last edited: Jan 15, 2021
  8. FlashMuller

    FlashMuller

    Joined:
    Sep 25, 2013
    Posts:
    451
    I don't think "often" is correct. This requires the game to be completely deterministic, like for example a player only Jump & Run. If you use Random numbers anywhere in the game - for example basically any game with an AI that tries to resemble human behaviour - a replay based on user input is bound to fail.