How should I handle votes?

I am currently working on a round-based game, and there are three game modes:

  • Free For All
  • Team Death Match
  • Judge

Players can vote for a game mode, and obviously the one with the most votes wins. But here is where I am getting stuck.

  • What should I do when there is a tie?
  • What do I do if nobody on the server ever votes?

If there is an tie, you do it again. If its the same results get an automatic voter thing online and that can decide, if nobody on the server votes, just keep doing it until they vote.

Okay after a second search I found this

So I will leave the question as “what do I do when nobody votes”

1 Like

I think what you should do is pick a game mode such as Team Death Match(for example), then maybe rename it to something like “Classic”, and then pick that as the default game mode to pick if nobody voted. You could also pick a random game mode, too.

Hope I helped!

I don’t believe that would be the best idea, since this could be abused. Abusive players would stall the server, just by not voting, and the intermission is already long enough. I wouldn’t see it as the best ux for players to wait minutes just to play a round

But thank you for your input!

1 Like

have it select the options in order
[1]>[2]>[3]
if options 2 and 3 both get the same amount of votes it selects 2
if no one votes it defaults to option 1

1 Like

Could you clarify on this? Are you talking about the player voting for 3 things? They are supposed to only input one option.

have a variable or something for the selected mode
selectedMode=nil

count the votes for the [1] option, and set the variable to [1]
selectedMode=[1]

count the votes for [2], if they are equal or higher set the variable to [2]
if [2].Votes>=selectedMode.Votes then selectedMode=[2] end

count the votes for [3], if they are equal or higher set the variable to [3]
if [3].Votes>=selectedMode.Votes then selectedMode=[3] end

if no one votes, the selected mode would default to the first option
if two modes get the same amount of votes, it will default to the second option

you can just slap the code in a table and iterate through it