/stark-lander

Primary LanguageTypeScriptMIT LicenseMIT

Dojo logo


Dojo logo

discord Telegram Chat

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 coordinates
  • Burn: Adjusts the trajectory of the Lander according to inputs
  • Position: Returns live position of the Lander
  • Win: Create Win condition

Components

  • Lander: Lander state and computed values
  • Fuel : TODO: abstract from Lander component

Game loop

  1. Players spawn a lander with start
  2. Input thrust and angle on each action
  3. Compute position according to block and tick forward at constant rate
  4. 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