#Is there a way to spawn Game Objects to specified clients in a room?

7 messages · Page 1 of 1 (latest)

short crane
#

I'm making a game that has rooms (a room can have 2-6 players). In a room, a player can challenge another player in a fight (real-time interactive mini-game). Only those who are fighting can see their fight.

For the room, I did it based on the Multiple Matches Example, a MatchController with NetworkMatch interest is created for each room. But, the problem is the fight between two players. I want to spawn a FightController for only two fighters in that fight because FightController has lots of hooks and callbacks for its SyncVar and SyncList and I want to reduce sending unnecessary data as much as possible. But if I used NetworkServer.Spawn, the server will not only spawn the FightController for 2 players in the fight but also for other players in the room. I don't know if there is a way to spawn an object from the server to specified clients? (maybe another layer of Match Interest ?)
The passage may be confusing since I'm not good at writing in English, for a simpler explanation, I want to make something like creating a room (2 players in a fight) in a room (6 players in a Match) and I already using Match Interest Management for the Rooms.

short crane
#

No one 😦

quartz stump
#

Oh I have an idea

#

Use TargetRcp

#

I use it as well in my game

#

that way you can run functions from the server on specific clients

#

maybe for loop the players in the networkmanager and only target the players that have a specific room ID variable