Advertisement

Lobby, Connection

Started by July 14, 2018 01:07 PM
2 comments, last by FireFlood 6 years, 4 months ago

Language: Java

Greetings. I'm developing a multiplayer / singleplayer game.

I've already wrote all the game logic and byte protocol for in-game communication.

 

1. Lobby

What I need is an implementation of a lobby which supports these basic functions:

  • create room
  • join room
  • switch room host
  • change room settings (module id (see below), max players, map, etc)
  • send private / public message
  • switch room / player state
  • start game session

I've made a very raw, unstable version of this using Netty framework over TCP protocol, however I am not against open-source ready solutions, but I could't find any, besides Nadron.

 

2. Client connection.

Though my logic code basic is very simple, a large chunk of it described in concrete "Module" which is a pack of scripts, json files, maps, and, additionally, contains all the textures, sounds and other game materials.

What I need is when a client wants to join server, all the server modules will be somehow sent to the client and only after that they join.

Basically I need the same behaviour as how it happens, for example, in Garry's Mod when player joins the server.

 

I thought of 2 approaches:

1. A single download-upload server db which somehow synchronize with game server and notify when client finishes downloading. (Example: Steam Workshop)

2. Since game server handles its own module db it will also send the information to all incoming clients. (Example: pretty sure all private or cracked servers)

Am I right? 

 

Sure, I could use raw Netty, but it will be a huge pain in the ass to implement a stable lobby logic, file serializing / transfer and sync all of this since I have no real experience in net programming. 

What Java technologies / frameworks would you recommend for this case? Or should I stick to Netty? 

A stable file serialization and download protocol exists: It's called HTTP! As long as you can identify the right files (say, using a SHA256 checksum or a unique name + version) then a HTTP server can serve the files as appropriate. The benefit of this is that you can also use HTTP caching, CDN servers, and so forth. The drawback is that you need to somehow get the right files to the HTTP server/s you're running, but this is true no matter which download protocol you're using.

Regarding lobbying, this is typically specific to whatever platform you're using. If you're rolling everything from scratch, I'm not sure you'll find much in the ways of from-scratch java lobby implementations. You might want to look at existing systems, for example SteamWorks for PC, or the appropriate Game services API for mobile phones.

enum Bool { True, False, FileNotFound };
Advertisement

1. HTTP is exactly what I need. Thank you! 

2. I don't really want to post the game on Steam, but I will use their SteamWorks sources and api as an example. Thank you!

This topic is closed to new replies.

Advertisement