Log In  


Martian Dice is an online multi-player dice game. It lets you:

  • Play with your friends
  • Play with strangers or
  • Play against a bot

This is a reproduction of the physical dice game Martian Dice.

Unfortunately, this game cannot be played from the BBS. For different clients to talk to each other the game needs to connect to a cloud-hosted service, which requires additional Javascript code. You can play the game from my homepage though. The in-game QR code also takes you there.

Cart #martiandice-5 | 2024-01-21 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
6

History

This PICO-8 game really evolved by accident. After playing Martian Dice with friends I wondered what the optimal play was and how much points you can expect to score each turn. So I built a bot in Python that maximises the expected score each turn. Next I figured it would be a good vehicle for me to try out WebSockets. As I also wanted some experience with React, I first built a React client. Then I started dabbling with sprites for the die faces and realized it's a good fit for PICO-8. And here we are...

Version 1.0 - 21 Jan 2024

  • Make handling of delayed/dropped moves more robust
  • Add "chop" to chat message vocabulary
  • Add basic chat-spam restrictions
  • Do not allow leading/trailing whitespace in client ID
  • Let bot player consider what to score to win
  • Fix: Single turn defeat caused assert failure
  • Tweak logo
  • Update QR for new hosting location

Version 0.9.3 - 16 May 2021

  • Allow player to resign game
  • Let player win immediately after all other players have left the game
  • Let other client take on host role when host does not trigger bot moves
  • Suppress play reminders when playing against a bot
  • Recover from network problems by handling WebSocket disconnects
  • Fix: Also show winning bot avatar when observer joined
  • Fix: Stop die roll sounds when exiting room
  • Fix: Room label was not always showing correctly
  • Fix: Occasional wrong room join message was shown
  • Fix: Rejoin room with ghost client fails
  • Fix: Ranking fails when number of clients is one

Version 0.9.2 - 9 May 2021

  • Improved color palette (by using colours from the secret palette)
  • Various minor UI improvements
  • Fancier celebration animation

Version 0.9.1 - 2 May 2021

  • Handle unresponsive/slow players. Options: Wait/Skip/Remove
  • Track results of players in room and show ranking
  • Fancier text editing and chat selection
  • Add dialogs
  • Improve stability

Version 0.9 - 27 Apr 2021

  • Initial release

Implementation details

The backend is an AWS-hosted lambda service in Python. Clients connect to this via WebSockets. The client-side communication is managed by Javascript code. This code interfaces with PICO-8 via GPIO.

For those interested, all source code is available on github. This includes:

  • The PICO-8 game
  • The client-side Javascript code that interfaces with the backend
  • The server-side Python code, which runs as a lambda service on AWS
  • The AWS CDK script for deploying the service stack
  • The earlier HTML client built using ReactJS
6


Nice game =)


bootiful geem


For those interested in the implementation details of the online/multi-player aspects, I did a short write-up on itch.io: Accidental evolution.



[Please log in to post a comment]