Battle Block - PvP Puzzle


Hi all.

I made a prototype of my online PvP puzzle with Defold. Now I’m on a graphical mobile app, but I want to release it with optimum game balance.

Mobile friendly HTML5 version is available at

You can also play a bot game. Please give me feedback if you enjoyed this game. And I’m going to share our game stats here when it’s added up enough;)


  • I found a bug in Colyseus/HTML5(other builds have no errors). When I create a room for a single user and send/broadcast a message on onJoin() function immidiately, I see an error:

    DEBUG:SCRIPT: colyseus.serialization.schema.schema:993: bad argument #1 to ‘ipairs’ (table expected, got nil) dmloader.js:346:29
    stack traceback: dmloader.js:346:29
    [C]: in function ‘ipairs’ dmloader.js:346:29
    colyseus.serialization.schema.schema:993: in function ‘reflection_decode’ dmloader.js:346:29
    colyseus.serialization.schema:34: in function ‘handshake’ dmloader.js:346:29 in function ‘on_message’ dmloader.js:346:29 in function ‘on_batch_message’ dmloader.js:346:29 in function ‘listener’ dmloader.js:346:29
    colyseus.eventemitter:47: in function ‘emit’ dmloader.js:346:29
    colyseus.connection:77: in function colyseus.connection:76

I set a timer to avoid this error, but it looks a serious problem.

  • Bot AI freezes on rare occasions, but it might be my own problem:P Improvement of AI is the top priority.


  • I used Redis as a cache server because Redis’s EVAL uses Lua 5.1 same as Defold. That was really helpful for me!

Battle Block is my first game with Defold and also my first full-scale web app. I found Defold has simple and useful interfaces even for a rookie like me, but also has a great scalability(I can’t believe that I can make a cross-platform multiplayer game so easily!).

I’ll keep using it from now on and I hope I can share something that will help you.(Sorry for my poor English)



I published two math assets - bit46 and rand16

In order to make the Battle Block puzzle board, I needed a 64 bit integer type. However, Lua 5.1 only has an integer up to 46 bits, and BitOp has a limit of 32 bits. So I extended BitOp to enable bit operations up to 46 bits.

Note that this has so poor performance that you shuld not use for any other purpose except for bit flags like a puzzle board. Besides common operators, there are some functions such as swap and to_ary.

Btw, Battle Block has virtually 55bit bitfield(that is what I really need).

rand16 is a really simple assets. It produces pseudorandom 16bit numbers using abridged xorshift.