Documentation ¶
Overview ¶
Jsonapp contains an example of a simple game application that uses JSON as inputs and outputs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddMonsterPayload ¶
type AddMonsterPayload = Monster
AddMonsterPayload is the payload for the AddMonster input.
type AttackMonsterPayload ¶
type AttackMonsterPayload struct { MonsterName string `json:"monsterName"` Damage int `json:"damage"` }
AttackMonsterPayload is the payload for the AttackMonster input.
type GameApplication ¶
type GameApplication struct {
// contains filtered or unexported fields
}
GameApplication is an application for a simple RPG game. The GM can add monsters and the players can attack them. Anyone can attack the the monsters. For each input, the application emits a report with the current game state.
func NewGameApplication ¶
func NewGameApplication(gm common.Address) *GameApplication
func (*GameApplication) Advance ¶
func (a *GameApplication) Advance( env rollmelette.Env, metadata rollmelette.Metadata, deposit rollmelette.Deposit, payload []byte, ) error
func (*GameApplication) Inspect ¶
func (a *GameApplication) Inspect(env rollmelette.EnvInspector, payload []byte) error
type Input ¶
type Input struct { Kind InputKind `json:"kind"` Payload json.RawMessage `json:"payload"` }
Input has a kind and a payload with specific data.
Click to show internal directories.
Click to hide internal directories.