P2P networking?

On the wiki, there are only examples of client/server networking, with central server. However I’d like to make game where anyone can host game, kinda like in Hedgewars or Frozen Bubble. The only thing main server would do is to store list of games (and their IPs, but those will be hidden for players) that are waiting for players and chat (lobby).

Rest of communication would happen between players and hoster. So game would have to be client and server at the same time and whether or no server part is active, depends on if you’re game hoster or not.

Unfortunately, I don’t know how to make it, any help?

The basic architecture isn’t all that different from a normal client-server setup… You’re just adding another layer on top for the server listing. So the components would be:

  • A centralized server that individual game hosts can list themselves with

  • A 'Server-Client' that acts as the actual game server. When a game is active it lists itself with the central game server

  • The game client

This seems to be a verbatim repeat of what you just said.. What do you need help with?

Well, nowhere there is an example of such setup, so I don’t know where to start out. I know in theory how it should work, but can’t transcribe it into working code without any help. Also “lobby” would be PHP script that connects to mysql database, so it will be easier to put up online (I can use any webhosting for that)

Start out with the pieces you know already and start building. If you need to talk from PHP<->Java server you’ll need to build a RESTful service or use WebSockets

The “central server” becomes the game host, then all the examples from the wiki apply.

The only change is that you need to add logic to allow people to find game hosts (which is your web service/whatever).