Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Netcode and cutscenes

Discussion in 'Netcode for GameObjects' started by firebird721, Dec 7, 2023.

  1. firebird721

    firebird721

    Joined:
    Jun 8, 2022
    Posts:
    101
    Looking for the correct way to integrate individual cutscenes in my arcade game

    I'm working on a multiplayer arcade game in Unity and am exploring the best practices for implementing player death cutscenes. Currently, my approach involves switching to a new scene for the cutscene and then returning to the main game scene. Is this an efficient method in terms of performance and player experience? Also, I'm considering adjusting the Cinemachine camera settings only for the player experiencing the cutscene. How can I do this effectively without disrupting the gameplay for other players? Additionally, what are the key considerations for maintaining network synchronization during these cutscenes to ensure a smooth and consistent experience for all players?
     
  2. NoelStephens_Unity

    NoelStephens_Unity

    Unity Technologies

    Joined:
    Feb 12, 2022
    Posts:
    244
    Well, in regards to efficient and player experience that all depends upon your genre and what your personal design dictates... playing a cut scene (if in the same space as other players) can be tricky as the other players will still be moving around...not knowing if the players are friends, foes, or a combination of both and what you have in mind for your cut scenes... if a single player dies but other players can still be moving around then, depending upon your implementation and style of cut scene, it could get tricky...
    If you are thinking of each player has an individual "cut scene" which is really just a series of animations that the player who died gets to watch (in all of the pain and agony involved) with perhaps additional FX and such for the player who died (vs the still living) then it shouldn't be too hard to get that worked out...
    To achieve this, you can just have an "invisible" dead player network prefab that you spawn upon the player's death and the player's camera begins to follow...the invisible dead player object wouldn't have clipping bounds (or would exclude "certain living world layers" and then it is a matter of when you want to allow the player to "spawn back" (if that is possible in your design)...
    Spawning the invisible dead player is really just NetworkObject.SpawnWithOwnership passing in the dead player's client identifier... and then disabling the player's input while their own personal death scene plays out for them.

    But yeah...lots of possibilities...
    You could have additively loaded scenes that you disable everything in that scene upon being loaded (i.e. just place everything under a single GameObject and then you can easily make everything in the scene active or not that way) and when you cut to a player's death scene you just enable one of (n) additively loaded scenes (could be specific to each player character or the like...where only the local player's specific cut scenes are loaded). Then it is just a matter of controlling the audio channels the dead player hears when you cut to their death "cut-scene" and making sure all of that geometry is in a distant location from the "real world" geometry... and is only enabled for the player who died... while keeping the "real world" geometry and NetworkObjects still loaded and being updated during the cut-scene for the player's death.

    Something along those lines should have no impact on other players and will keep synchronizing everything while the cut-scene is playing out.
     
    firebird721 likes this.