Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

game/v0 package

Overview

v0 - Unaudited: This is an initial version that has not yet been formally audited. Use in production at your own risk.

Package game is the on-chain part of gnofly, a multiplayer plane game. It is the source of truth for everything an admin can tune: the game parameters, the roles and the treasury. It also keeps what the referee attests and what has lasting value: the kills, on the kill leaderboard. Skins and planes are tokens of their own realms, gnofly/nfts/skins and gnofly/nfts/planes, which ask this one who the admins are and where the treasury is.

Three kinds of callers write to it:

  • the owner and the admins tune the game (SetParam, ...). Every such write bumps Version, which is how the game server knows it has to read StateJSON again;
  • referees, the game servers, record kills (SubmitKills).

Challenge runs never reach the chain: the game server defines the challenges, scores the runs and keeps the session boards.

Reads are plain functions meant for vm/qeval. The ones ending in JSON return a single string holding a JSON document. Render exposes the same data as markdown for gnoweb.

Function

SubmitKills

func SubmitKills(cur realm, kills string)

SubmitKills adds kills to players' on-chain counts. Referee only.

kills is 1 to 32 entries "address:count" separated by ";", for example

Example
1g1abc...:3;g1def...:1

Each address must be valid and listed once, each count from 1 to 1000. Anything else aborts the transaction and nothing is recorded. The counts are added to what the players already have, and the kill leaderboard is updated. Kills are player actions: Version does not move.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/g1t2kg2vtr3fukg43eujkn6x53gfdyakhngt4sfd/gnofly/game/v0" -func "SubmitKills" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1t2kg2vtr3fukg43eujkn6x53gfdyakhngt4sfd/gnofly/game/v0" -func "SubmitKills" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx