Sokoban clone for Nibble

Hi everyone.
I made a clone of the Sokoban game for the Nibble console.
screenshot

Source code and compiled binary can be downloaded in this GitHub repository.

There you can also find instructions on how to transfer the game on your console.

I also made a YouTube video to showcase the game.
Video is in Croatian but I added English subtitles.

4 Likes

Hey there @sinkews, thank you for sharing this on our forum! This is super cool. :grinning: :grinning: :grinning:

Dora from CM

Hey, can you explain how you converted images into the arrays in sprites.h file?

Sure :smiley: I used online image converter image2cpp.

Thanks for the help :smile: I’m trying to make my own game for the nibble and your project has helped me a lot :grinning:

2 Likes

No problem. I’m glad you found it useful.
I tried to comment the code and assemble it in a way to be as straightforward as possible.

1 Like

hi!
thanks for making this game and showing how to install it on the nibble! really cool.

now that the game has been flashed on to the nibble, as the device is turned on, it goes straight to the sokoban game.
is there a way to add it as one of the games from the list when powering on the device.? my kids still want to have the option to play other games and i dont want to reflash/recompile code every time…

thanks!

Hi @nibbledad. I’m glad you like the game :slight_smile:

Unfortunately as it stands right now device and firmware is not really designed to be able to do so.

I suppose you could manually edit the firmware and add the game as the firmware is open source…

I believe someone asked this question already and the folks at CircuitMess replied that they are working on it.

I hope someone from the official support will reply to give you more info :wink:

Yea thanks for your reply.
I was thinking of editing the nibble source code to have this extra game as another startup option…
I can definitely take a look at that.

In the meantime,
I will need to reload the original code back on to the nibble that we used for this experiment so they can have their other games back.
Can that be done with the Arduino IDE in the same manner as we did for sokoban?
(I will download source code from Curcuitmess official GitHub link)

Yes, that’s doable. Check out this topic:

1 Like

Hey @sinkews, can I use your awesome sokoban game in my project (that I make the menu like makerbuino and have more games)?

Yes. Feel free to use the game :smiley:

1 Like
Arduino: 1.8.12 (Windows 10), Board: "Nibble, 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), 4MB (FS:2MB OTA:~1019KB), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

C:\Users\Carla\Downloads\NibbleSokoban-main\NibbleSokoban\NibbleSokoban.ino:94:21: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

 char* levelString = "XX:XX";

                     ^

C:\Users\Carla\Downloads\NibbleSokoban-main\NibbleSokoban\NibbleSokoban.ino:138:26: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

 char* menuItemOriginal = "Original: <XX>";

                          ^

C:\Users\Carla\Downloads\NibbleSokoban-main\NibbleSokoban\NibbleSokoban.ino:139:23: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

 char* menuItemExtra = "Extra: <XX>";

                       ^

C:\Users\Carla\Downloads\NibbleSokoban-main\NibbleSokoban\NibbleSokoban.ino:140:13: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

 char* BCD = "XX";

             ^

Executable segment sizes:


IROM   : 310024          - code in flash         (default or ICACHE_FLASH_ATTR) 


IRAM   : 28376   / 32768 - code in IRAM          (ICACHE_RAM_ATTR, ISRs...) 


DATA   : 1284  )         - initialized variables (global, static) in RAM/HEAP 


RODATA : 2940  ) / 81920 - constants             (global, static) in RAM/HEAP 


BSS    : 26664 )         - zeroed variables      (global, static) in RAM/HEAP 


Sketch uses 342624 bytes (32%) of program storage space. Maximum is 1044464 bytes.
Global variables use 30888 bytes (37%) of dynamic memory, leaving 51032 bytes for local variables. Maximum is 81920 bytes.
Traceback (most recent call last):
esptool.py v3.0
  File "C:\Users\Carla\AppData\Local\Arduino15\packages\cm\hardware\esp8266\1.0.1/tools/upload.py", line 65, in <module>
Serial port COM3
    esptool.main(cmdline)
  File "C:/Users/Carla/AppData/Local/Arduino15/packages/cm/hardware/esp8266/1.0.1/tools/esptool\esptool.py", line 3551, in main
    esp = chip_class(each_port, initial_baud, args.trace)
  File "C:/Users/Carla/AppData/Local/Arduino15/packages/cm/hardware/esp8266/1.0.1/tools/esptool\esptool.py", line 271, in __init__
    self._port = serial.serial_for_url(port)
  File "C:/Users/Carla/AppData/Local/Arduino15/packages/cm/hardware/esp8266/1.0.1/tools/pyserial\serial\__init__.py", line 90, in serial_for_url
    instance.open()
  File "C:/Users/Carla/AppData/Local/Arduino15/packages/cm/hardware/esp8266/1.0.1/tools/pyserial\serial\serialwin32.py", line 64, in open
    raise SerialException("could not open port {!r}: {!r}".format(self.portstr, ctypes.WinError()))
serial.serialutil.SerialException: could not open port 'COM3': PermissionError(13, 'Access is denied.', None, 5)
serial.serialutil.SerialException: could not open port 'COM3': PermissionError(13, 'Access is denied.', None, 5)

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

I cant get this to work, i followed the steps, what’s wrong?

You actually have problem opening the COM port. Game was compiled, despite deprication warnings (my C stuff :)).

Make sure nothing is using the port. Close Circuitblocks if it’s open. You can’t use it with Arduino at the same time because it shamelessly attaches itself and opens every port that is available. Annoying? Of course.

2 Likes

Ok :smiley: I had circuitblocks open also

@sinkews I’m loading it into nibble right now! and is the depreciation warning because of the c/c++ version? I think so

Your game is great :+1:

Thank you :smiley:
Yes, compiler complains that I’m not using strings but C style char array.

1 Like

Hey @sinkews ,
This is an awesome project and we’re so glad you are making cool stuff like this on your
Nibble.

You should consider using const char* instead of regular char* in C++

const char* array= “something”;

It helps make your compile messages look way cleaner :wink:

@8-bit_noob We’ll make sure to note it in our guides that CircuitBlocks shouldn’t be running when you’re programming in Arduino, since it occupies the COM port.

I would otherwise but I’m changing strings dinamically so const is not something appropriate for this type of scenario.