What does the host of an online match do?
The host of an online match is the player whose game runs the match for everyone: it sets the match up, hands out the code the others join with, starts each round, and decides every hit, while the others send their moves to it and draw what it sends back. So the host keeps the game open and in front until the last round ends. In Boomer Brawl the host picks the map, the bots and the round's length, and up to three friends join by a code.
The host's game runs the match
In a game built this way no rented game server plays the match: one player's game does, for everyone, while it plays too. Unity documentation calls this the listen server pattern: one player, the host, acts as the server, and the joining players act as clients.
The others send their moves to the host's game and draw what it sends back. The host's game decides what happens: every hit, every fall, every comeback, the score and the clock.
Unity documentation, Relay servers describes how relay servers carry the messages between the players. Because these servers pass the traffic along, nobody needs to know anyone else's address, and home routers and firewalls do not get in the way.
Before the match: the host sets it up
In the game the host presses Play, then the Host tab, and picks the map, how many bots, how hard they play and the round's length, from two to ten minutes; it starts at three minutes.
A switch, Public, lets strangers join from the list of open games; off, only people with the code get in.
The lobby shows a code of six characters and a Share code button that sends it with a link. A guide on how join codes work explains the code.
When everyone is in, the host presses Start. A match takes up to four people, and anyone after that hears that the match is full.
During the match: keep the tab in front
A browser slows a page down when its tab is hidden. MDN Web Docs, Window: requestAnimationFrame() method says browsers pause a page's animation frames in background tabs, to save power and battery.
Chrome for Developers, Heavy throttling of chained JS timers says a hidden page's timers run at most once a second, and once a minute after five minutes hidden. It counts a page as hidden when another tab is in front or the window is minimised, and says a browser may treat any page it cannot show as hidden.
So the host keeps the game's tab in front for the whole match. The game reminds a host in a browser in the lobby: Keep this tab visible: the game runs in it. If the host's game falls silent for ten seconds, the other players leave the match. A phone that turns its screen off hides the page too, so a host on a phone keeps the screen on.
The pause does not stop an online match: the others play on while the host looks at the menu. The guide on why a browser game lags on a phone has more on what slows a page down.
Between rounds and when the host leaves
When a round ends, the host's game starts the next one after a short countdown, and everyone plays again in the same match. The others can only go back to the menu; the host decides when the evening ends.
A friend who arrives late joins the match already running, and a bot takes over the seat of anyone who leaves.
If the host leaves, the match ends for everyone and the others are told the host left. Anyone can host the next one.
Who should host
Whoever has the steadiest connection and a device that stays awake to the end should host the match. The host should also be someone who stays for the whole match, since the match ends when the host goes.
On a video call, the game in one window and the call in another, or the call on a phone and the game on a laptop; playing on a call has the rest.
The host's own game decides every hit, so the host sees each one first and the others a moment later, after their moves travel to the host and back.
How Boomer Brawl does it
Boomer Brawl is free in the browser with nothing to install, and anyone can host from a phone, a tablet or a laptop. Up to four people play in one match, and bots take the seats nobody fills: up to eight bots and twelve seats in all.
The page on how to play with friends has hosting and joining step by step. Boomer Brawl lets anyone host from the browser: play a round.
Common questions
Does the host play too?
Yes. The host plays in the match like everyone else while the host's game runs it.
What happens if the host leaves the match?
The match ends for everyone and the others are told the host left; anyone can then host a new one.
Does the host need to pay for a server?
No. The host's game runs the match and a relay carries the messages, so there is nothing to rent.
Can the host play on a phone?
Yes. The host can play in the mobile browser, as long as the screen stays on and the game's tab stays in front to the end.
Can the host pause an online match?
No. The pause does not stop an online match: the others play on while the host looks at the menu.
Sources
- Unity documentation, Relay servers, checked on
- MDN Web Docs, Window: requestAnimationFrame() method, checked on
- Chrome for Developers, Heavy throttling of chained JS timers, checked on
Keep reading
- Guides to playing games in the browserPlain answers to what people ask about games in the browser: saves, data, lag on a phone, controllers, touch, join codes, hosting and friends far away.
- Free browser game to play online with friendsA quick fighting game, free in the browser: host, share the code, and up to three friends join from a phone or a laptop. Nothing to install, no account.
- How join codes work: play with friends onlineA join code is a short code a game makes when someone hosts a match. Friends type it or open a link with it and land in that match, with no account.
- Why does a browser game lag on a phone?A browser game lags on a phone when its tab is hidden, Low Power Mode or Battery Saver is on, the phone runs hot or the browser is old. What to check.
- Quick browser game to play on a video callA three-minute fighting game for a video call: one of you hosts in the browser, pastes the code in the chat and up to three friends join. Free, no install.
