Skip to content

Xaxxoo/pistols

 
 

Repository files navigation

Pistols at 10 Blocks

A fully on-chain game, made with love, by Loot Underworld, with Dojo, for Realms, on Starknet.

Winner of the Dojo Game Jam #3

                                          ~~^             ^J~                                                           
                                         ~5G5!           75~                                                            
                                       .~PBG~        ^75P7                                                              
                                      ^?5BY~~^     YP5J~                                                                
                                    ^!J5GGPJ7      ?P^,                                                                 
                           ... ^!?Y5P7GB&&@&5J???7?YPY5YYJ?~7!!~~~~!!~^7~~~~~~!~~~~~^^~^^^^^^^^^^~^^[!]vvvvv!::)      
                      .. ^~~JPB###&#B?^PB#55Y?7YG5?J7?BG5YJ?7777!!!7777?777?7?????JJJJYJJYJJJJYYYYJY[!]~~~~~!::)      
                  .. ~7JPBBBB5?~?YJ~??~YGP7!???YGPJ5BGPBGPP555P5YYG###GGGPPGPPPPPPPPPPGGPGGPGGBB#B##[!]^^^^^!::)      
               . ^75B##BG55J~::~Y7~!75BG5~^::^~~!!7?J?J55BPPPB#BPG&&&#########BB#BBBBBBBBBGPGBBBBBBB[!]               
              ^7P##BGGGP5YY^:.:^~?J??YPGJ?7???YYY555GGBBGBBB#&&#B#/~~~~~~~~^^^^^^^^^^^^^^^~~~~^^^^^^^^^^^^^^)         
          .:!5###GPP5J?777JY55PGB########&##########BGP55YJ?7/~^^^                                                      
         ^JB##GP5Y?77J5GBB#####BP5GBJ!!!77JJ!~^^^^^^        /                                                           
       ~YB#GP55YY5GB##BPY7!~~?Y   ^!      7~                                                                            
     .^Y##BG5555B&&#P?^:      :?~  ^^.   ^!!                                                                             
    ?B#BGP5P##&@&Y^            ^~~~~~!fDm                                                                               
   P#BBG5YP###&B~..                                                                                                     
  B#PBG5J5B&#&#!.         ____  _      __        __              __     _______     ____  __           __           
 J#5PGGY?YBB#@B^.        / __ \(_)____/ /_____  / /____   ____ _/ /_   <  / __ \   / __ )/ /___  _____/ /_______    
 YGGGGPJ?JGBB@#7.       / /_/ / / ___/ __/ __ \/ / ___/  / __ `/ __/   / / / / /  / __  / / __ \/ ___/ //_/ ___/    
 JP5?~^...^?JG&#^      / ____/ (__  ) /_/ /_/ / (__  )  / /_/ / /_    / / /_/ /  / /_/ / / /_/ / /__/ ,< (__  )     
 ~PY!::. .:7?YBB^     /_/   /_/____/\__/\____/_/____/   \__,_/\__/   /_/\____/  /_____/_/\____/\___/_/|_/____/      
  ~55J!~:^7?5PY^                                                                                                        
    ~?YYYJ?7!^        A game of honour, chance and betrayal. Defend thine honour, scound! By Loot Underworld.               
       ^^^                                                                                                                       

Overview

Thou art an offence to all that is decent, dog. I challenge you... to a duel!

Pistols at 10 Blocks is an onchain game, in which you face off against another Lord in a pistol duel to defend your honour.

A righteous smoulder in your eye and your smoothbore, flintlock pistol held lightly at your side, cocked and ready, you stand in the misty morning field. Holding back the gorge rising in your throat, you shake that mongrel's hand and turn, taking your first step. Your feet crunch in the crisp morning grass, one step, two steps, three. You hear the snap of a cloak, the gasp of your second, and a sharp, booming crack, then your left arm explodes into pain. That traitorous scum shot early! Gritting your teeth against the pain, and without turning around, you keep stepping foward. Four, Five, Six, Seven, Eight, Nine... Ten. You turn around, slowly, a dark menace in your shoulder, and raise your pistol. The cur stands there, a defiant sneer upon his face, and throws his still smoking pistol to the ground. You take a deep breath, and whisper "May you find honour in death, you wretch!"

Blood sprays in a beautiful arc from his head, and he drops like a felled log. Silence, interrupteed only by the spattering of blood from your arm, into the morning grass.

Team

  • Recipromancer — Lead, Renaissance Chaos Mode
  • Mataleone — Engineering
  • Voltrevo — Engineering, Hidden information mechanism
  • Amaro — Art, Design & Animations
  • Mononoke — Logo & Art

Assets

Gameplay Logic

Pistols Round

On the Pistols round, each player has a chance to Hit and a chance to Execute, both expressed as percentages, calculated based on the number of steps taken.

  1. Hit chance is calculated first. The highest chance at 1 pace, the lowest chance at 10 paces, interpolated in between.

https://github.com/funDAOmental/pistols/blob/0d064ac90f502f348b6f14624f962661140b67aa/dojo/src/types/constants.cairo#L15-L17

  1. If hit, Execute chance is calculated. The highest chance at 10 paces, the lowest chance at 1 pace, interpolated in between.

https://github.com/funDAOmental/pistols/blob/0d064ac90f502f348b6f14624f962661140b67aa/dojo/src/types/constants.cairo#L19-L21

Blades Round

On the Pistols round, each player has a chance to Hit and a chance to Execute, both expressed as percentages, calculated based on the number of steps taken.

  1. Execution chance is first calculated using the Heavy blade.

If no execution occurs...

  1. Players using the Light against a Heavy blade strike first.

  2. Else, both players attack at the same time.

Bonus and Damage penalty

Honourable Lords, with Honour > 9.0, get a bonus on every Hit

Development notes

Environment Setup

Dojo Book

Install Rust + Cargo + others

# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# open new terminal
rustup override set stable
rustup update

# Install Cargo
curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | sh

# other stuff you might need
cargo install toml-cli
brew install protobuf

Install the Cairo 1.0 extension for Visual Studio Code

Install Dojo

Dojo Book

Using Dojo 0.5.1

curl -L https://install.dojoengine.org | bash
# open new terminal to update PATH
dojoup -v 0.5.1

# test dojo
cd dojo
sozo build
sozo test

# install packages
cd ../client
npm install

Launch Dojo

Terminal 1: Katana (local node)

cd dojo
katana --disable-fee --invoke-max-steps 10000000

# or just...
cd dojo
./run_katana

Terminal 2: Torii (indexer)

Uncomment the world_address parameter in dojo/Scarb.toml then:

cd dojo
torii --world 0x2d6bcc12cbb460243b73a4c937faf00ad2d071d899f40dfc9182843712f9c77

# or just...
cd dojo
./run_torii

Terminal 3: Client

cd client
npm install && npm dev

# or just...
cd dojo
./run_client

Terminal 4: Sozo commands

# build world and systems
cd dojo
sozo build

# migrate to local Katana
cd dojo
./migrate

Open the game on a browser

About

Pistols at 10 Blocks | Made with Dojo

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 45.8%
  • Cairo 43.5%
  • SCSS 5.4%
  • Solidity 4.3%
  • Shell 0.4%
  • JavaScript 0.3%
  • HTML 0.3%