• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Is it possible to tell who is the host player?

Status
Not open for further replies.
Level 12
Joined
May 22, 2015
Messages
1,051
My requires someone to be player 2 (player 1 is a CPU) since player 2 is the host slot. Is it possible to know who hosted the map? It would be frustrating if someone tried to play single player and didn't realise they need to be player 2.

I am also planning on changes that might make the map unplayable if no one plays as the host, so it would be nice to default to the person who made the map. If it's not possible, I can make it just choose the first player in the game and make them the host, but it could be weird if someone is the host when playing for the first time or something.
 
Level 12
Joined
May 22, 2015
Messages
1,051

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,201
There is no "host player" as the server that manages a game session has no accompanying "master" client.

A better solution is to find any human slot and mark that as the "host player". That way if the player plays in singleplayer he is treated as host no matter which slot he chooses.

Implementation is simple. Loop through all player slots, find one who is human controlled and currently playing (in case of droppers during load screen) and give him the "host player" status and break the loop. A variable could be used to keep track of the "host player" which is used by tests for the various feature that player can perform. If he is shown a dialog use that variable as the target for the dialog.
 
Finding the "true host" is overengineering.
It's much more convenient for the players to be able to "define" who has the host commands by switching player slots around.

Especially in arena or TD style games the player that hosts a session must not necessarily want to decide what game modes should be selected (for example, when he hasn't played that map before). In that case it's great to have the host be whoever has the lowest player slot number so that people can decide for themselves in the lobby.
 
Level 12
Joined
May 22, 2015
Messages
1,051
Thanks for all the info!
Fastest map loader is definitely not what I want lol. Maybe I should leave it as is / update it to choose the first playing player.

I already have a colour switching command in my map (I actually made it because I wanted to be able to be different colours while being the host lol), but it definitely would be best to choose the first playing player (particularly with my potential changes going forward).
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,201
It's not the fastest map loader. It's the player with the lowest ping. This player is typically the host. I say typically because there are things that can mess it up.
To add to that here are two examples that cause it to mess up. First is if you happen to alt tab the instant the map starts on an older computer the delay that can cause means someone else is first to respond and so wins. Second is if you are on a good local area network connection with one or more of the players, the ping is so low then that there is a good chance someone else on the local area network might win.

You must remember that there need not be a host player. In the case of a robot it will be the player with lowest ping. Robots could manipulate this if built right so that the owner wins (purposely hold back other player responses).
 
Status
Not open for further replies.
Top