Author Topic: Best Approach  (Read 1907 times)

Manmax75

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 3
  • Posts: 32
    • View Profile
Best Approach
« on: April 29, 2014, 09:57:27 PM »
Hey again :)

Im just wondering, what would be the best approaching for having a sort of pre-match lobby for a server. So there would be a global list of servers, the player would choose one and connect, this would load up a match settings area (think RTS games) where teams can be setup, player colour, etc. Or where the admin can choose the map and map size, etc.

What would be the best way to approach a situation like this? Would it be best to say have a JoinChannel(1, "matchsettings") and then when the game begins do something like
JoinChannel(2, "game")? Or is there a better way to do this. Also, when everyone leaves a a channel does it clean itself up or do I have to close it manually, etc.

Or alternatively can I stay on the same Channel but change the map?

Cheers!

djray2k

  • Jr. Member
  • **
  • Thank You
  • -Given: 4
  • -Receive: 4
  • Posts: 74
  • Blockey Hockey!
    • View Profile
    • Walking Talking Grilling Bear Studios
Re: Best Approach
« Reply #1 on: April 30, 2014, 09:45:15 AM »
You should always stay within the same channel. It can be hard to keep track of what channel you're supposed to be in if you're jumping everywhere.

Use TNManager.LoadLevel to switch from a Lobby scene to a game scene. Change the destination of the loaded level in the lobby.

I haven't used a lobby system yet, I assume but you can search for games available and only show the ones that are in a lobby.

Here is how to search for available channels:
http://www.tasharen.com/forum/index.php?topic=2925.0

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Best Approach
« Reply #2 on: April 30, 2014, 07:17:42 PM »
Yeah it's generally better to stay in the same channel as djray2k mentioned. Lobby servers are there to list existing servers. So if you have player-hosted servers, you would register them with some centralized lobby server.

So for example in Age of Wonders 3, when you click on "Internet", you effectively end up in a lobby server that lists all the registered game servers. When you join one of the servers, you connect to the game and join a specific channel. If the game hasn't started yet, it would be the "staging", or whatever you'd want to call it -- where all the map settings are chosen. If the game progressed to player selection, that would be either another scene or just some saved RFC function that would cause new players to open the appropriate window. Once the game begins, TNManager.LoadLevel the appropriate level, and new players that join will be automatically taken straight into the game.

Of course if you don't want this behaviour, you can always lock the channel.