There is authoritative networking, where there is a single client making the decisions, and then there is non-authoritative where everyone kinda just does their own thing, but non really making any decisions.
Is there a system where players vote and take the majority vote?
For example, think of peer to peer game where everyone contacted a master server to see all the gamerooms they can join, they choose one and are given all the IP’s to connect to. At this point we could assign a single leader to make the decisions, but for “reasons” we would prefer to have a democratic system instead. So we are now connected to everyone via peer to peer and all is well, except there are spawns (health, ammo, etc…) around the map. If 2 players go on top of a health spawn near the same time, due to network latency it is possible that half of the people detected one got there first, while the other half detected the other got there first. At this point I guess we can just decide based on something constant such as choose the player with the lowest unique id.
I feel all of this is easier said than done…
I am wondering if there is a word for this kind of game networking style that I can read up on, or perhaps someone here who has attempted such a style could shed some light on the topic =).
Also, dont worry about the “reasons” for having such a system, each system has its ups and downs I guess. Though a natural example for wanting this is to remove power from the host so that they cant manipulate the game to their desire since now we would need a majority of people to agree to everything.
Preface - i know nothing about your game design. This is all very high level rambling about networking, game design and player psychology.
Well, the difficulty with having distributed or shared authority, is that at some point, SOMEBODY has to decide who did what. And that also means that you can’t make everyone happy all the time. Now, there are game design things you can do to limit places where that might happen - have spawns which never run out. so everyone can get them, for example. But even doing something where everyone “votes” on who gets what is difficult, as what do you use as your “value” to make the choice? Time? That is not a constant across the network. Also, how do you even resolve a “instant” action like making a pick up across an asynchronous medium like the network? A and B both “pickup” the same object, but on each of their own computers. You have to wait for PING x2 time at least before you get all the data you need to even make a decision, and during that time, both A and B think they are correct. Then you get into the psychological problem of taking away some thing somebody already has, which is way worse then them never having had it. Some of that can be removed by changing how the game is designed.
In our game we have made some decisions about who “owns” specific things, to make these kinds of decisions easier, or at least more straight forward. Each player owns their own position, speed, etc. When they come into contact with other players (its a driving game, so in collisions with other cars) we temporarily “detach” the other car from its “owner” and locally simulate it, so it looks “right” to the local player. Over time we lerp it back into place according to the network updates about its position.
I think a turn-based game could use voting in many interesting ways, but a real time game might be … challenging to make that work.
Love to know how you end up architecting it!
(ps. our game is Auto Age: Standoff, on steam, in beta - beta keys are available! )
I have thought of that, but unfortunately I do not want it to be that way.
The “Somebody” would be the person who asked. This of course makes “hacking” easy, but that is not my concern as hacking is probably going to happen one way or another anyways.
So yes, we cannot just let people pick up a spawn and tell everyone they picked it up, because what if 2 people picked it up at the same time?
So the way I see it working is…
Click for example
-Player A picks up the spawn.
-Player A asks everyone in the map if he can have that spawn.
-Meanwhile, Player B picked up the same spawn.
-Player B asks everyone for permission as well.
-Player B also just got the request from player A asking for permission for that same spawn.
-Player B now realizes that we have a conflict, so player B now tells everyone that we need everyone to decide who gets the spawn.
-Player A now also just got the request from Player B for the same spawn.
-Player A also sees a conflict and asks everyone to decide who gets it. (Everyone would also have detected a conflict by now)
-Everyone will now need to decide based on a constant, which would most likely be each players unique ID. The lowest unique ID value will get the spawn. It happens to be that player B had the lowest unique ID, so now everyone tells player B he can have it.
-Player B detects the majority said he can have it, he now gains HP and sees the HP effect.
Edit --------
For the above example, we can run into the issue of what happens if Player A had already gotten the majority to approve his request for the spawn? At that point, Player A has healed up and everything, while Player B is busy asking everyone to fix the conflict. I dont want Player A to tell Player B that he got it already since in this case I would prefer to have the majority of people tell Player B that it was already taken (the reason for this is to help prevent hacks, and yes I know I keep saying not to worry about it, but I want to not worry about it in a specific way which … well … dont worry about it =)).
So to fix this I think we would need for everyone to always keep track of everyones vote, so instead of everyone just talking directly to the people asking, everyone will talk to eachother to figure out what to do. So when everyone then gets Player B request, they all know that the majority was already given to another player, so theyll tell Player B no.
So it would be like… (bold is the new stuff from the previous example)
Click for example
-Player A picks up the spawn.
-Player A asks everyone in the map if he can have that spawn.
-Meanwhile, Player B picked up the same spawn.
-Player B asks everyone for permission as well. -Everyone detected Player A request and they granted permission -Everyone now told everyone that Player A asked for the spawn and that they agreed/disagreed to it. -Player A has detected the majority agreed to his request. -Player A has now gotten the spawn and healed up. -Player A tells everyone he successfully got the spawn. -Some of Everyone have received Player B request, however, they have not yet gotten Everyones decision for Player A. These players now assume a conflict and will wait to receive Everyones vote for Player A. Once they notice the majority have already agreed to Player A, they will now tell Player B that the spawn was already taken.
-Player B also just got the request from player A asking for permission for that same spawn.
-Player B now realizes that we have a conflict, so player B now tells everyone that we need everyone to decide who gets the spawn. -Player B detects the majority said the spawn was already taken, so he doesnt get the spawn.
As you can see, this can get complicated. Little details being left out could ruin the system T.T
For example, what happens if people have agreed to Player A already, but for whatever reason never tell Player B (maybe they left the game or something)? I guess Player B would need to just give up after X seconds. -------
Again, this is all easier said than done, and I do not know how long of a delay all of this would take. In this particular case, 2 players are getting the same spawn, so the delay would be longer due to the extra step, but theoretically the delay should be not much longer than a normal authoritative system if it was just Player A touching the hp spawn, asking for permission to take it, and then everyone of course agreeing to it (again, this is open to hacking, but that isnt the concern here).
In the end, the person asking is the one who decides what to do when, but only does so after getting the majority to approve to it.
Of course not everything would require permission.
For example, I plan on just letting the shooter tell who they hit, and everyone will just agree to it. Very much open to hacks, but even the pros cant stop hackers, so giving players better hit detection is more important. You hit on your screen? Then its a hit. Of course I would need a vote kick system and what not.
It is really the timing issues which are rife here - how long do you wait for the votes to come back? How many do you need if you time out? What if another vote request comes in while you are waiting, how much longer to you wait for?
WRT how you make the actual choice, i’d suggest a random vote, rather then using a deterministic factor like you suggested, as in your example, that player would always win, in which case why are you even voting? If you are voting for yourself, you’d vote YES, so in the 2 players asking for the same thing, in a tie, everyone casts a random vote, to try to break the tie… anyway, there are lots of voting schemes that could work here.
Anyway, again, without knowing more about your actual setup and design, i think you really need to plot out on paper timing maps of the messages that need to go back and forth, and the ordering and what happens with lag, etc etc. And figuring out a “fair” way of determining the vote, or, again, what is the point of even doing the voting.
But remember, that is only in the rare case that multiple people end up on the same spot at the same time. Also, while yea, it maybe be unfair that the player with the lowest ID would always win in that situation, its kinda the same unfair as the person with the lowest ping to the server getting the spawn since they were able to notify the server quicker. However, again, this should be a rare thing, so I dont see much issue.
You wait until whatever max time I see fit, depending on the situation. Is it really that different from when you touch a spawn and then wait for the authoritative server to give it to you? When Player A asks for permission, it will just wait for either a majority approval or for something to happen to activate the next course of action, such as noticing a conflict. If the max time has passed and the majority has not responded, we just assume something went wrong and then do nothing or if required, try again. What would you do if you were talking to a authoritative server and the server didnt respond for some reason? Its the same thing in my opinion, just simpler since you are dealing with a single server.
If another vote request comes in and the vote is for something different, then that is treated separately, but if for example it is a vote for the same spawn you are trying to get, then a conflict is found and you do what I described in the 2nd example (in the edit of my previous post). The timer would reset, which would increase the delay and possibly make things seem laggy, but again, this should be rare. I have watched many gameplays of games and I havent notice many people being on the same spawn too often.
Now an issue I can see is, what if you are playing with people with very high pings? Then there is a chance that the max wait time would always activate. I guess either I take into account everyones ping, or just make sure the max time isnt set too low. Or perhaps just scrap the max time and instead always expect some kind of response. I mean, if you are seeing the players move, then that means they should be responding, unless if they are doing something, such as hacking, to stop them from giving you permission, but thats why we only look for a majority. If the majority is hacking, then we got another issue ^_~
If anyone knows of a real time game out there that handles its networking like this, please let us know, I am very curious.