Jump to content
Rick

Leadwerks Game List Server

Recommended Posts

https://www.dropbox.com/s/i5gfo5b020kehup/LeadwerksNetworking.rar?dl=0

 

 

Leadwerks now has a game list server service where you can list your game server that you are hosting for your own custom multiplayer games. Attached to this post is a Leadwerks project that has the RakNet source in it along with some network classes that I wrote that go a long with the style of the Leadwerks API (also a small json library source in there). The Network classes give functionality for the game list server along with some basic structure for a networked game using Leadwerks & RakNet in the spirit of the Leadwerks API (ie. it has a callback for the network messages).

 

There is a test game class that gives an example for how to use all of this. The idea is that if you make a multiplayer game you can add your ip/port along with a name of a game server that people can connect to. The Leadwerks site will store this information for other clients of your game to pull and use the information to connect to your game.

 

For example let's say you have an RTS mutliplayer game that doesn't have a central server. The game is peer to peer (to use this isn't required to be peer to peer but just for this example). When you start the game you can either join or host a match. At this screen you would most likely want to list existing "hosts" for your game. So you would query the Leadwerks game list server and filter the result on the game name (the idea is your client would use the same game name so that you can search for only your game). Then you would display all the servers that are available for your game (because other players might be hosting as well). If you want to join, it's just connecting using the ip/port listed. If you wanted to host, then it's another function call where you list your game name, hosting ip, & hosting port. It'll get added to the Leadwerks game list server for others to see.

 

 

Things to consider:

  1. Something I want to add is the ability to search using the web api, but for now you get a list and it returns all that are registered (your game or other people's games).
  2. Your IP address gets captured when you add a host. To prevent spamming you can only host a max of 5 games from a single IP address.
  3. Unless you call the refresh function, your game server will only be listed for 5 mins. This is to clean up any old servers. While you are waiting to host and can accept more people you will want to update to the Leadwerks game list server, but when the game starts you can either stop updating (in which case your host entry will be gone in 5 mins) or you can explicitly delete your entry so that other clients won't see the server anymore (if that's what you want).
  4. You can only delete your entry. The IP address that originates the entry is the only one that can delete it.

 

Feedback is welcome.

 

Thanks!

Share this post


Link to post
Share on other sites

Can't wait to take a look at this and start integrating it with my code when I have a sec, thanks for doing that Rick.

Share this post


Link to post
Share on other sites

You have to change two values in the property sheet to match the location of your Leadwerks installation. I can never remember how to do it in VS, so I just open the props files in Notepad and edit it.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...