It then calls an RPC when clicking on the area to affect.Function RPC (name : String, mode : RPCMode, params args : object) : void DescriptionĬall a RPC function on all connected peers. We would not care about the area of effect ability's VFX, which works great with a transient RPC.ĪoeActionInput.cs Shows the input being updated client side and not waiting for the server. If a new player connects, they will see the damaged imps. The imp's health ( NetworkVariables) is updated. The area of effect action ( AoeAction) triggers an RPC when the action is activated (showing a VFX around the affected area). They do care about the current health of the players around that explosion though.Īctions in Boss Room are a great example for this. A newly connected player doesn't care about an explosion that happened 5 seconds ago. You would have an "unexploded" state that would need to be synced everytime a new player connected? From a design perspective, you might not want to represent these events as state.Īn explosion could use an RPC for the event, but the effect of the explosion should be using NetworkVariables ( for example player's knockback and health decrease). If you have a temporary event like an explosion, you do not need a replicated state for this. Why not use NetworkVariables for everything? # If I open the door and a player connects after this, the host will replicate all the world's information to that new player, including the door's state. It uses a BoolNetworkVariable to represent the "IsOpen" state. In that case, it is preferable to use NetworkVariables like shown here. If we sent an RPC to all clients, then all players connecting mid game after that RPC are sent will miss that information and have the wrong visual on their clients. A player's client needs to receive the information that the door is open to play the right animations. Using the Boss Room's door as an example.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |