Multiplayer interaction w/ NPC -- start different convos?

Get help using Construct 2

Post » Tue Mar 03, 2015 10:02 am

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?
B
6
S
1
G
1
Posts: 91
Reputation: 900

Post » Tue Mar 03, 2015 11:20 am

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).
Banned User
B
6
S
3
Posts: 105
Reputation: 1,170

Post » Tue Mar 03, 2015 6:30 pm

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?
B
6
S
1
G
1
Posts: 91
Reputation: 900

Post » Tue Mar 03, 2015 6:56 pm

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 @tarik00555. 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.
Nothing goes unanswered!
B
24
S
5
G
1
Posts: 432
Reputation: 3,442

Post » Wed Mar 04, 2015 6:34 am

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!
B
6
S
1
G
1
Posts: 91
Reputation: 900


Return to How do I....?

Who is online

Users browsing this forum: Fib, imhotep22, raulcg1981, shukra and 1 guest