• 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

Question about manage game room for multiplayer game

3 posts in this topic

My Java exercise is creating a card game like Microsoft Hearts plus multiplayer via internet.
I decided to let player create game room.
When player clicks button create game, a signal is send to server, and server creates a game object. This game object is managed by using an arraylist.
The problem is if this game is destroyed, others player don’t know it was removed. They choose game from their lists and send it back to server.
If I send an object, I can use arraylist.contains(…) to determine if this game still exist or not. However, I think this way is not good because we must loop all array for each client request. This is not efficient (I assume we have a lot of players at the same time)
I move to other way. I send index of the game I choose. At server, I get the game with this index. If the comparison returns true, this game is still there and vice versa. It sounds good but new problem appears. Let see this example:
We have
Game : a b c d e f
Index : 1 2 3 4 5 6
We remove c
Game : a b d e f
Index : 1 2 3 4 5
In this case, player chooses game “c”, we can definitely say “c” is out. If player chooses game “d”, he sends to server index 4. Now, 4 is game “e” and the comparison return false. We say game not existing, but its index is 3. It is still there.
Hic. I don’t know how to do. I hope receiving advice from you. Thx a lot. Edited by KhoaVN

Share this post

Link to post
Share on other sites
You should identify rooms with unique IDs. That can be some number allocated by the server, that doesn't change, or some name that's enforced to be unique.
You should keep the mapping from id to actual room instance as a hash table / dictionary, rather than an ArrayList.
Thus, when you race, so that the player says "join room X" while the message "room X is going away" is on the wire, you will see that X is no longer in the dictionary / hash table, and you can return the error "that room no longer exists."

Share this post

Link to post
Share on other sites
I checked some games and I found something. I do not know if what i thought is right or wrong.
The games I play are [url="https://www.teeworlds.com/"]Teeworlds[/url], [url="http://www.nplay.com/BeGone/"]Begone[/url], 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

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