Multiplayer interaction w/ NPC -- start different convos?

  • In my multiplayer game, my players will sometimes talk to an NPC, and depending on where they are in the game's story, the NPC will say different things to them in dialogue. Currently, all progress the players make in the story is tracked by global variables (I assume that's the best way to do it?).

    I'm worried that this will be a problem to implement in multiplayer -- presumably the NPC will just use the host player's values for the global where-are-you-in-the-storyline variable, since the host PC supplies all the game logic and the peers just sync up to that. How do I make it so that the NPC correctly reads the where-are-you-in-the-storyline variable from each player and spits out the appropriate dialogue for each player when they interact with him?

  • You're right, you can use global variables for that, and I think that you don't want to sync those variables since they are supposed to be different for everybody. Not everything is supposed to be synced too(imagine the host syncing everybody's scrollx and scrolly variables, everyone's camera woulb be looking at the same thing).

  • Great -- but what worries me is that the dialogue has to be served by an object on the host, right, not the peer? How will the host know what the peer's "How-far-are-you-in-the-storyline" variable is set to? Will it be automatically transmitted in a one-time-fashion when the peer interacts with the NPC?

    Or can I have the dialogue served by an object on the peer, even if the NPC is on the host and just being synced to the peer?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You can have it so only the client interacts with the NPC's with no host interaction at all, and is better for reducing bandwidth. If all clients are running the same version then have that version shipped with all of the NPC text so there is no communication with the host to display the text.

    However, I would have to disagree with The host should store each players story progress and sync it with only the required player. This prevents peers from cheating in the storyline. If only the peer knows their story progress then they can change it, but if it syncs from the host then it goes back to the whole point of having the authoritative host who controls game logic. This could also be useful if you ever plan for a player to know how far another player is. If only the peer knows this then you'd have to set up a relay system for the other peer to retrieve this information.

  • Cheating isn't the world's biggest concern to me; I'm alright with letting each peer be authoritative on the progress their own character has made. Since C2 doesn't support dedicated servers yet, peer to peer is really the only option for a persistent world unless you're going to build your whole game on a single layout.

    Thanks for the advice all!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)