Building a Multiplayer Server

Some more notes I forgot about:

  • The Tanks are not sync’d yet. So it is possible to blow up tanks in one client and not others. Its a fairly simple thing to add, but that can be left to you :slight_smile:
  • State buffer is a queued non timed sequence buffer. This also means that player sync and server validation is limited. Its easy enough to make a timer table. Might do this later for people to see how that is done/used - this allows the server to check past frame events for slower (high ping) players.

It is not thoroughly tested on large numbers of players. I’ll put this up on itch, and see if it explodes. :slight_smile: Will post the link next week sometime.

10 Likes

Sweet! It’s nice to see networked multiplayer running now! Well done.

4 Likes

Well its sorta working well :slight_smile: Rewrote the Websocket on the server side. Was kinda interesting to do actually. I need to get SSL/TLS working so will be adding that - HTML5 deployment doesnt work without it (Im using mixed mode - which is kinda bad anyway).
So this is sorta complete - I will be updating repo over next few weeks to get SSL in, and when thats done I’ll add the game to itch.io so people can try it out and shoot things :slight_smile:
Because Im using swampy on the card game, it will get many updates over the coming weeks. The card game will be up for xmas, and the source code available not long after.
Has been fun - sadly didnt have time to do the Nov game jam. Next time. :slight_smile:

4 Likes

And here we go. Initial simple test page.

Warning:

  • Does NOT work. Websocket auth handshake not happy with chrome and firefox (server needs work I think).
  • Will add win, linux and hopefully osx (if I can get my mini working). The apps work fine.
  • Server can and does crash. Will set the docker to restart on failure.

Its fairly complete (as an experiment) but I will be adding over coming weeks. Going to figure out the websocket ssl problem - I hope its something simple in the keys.

6 Likes

Okay. Finally all working relatively nicely in the web. Feel free to play around and break it :slight_smile:
I’ll post all the source and repos here at the end, so its all in one spot. Thanks for reading, and if you have any questions feel free to hassle me on Discord or here.


Here it is running in Firefox (on left) and Chrome (on right). Its reasonably good over the internet and with really fat packets being thrown around :slight_smile: Thats a tip of you use this module - reduce the packets, should be around 10x smaller (they just dont need to be pure text table serialisations :slight_smile: ).

Repos:
SWAMPY - Multiplayer Game/Web Server: https://github.com/dlannan/swampy
SWAMPY Defold Client - Use this to add swampy client to defold project: https://github.com/dlannan/swampy-defold
WarBattlesMP - The tutorial with added SWAMPY client: https://github.com/dlannan/defold-warbattlesmp
Modified C-Websocket - Needed to build SWAMPY with WBMP: https://github.com/dlannan/c-websocket

And of course, where you can play it: warbattlesmp by bukkat

Thanks again. This was quite fun and looks like there is a bit of tech that might find its way elsewhere :slight_smile:

10 Likes

Ok. I wasnt going to post much on here, but after testing with a few people, heres some “gotchas” I need to fix - next week I will be able to get to it.

  • The playernames when they are changed, stops the right data being mapped (oops).
  • Cant edit or play on mobile (oops - need to add some events)
  • OSX is oddly broken - the websocket client in defold wont build for some reason. Need to investigate.

If you dont change your name its quite playable and stable. Although the tanks really need syncing (also rockets). Feel free to drop issues here or in the repo.

5 Likes

Recently I spent some time converting my old card game that used a different version of swampy to be updated to use the new version of swampy. This took a fair bit more work than I expected. However it is nearing completion and I look forward to putting up the Soul Survivor card game on itch soon.

The result of this has been a considerable amount of bug fixes, improvements and updates to swampy itself. I have included my card game module in the swampy repo - although it is a little useless with the Soul Survivor project, but it shows how much you can do in a module.

The warbattles mp is still up and running. I will be adding f18 and some more games to swampy over the coming months. More “retro” amiga games and possibly a classic C64 one :slight_smile:

9 Likes

Ok, its nearly done. Woot. Still some bugs to iron out, some anim to add and a few other things. The general game play is a bit weird, and its not available publicly yet. Its using swampy and seems to be reasonably stable. Still testing.
Heres a sample round of play.

7 Likes

I have updated swampy. Heres a little video of the admin.
Some of the todos I want to tackle over the coming months:

  • Compression for the data (sorta works need testing and better samples)
  • Lua virtual machines for the modules (started, needs some more work).
  • Some improvements and additions to the admin. Want a complete module initialisation process for people wanting to make their own module.
  • Couple more game samples.

I hope to have the f18 game using swampy soon, along with a couple of other projects on the way.

5 Likes