Author Topic: Lobby List/Matchmaking + Non-dedicated hosting?  (Read 4450 times)

Yoi

  • Newbie
  • *
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 8
    • View Profile
Lobby List/Matchmaking + Non-dedicated hosting?
« on: March 30, 2017, 05:14:01 AM »
Hi,

We're working on a prototype for a new game in which we want a 4-player multiplayer setup.

Ideally, we want a lobby-list/match making server (TNET3 standalone .exe) for which we'll open ports in the firewall, etc - but we want each game room to be hosted by the player "hosting the game". In essence - the match making server (standalone) should only list every available public or private game - but the game rooms themselves should route none of the actual game traffic through the dedicated match making server (other than to report it's availability and player count status).

The network traffic from each game (RPC-calls, etc) should be isolated to each hosted game (essentially making every game it's own server) - but without the need for the host of the game to have to open firewall ports or any router settings for the players to be able to join.

This has been done in games like Left 4 Dead, Vermintide and tons of other games, but is TNET3 able to do this out of the box? - and without the need for dedicated servers/azure-type setups?

Any pointers to a recommended structure, function calls and tutorials would be greatly appreciated!

Thank you all!

cmifwdll

  • Global Moderator
  • Sr. Member
  • *****
  • Thank You
  • -Given: 0
  • -Receive: 149
  • Posts: 285
  • TNet Alchemist
    • View Profile
Re: Lobby List/Matchmaking + Non-dedicated hosting?
« Reply #1 on: March 30, 2017, 07:07:37 AM »
Yes, TNet can do this out of the box. In fact, this is the scenario TNet is kind of designed around.

Clients call TNServerInstance.Start(...) passing the IPEndPoint of your remote lobby server. From there, other clients should be able to see it and connect to it as usual. TNet makes use of UPnP to automagically open ports.

Tutorials are stickied above. TNet comes with example scenes and scripts as well.

Yoi

  • Newbie
  • *
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 8
    • View Profile
Re: Lobby List/Matchmaking + Non-dedicated hosting?
« Reply #2 on: March 30, 2017, 07:41:42 AM »
Thank you so much for the quick reply!
I actually stumbled upon an older post where you and ArenMook were discussing NAT Punchthroughs and alternative methods (http://www.tasharen.com/forum/index.php?topic=13329.msg59903#msg59903)

In that post, Aren explains the use of 'channels', allowing a player to host a unique channel and having other players connect to it:

Quote
4. When you get the list of channels, you should be able to see if any channels are open with fewer than maximum players that have the appropriate level requirement that you can join. If so, join one. If not, create your own channel via TNManager.CreateChannel (be sure to set the expected player limit, such as 2!)

5. At this point the channel's host (the player that created it) will wait for another player to join (OnNetworkPlayerJoin notification). Once one joins, close the channel so no one else can join and start your game, possibly by loading the actual game level (TNManager.LoadLevel) -- make sure to only do this on the host player (TNManager.isHosting).

Would you still say this is the way to go? Wouldn't this however mean all traffic (every RPC) is still passed through the 'Master Server'? Sure, the channel is closed for further connections, but isn't all network traffic still handled by the master server?

I'm just concerned with the network load if the master server has to receive and pass along every rpc from every player in every game - instead of just having it act as a facilitator for the connecting of hosts and clients - and then having each game (or channel if you will) be it's own separate entity with traffic being passed only and directly between the players in the game/channel instead of via the master server. Or am I completely misunderstanding things?

Again, thank you!

cmifwdll

  • Global Moderator
  • Sr. Member
  • *****
  • Thank You
  • -Given: 0
  • -Receive: 149
  • Posts: 285
  • TNet Alchemist
    • View Profile
Re: Lobby List/Matchmaking + Non-dedicated hosting?
« Reply #3 on: March 30, 2017, 09:09:18 AM »
The lobby server simply displays registered servers to clients. Clients still connect to the player-ran server (and all traffic then flows between client and player-ran server).
Channels are a way to break up parts of your game: you might have a "Trade" channel and a "General" channel, for example. There are many uses for them, I'm sure, but I'm drawing a blank. So far I've only needed one channel per server instance.
"Host" as defined by TNet isn't necessarily the host of the server; the host is whoever joins a channel (a channel, not the server) first. You can transfer host as well. The name is terribly misleading, and I've been nagging ArenMook forever to change it to "Operator" or something ;)

To reiterate: the lobby server never sees any RFCs nor has any knowledge of host or any channels on any servers. Simply passes the server list to players. Each individual server then has a channel list and the player joins a channel after connecting to the server. All traffic passes from each player through the game server to each other player on that server (except where specified otherwise, eg: Target.Host).

Yoi

  • Newbie
  • *
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 8
    • View Profile
Re: Lobby List/Matchmaking + Non-dedicated hosting?
« Reply #4 on: March 30, 2017, 11:28:48 AM »
Thanks! That sounds perfect.

I'll give it a try and we'll see how it goes ;)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Lobby List/Matchmaking + Non-dedicated hosting?
« Reply #5 on: March 31, 2017, 01:22:26 PM »
Quote
There are many uses for them, I'm sure, but I'm drawing a blank. So far I've only needed one channel per server instance.
In Sightseer, the world is massive -- something like ~7000 square km. With potentially hundreds of players, it's simply not feasible to have one channel for the entire world. So instead players join/leave regional channels as they travel around the world. This ensures that all communication only happens between players that are actually near one another. This is obviously much more efficient than sending position and other data to everyone connected to the server and filtering it afterwards.

cmifwdll

  • Global Moderator
  • Sr. Member
  • *****
  • Thank You
  • -Given: 0
  • -Receive: 149
  • Posts: 285
  • TNet Alchemist
    • View Profile
Re: Lobby List/Matchmaking + Non-dedicated hosting?
« Reply #6 on: March 31, 2017, 03:09:39 PM »
Quote
There are many uses for them, I'm sure, but I'm drawing a blank. So far I've only needed one channel per server instance.
In Sightseer, the world is massive -- something like ~7000 square km. With potentially hundreds of players, it's simply not feasible to have one channel for the entire world. So instead players join/leave regional channels as they travel around the world. This ensures that all communication only happens between players that are actually near one another. This is obviously much more efficient than sending position and other data to everyone connected to the server and filtering it afterwards.

Ah, so it can kind of be used as a LOD system? Couldn't you keep it all in one channel if you disable script execution on distant objects? Locally, of course, so each player has their own effective bubble.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Lobby List/Matchmaking + Non-dedicated hosting?
« Reply #7 on: April 04, 2017, 03:18:51 AM »
LOD for the entire planet, yes. It's not feasible to keep disabled objects. Huge world -- each region can have dozens if not hundreds of objects, and real-time combat going on. The amount of objects would be quite high without keeping it split up using multiple channels.