After pushing the merits of a TCP multiplayer game, it’s about time I uploaded one to show that it works. I was hoping to have a more complete game to upload, but it’s been 4 years now and I’m struggling to find the energy to take it further.
SpellShips is a TCP multiplayer MOBA, designed for LAN play between friends. It’s a mix between World of Warships and the custom map “Battleships” from Warcraft III. The client uses BGE 2.69. The server uses Python 2.7.
The name is literal; it’s warships, but with MOBA “spells”, except I haven’t added the spells bit yet…
Note that it was developed on PC. I didn’t put anything platform specific in there, but it probably needs more path expansion in the code to run it on OSX. Keen to hear anyone’s experiences trying to get that to work.
- Multiplayer (TCP)
- Basic AI that paths and shoots
- Two teams
- Pretty water (Thanks Martish!)
You can currently ‘play’ with multiple people. You can see them in game, shoot at them to cause damage, kill them (and they’ll respawn). Kills and deaths are tracked. There is no finish objective yet - the game will continue until you get bored. AI’s will spawn on a timer and attempt to make it to the enemy ‘base’ (the starting position for the enemy team).
Instructions for playing
Setting up the server:
- Install Python 2.7
- Extract the “server” download into the Python 2.7 install.
- Open Python terminal
- Type “import spellServer” and push Enter.
Tada… it’s now listening for connections. Allow it through firewall if you want other computers to be able to connect.
Setting up the client:
- Have Blender 2.69
- Extract the SpellShips client download somewhere.
- Open the blend with Blender 2.69 by either double clicking on the blend, or by dragging the blend onto the Blender2.69 executable.
Do NOT open Blender 2.69 and open from there, otherwise the CWD (current working directory) will be set to Blender’s install, and it won’t find the python library.
- Push “P”
- Type in a name, then click “Start”. If you’ve got the server running then it should immediately swap to a lobby.
- Repeat step 3 as often as you want; this is TCP so it’s easy to have multiple clients running on the same machine connected to the same server. You can also get others to join the server at this point.
With the exception of the water (Martish made it, ask him about his permissions), do whatever you want with the code and assets in the Blend (and python scripts), as long as you do not do anything to hinder my own development e.g. don’t try licensing any of this stuff so that I can no longer use/sell/distribute/etc. You can use it commercially without attribution, although attribution would be nice.
I mainly uploaded this as a way to demonstrate TCP that doesn’t make the main BGE thread lag. Currently I’m still using the sendAll command to send data from the client to the server. Under heavy load, this can still cause micro-pauses in the client if the buffer can’t fit all of the message. It’s not that difficult to fix (see how the server does sending, for example), I just haven’t got around to improving it yet because it hasn’t been causing me any grief during testing.