Colyseus - Tic Tac Toe Multiplayer Example

I ported the Endel Dreyer’s Colyseus example tic-tac-toe to the Defold. Server code is as it is, but I made slightly changes on client side code. More info is available on Github.

endel/colyseus-tic-tac-toe - GitHub


Cool! Thank you for sharing!

1 Like

Hi, I’m trying out your game build, but ran into npm install error, saying “colyseus-starter@1.0.0 No repository field.”

I checked that newest colyseus repo has changed, so updated the dependencies link, but npm install still failed. Hope you can help me with that.

I just check it out. It works and I couldn’t find any problem.
What is the problem exactly? Do you have any errors on console when installing NPM modules?
Could you please share more info?

This is just a “warning” and it is not important. You don’t need to update dependencies.

1 Like

Hi Selimanac

I tried a clean build this time, but npm install gave me this error:

code E404
Not Found - GET
‘event-stream@3.3.6’ is not in the npm registry.

I did a ‘fetch library’ in Defold before npm install.

Never used node but I googled it for you :stuck_out_tongue:

“Worth noting, this is easily resolved by deleting the existing package-lock.json and running npm install again”

1 Like

yup, found the same thread right afterwards. good call, thanks!

One more question, how do you do local testing to simulate two players? I don’t have any experience with game development. Puzzles everywhere.

You can simply start two clients. But if you don’t have any game development experience start with basics. Multiplayer game development require lots of game development experience. There are lot’s of examples and tutorials on the Defold Learning Center.


I’ve got problem with running the project

Node.js server error:
MatchMaking couldn’t process message: 9,tictactoe,[object Object]

Defold error?
DEBUG:SCRIPT: /colyseus/room.lua:73: nil serializer doesn’t support .listen() method.

What I did :

  1. Installed Node.js
  2. Installed and started server
  3. Ran defold, fetched librares, build project. I click touch to start and there’s waiting for opt…In that moment the error I mantioned in node js server pops up.
  4. Ran windows bundled application (release) and same - I click touch to start and there’s waiting for opt…

Any ideas?

1 Like

Looks like something has changed/ deprecate on Colyseus side. I’m not sure, but I’m going to check it out when I got some time.


Thanks for response. You are probably right. It might be connected with Colyseus new version. They introduced new serializer in 0.10 build (24 March update) and provided migrating notes from version 0.9 (which You used for creating thread project). I’m not too good detective in such cases, so sorry if I talk nonsense.

Shame I can’t find out how to fix this. I will just wait then.

As instructed in link i found I tried to add that line
, but error on server says
Room.serialize is not a function

1 Like

serialize is not a function of room class. According to docs it should be like this(I didn’t test this):

const colyseus = require('colyseus');

class TicTacToe extends Room {}
colyseus.serialize(colyseus.FossilDeltaSerializer)( TicTacToe);

I guess it is better to change the serializer to schema. I hope I’m going to take a look today

Tried thatbefore too. Still not working. Changing serializer to schema would require more code to be changed. Ok then I’ll just wait till you investigate that and meanwhile read about schema too.

I’m updating the Tic Tac Toe example and having an issue with new Fossil Delta update. I posted an issue on Github. When I have the answer, I’ll update the example.


Hi @osemoka

Thanks to @endel, fossil delta problem is fixed now and I updated the tic tac toe example. It may contain other small bugs but it is working now.