The games I play are Teeworlds
, and league of legends. I guess:
- In Teeworlds (2D scrolling shooting) and Begone (FPS), each game host on different server. We connect to server of game developer (let us call it: main server) to get IP and port of game host. After receiving IP and port, we connect to game host and play. This way, main server's job is very easy. It just manages players' state to decide which player should receive update info (game host list ...). It also does not worry about game state. It just maintains game list and receive game status (like full or not full, max player). If game host is turned off, it removes game out of list. We cannot create our games following this way. If we want to own a game, we must run another game host.
- In the other hand, LOL give us an ability to create game. Therefore, I guess there is just one server for all function. I create game, join game on the given server. It also means that server must be super strong to handle all things.
The first way seems to be easy to implement. Each game manages its resources on its host. Main server is dedicated to process updating game host info and player info to clients. However, for card game, we do not want player waiting for someone hosts the game to join. If there is no game host, no one can play. We want player create account, login and join game. If there is no game, player can create game by himself.
Therefore, we move to second way. All things are in the given server. It is only one. This way seems to be suitable. However, I wonder if it is theory or practice. For each connection, we need a pair of sockets and one thread to hold communication. For each game, we need at least one thread to run. For instance, we have 400 players and 100 games (4 players per game); we will need 400 threads of communication + 100 game threads + 1 listening thread (and more for server system). The server must be strong to handle things. Is there any server out there strong enough for this (of course not super mainframe computer)?
Above is what i draw from playing and watching game. I know I miss many technical details and knowledge. With the famous and massive game like LOL that has thousands of people and thousands of games at the same time, the story will be different.
Now, I am very confused how to create a good client-server game. I need tutorials and advices. I search through internet, but there is not much information. I tried with “game lobby”, “game room management” key word, but they doesn’t give me useful info.
I need help!
Edited by KhoaVN, 15 October 2012 - 06:07 AM.
I checked some games and I found something. I do not know if what i thought is right or wrong.