Question

I am going to implement a "game lobby" for my game (which is a new topic for me). The game works the following way:

  1. Users chooses "random game".
  2. The device connects to a specific URL where I will implement some game logic (like name of players in the session, name of the game session itself and so on).
  3. The URL returns values to the device so the game can load them and start.

My question is: What is "the best" way to do this? Should I have a database with different game sessions that contains all the information for each game session. Or should I start a script on the server (one script equals on game session) for each game that starts that holds the information that is necessary?

I was on the thoughts to have this as a socket to socket game. But I think it will be easier with the client-server approach since the server then will take care of most of the logic and the devices only needs to concentrate on one single connection at a time.

Any help or advice is appreciated!

Was it helpful?

Solution

The cleanest approach for this would be a client server model as you guessed.
This simplifies client code a lot, as compared to database approach, but you need to setup and maintain a server.

You will anyways need a centralized entity (as a matchmaking service provider) if you want to let the user choose a random game. So I would suggest to go for setting up a server.


Following libraries might be helpful.

  • Netty (low level but versatile)
  • KryoNet (easy, high level features but limited (more than enough for games))
  • jWebSockets (Very good real time performance with long lived TCP connections)
  • Photon (Realtime, scalable, cloud, high performance but NOT FREE)

There are many more... just search

Hope this helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top