Awesome
<img alt="Dojo logo" src=".github/lander.png"><picture> <source media="(prefers-color-scheme: dark)" srcset=".github/mark-dark.svg"> <img alt="Dojo logo" align="right" width="120" src=".github/mark-light.svg"> </picture> <a href="https://twitter.com/dojostarknet"> <img src="https://img.shields.io/twitter/follow/dojostarknet?style=social"/> </a> <a href="https://github.com/dojoengine/dojo"> <img src="https://img.shields.io/github/stars/dojoengine/dojo?style=social"/> </a>
Stark Lander
An onchain interpretation of the classic game Lunar Lander. Try and land on the ground with a velocity of 0.1m/s. All computation is calculated in Cairo and the game is built using the Dojo engine.
Systems
Start
: Spawns a Lander with some random coordinatesBurn
: Adjusts the trajectory of the Lander according to inputsPosition
: Returns live position of the LanderWin
: Create Win condition
Components
Lander
: Lander state and computed valuesFuel
: TODO: abstract from Lander component
Game loop
- Players spawn a lander with
start
- Input thrust and angle on each action
- Compute position according to block and tick forward at constant rate
- Determine if lander arrives at surface of planet at the correct angle and correct speed
Pre-requisites
Clone
git clone https://github.com/dojoengine/stark-lander.git
Install Dojo
curl -L https://install.dojoengine.org | bash
dojoup
Running the game
Katana
Run Katana in a terminal window using the following command:
katana --allow-zero-max-fee --block-time 1
Contract
Switch to a new terminal window and run the following commands:
cd contract
sozo build // Build World
sozo migrate // Migrate World
Client
In another terminal window, start the client server by running the following command:
cd client
yarn
yarn dev