• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
jeffkingdev

Multiplayer Setup - Lobby

2 posts in this topic

Can someone please look at my flow below and tell me if I'm correct in my thinking:


CLIENT
- Requests to join a multiplayer game.
- Sends game data to HOST.
- Accepts game data from HOST.

MASTER SERVER
- Accepts incoming message for matchmaking.
- Stores list of players ready to play.
- Pairs players up by random (at first, then by other factors later).

HOST
- Accepts incoming data from client and sends data out to all clients playing the game.


Here's the steps it would work:

1. Client requests to play online game.
2. Server accepts request, stores IP:Port of client.
3. Server waits for another request.
4. Server accepts another request.
5. Server matches 2 requests.
6. Server chooses 1 client to be host.
7. Server sends client connection data to each client and removes both clients from matchmaking list.

8. Both clients send game data to the host, which is 1 of the clients.
9. Game continues till end.
10. If no disconnects, host reports game stats to stat server for online leaderboards/etc.

Q1: Is this how a basic matchmaking server and client/host server works?
Q2: This example shows how a user is the HOST, if I wanted to have a server the HOST, would I need to run like 500 server applications as a service to host 500 games? lets say for example? Is that how that's done??

Thanks
Jeff.
0

Share this post


Link to post
Share on other sites

If you're looking for a lobby system, you probably want to keep some representation of the lobby while people are waiting, not just pair everyone up once you've found enough people to start the game.

 

Then again, it all depends on what you're looking for. In Left 4 Dead you usually end up in a half-filled lobby when finding a random game, whereas other titles skip the lobby altogether.

 

But to answer your questions:

Q1: Your approach above should suffice, but in the end, it will change depending on how you want the game join flows, lobbies, etc. to work. The easiest approach is to have players choose between join or host up front. On the other hand it will occupy players until the game is filled up enough to start.

 

Q2: This is also depending a lot on your requirements. It's usually most straightforward to set up all game instances up front in various game mode, map, mutator combinations. However, it's not that adaptive to changing popularity.

More complex approaches entails having a system which monitors the server utilization of various setups, spinning up new instances if you have less than X percent capacity left for any one setup. You can even make it take resource costs into consideration, so it can have more smaller games or fewer larger ones on the same hardware.

Another approach is to spin up "empty" server instances which can be reset to any player requested configuration on demand. That way you don't have to maintain the various combinations ant leave it up to the players to choose when they reset the server. It's harder to manage CPU utilization though if players happen to create smaller games on one machine or if another gets all the large games.

0

Share this post


Link to post
Share on other sites

Hi,
 

Just my 2 cents here.
 

Q1:

The algorithm you have seems pretty solid to me.  I’m not sure if you’re using winsocks or something else.  Also not sure if you’re using UDP or TCP.  If you’re using UDP you might want to add a check every few seconds to see if the clients are still responding, and/or perform a test to see how many packets are lost (make sure it’s in range for your game).  A quick ping to make sure there wasn’t a disconnect, that way invalidated players could be taken out of the saved players list.  Although TCP is more reliable for data packets, disconnects can still happen so you could do the same with a TCP connection. In the master server I would store all the players..but would also check every 60 seconds or so to see if the ip:port still responds to pings.  I would add this because after a while your list of players could fill up with dropped connection player data, also if your match making ends up having some sort of user login/validation logic the server will think they’re already connected if they try to log back in after a disconnection event.


 

Q2:  I’m not sure if you meant that you would code 500 host applications that are different than the master sever executable.  I wouldn’t execute 500 applications at the start.  This would use resources that aren’t needed until a game is actually matched.  Also in this case I think you would end up having to setup a separate port for each application so that you could have 500 different listeners.  This would also make you have to code the client to test every possible port to find an empty server game application. (However, if you had a single “master sever” clients could first connect to this and would be assigned port/host application to play on (possibly only executing new instances of the application as needed).  Again, I not sure what your design plan was.)  This is definitely doable.


 

I would code a single master server application as a multithreaded application, and code each host game as a thread in this application.  I’d create a linked list of host game threads (or whatever structure you prefer) Every time two players were matched for a new game I would create a new node and spawn a new thread passing in the players
data.  Since you’re limited by hardware I would probably code a max number of threads (available games).   In this way games could be kept track of by a master server application and games could be added and removed from the linked list as needed.  This would also give you the ability to check in on games. Test that the games haven’t disconnected.  If so you could reclaim the game node and log the players out.  After a while your list could fill up with dead games so you may want to code a process that
would walk the linked list every once and a while to make sure things are going ok.  Maybe even later you could add some tests to make sure players aren’t cheating.

 

What I said above only works if you plan to have a single computer act as your server, if your plan was to have servers on several computers than you would need to do something different and have at least a server/host executable on each machine.

 

 

rtwilli

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0