Skip to content

OSTOLEX-Technologies/Castledice-frontend

Repository files navigation

Castledice-frontend

Try it out: https://near.org/ostolex.near/widget/CastleDice Menu and loading screen background

Project structure and links

Project structure:

  1. This repo with game's front-end written with Phaser3
  2. Front-end deployed to S3 bucket
  3. Solidity contract deployed on Aurora mainnet. Contract address: 0xdABc474d726FBaBB8fE5FAb4D10D9fF1601fc7e4
  4. BOS components

Our codebase:

Smart contracts documentation

  • createRoom(address[] players) -> int, creates a room and returns the room ID.

  • makeMove(int roomId, int row, int col) -> int, validates and makes a move if it is valid, returns the remaining number of action points for the player (when the player changes, it returns the number of action points for the new player, not 0).

  • getBoardArray(int roomId) -> int[], returns an array representing the current state of the game board, where 0 represents an empty cell, 1 represents the first (blue) player (top-left corner, first element of the array), 2 represents the red player (last element of the array), and 3 represents a tree.

  • getCurrentPlayerIndex(int roomId) -> int, returns the index of the current player in the players array provided during room creation.

  • getCurrentPlayerMovesLeft(int roomId) -> int, returns the number of moves (action points) remaining for the current player.

  • isGameFinished(int roomId) -> checks if the game has ended.

  • getGameWinner(int roomId) -> returns the address of the winner if the game has ended (if not, it reverts, so it's better to check first).

  • getRoomIdByAddress(address player) -> (uint256) obtains the ID of the room in which a user is located based on their address.

  • getMyIndex(int roomId) -> int, returns player index (first player or second) of a method caller for the specific room.

Gamedesign

Video review

https://youtu.be/LvDQJwyCqK4

Game Design Document

GDD(future ideas included)

Current game rules:

Rules

Hustle, to roll it to the castle!