Example multiplayer networking achitecture

Hey Defold,

NoobHub and Defnet are awesome starting points - do any of you know of example codebases implementing a real-time action game using either of these?

Cheers

1 Like

I’m dumb, there’re examples in the DefNet repo. Please close the topic!

2 Likes

There is also Colyseus: https://github.com/colyseus/colyseus-defold

3 Likes

For other folks, if they’re reading this, Colyseus is pretty impressive too.

Edit: @britzl, hivemind

3 Likes

Simple Tic-tac-toe example with Colyseus is here: https://github.com/selimanac/defold-colyseus-tic-tac-toe

3 Likes

Working with Colyseus, building their example script straight from a clean clone gives this bug:
broke
Anyone with any experience on this?

Which example is that?
Looks like the server is not running. If the server is running check the server address and the port on Defold.

1 Like

Hey Selim,

The example producing the debug output above is this one, the example script in their GitHub.

As a note, I also tried the tic-tac-toe example you linked in your earlier post - same error profile on build.

Cheers

There isn’t any error on your screenshot. Basically It says that Defold can’t connect to the server. Are you running the server script on CLI first?

For this example you should install and run this one.

If you have the NPM then you can simply:

  • cd /<project_path>/server
  • npm install
  • npm start

Your server address and it is port must be the same in Defold code.

Ok that makes sense - I do need to run the server. I wasn’t doing that. For whatever reason I figured the server was spun up on calling client:loop(). I’ll try the npm start this evening and get back to you.

npm is just a package manager, no? It looks like I’ll have to finally upgrade to Mojave to install it >.<

Thanks very much @selimanac

Yes, it is a terrible package manager for messy node.js :crazy_face:

If you are going to update the Mojave then it is possible to have a Java bug with Defold. It is easy to fix. Everything else is just working fine for me.

Only upgrading because brew install npm reports that it isn’t supported on HighSierra anymore… Though looks like brew install node is the proper way to install npm anyway. Either way, thanks again for the pointer.

1 Like