How to multiplayer?


Hi! Did anyone here succeed to get multiplayer over internet and with a server to work? If yes how did you do that? The tanks_networking example is not working for me unfortunately, and I think it is only local. Can Kha even do that right now or do I need to use an extra library for that?


I would like to see it explained some more in Armory. Not many examples out there. When I ran my Node on Mac it outputted a stream of messages on the terminal but the tanks remained frozen in the Krom / or Web browser window.


I’m no Node expert but I got a little time to look at Node.js 8.11.3 LTS (closer match to Armory). Downloading it includes commands node and npm if you don’t already have them. There seems to be a vulnerability fuss about Nodejs which may be important. See June 2018 Security Releases for the full scoop.

Btw Armory 0.4 b27 builds with v8.9.4 of Nodejs. Latests version is 10.6.

~/Blender_27/Armory/ --version

When running the Tank networking server demo instructions. My output looked more like this:

$ node kha.js
10.000709134037606 seconds.
20.001510488044005 seconds.
30.021727333019953 seconds.
40.0220520280418 seconds.
50.02448838803684 seconds.
60.02577554504387 seconds.
70.0261825179914 seconds.

The key missing piece here is Starting server at 6789. The server isn’t actually listening for connections. And attempting to run node server.js as an alternative is broken for the most part.

So to work around this you will need to enable a Direct Connection by adding a line (in step 2) to your projects khafile.js file. Since this file is auto generated or cleared when hitting the Armory Exporter -> Build button you will need to follow these steps:

  1. Create a new text file in Blenders Text Editor hit + and rename it as server patch.

  2. In the text window add the following line:

  3. Then link to this new file under Armory Project -> Modules -> Khafile: server patch.

  4. Save everything

  5. Clean -> Build -> npm install

Now when you Clean and Build the server again it will generate a new khafile.js with the direct_connection defined at the bottom of:


The output now looks like this:

$ node kha.js
Session.hx:336: Starting server at 6789.
1 client connected.
10.002117928990629 seconds.
2 clients connected.
Starting game.
Session.hx:372: Starting client 0
Session.hx:372: Starting client 1

The above allows the Tank clients to join and leave the server but your mileage may vary, as for me on the same machine the clients don’t seem to be running in sync or only one tank is in control. The animations are very sped up. This is as far as I got without looking at the code. If I get more time to spare I’ll dig a little deeper. Hope this helps some.


Thanks! But I can’t even start the server, when I should start “Kha.js” this window pops up:
(Zeile=Line, Zeichen=character, erwartet=expected)
I also tried it with your extra instructions with the same result. I already opened a Github issue for this almost two weeks ago but no replies yet :frowning:.


Are you running kha.js inside nodejs? I don’t know Windows well but it appears that you are loading the javascript in windows script.

If I had to guess

npm.exe install
node.exe kha.js

my bad if it’s something more serious