latest contributor to this doc

Last Edit: @gaeacodes ,

Rogue

The Rogue Antara module is an Antara implementation of the classic Unix game, Rogue.

An installation, Rogue API, and gameplay walkthrough is available in the Antara Tutorials section.

cclib bailout 17 '["gametxid"]'

The bailout method allows a user to withdraw their character from the game.

This method is only available when the character is still alive. The character must remain alive until the returned bailout_txid is mined.

Also, the character must have more than 0 gold and must have killed at least 1 monster. Otherwise, the bailout method will treat the character as dead, regardless of the character's status.

When the character successfully bails out from the game, all in-game gold the character has captured is converted into ROGUE coins.

The conversion ratio depends upon the mode of gameplay.

  • Single-player mode:
ROGUE_satoshis = gold * gold * dungeon_level_on_exit * 10
  • Multi-player mode:
ROGUE_satoshis = gold * gold * dungeon_level_on_exit * 20

The conversion is facilitated using globally locked ROGUE coins. The funds in this global vault automatically accrue through asset-chain activity. In the event that there are not enough globally locked funds at the time the method is executed, the player must simply wait until the funds are generated via automated methods. You can encourage this fund to grow more quickly by encouraging other players and people to transact using ROGUE, as transactions feed the fund.

The method returns a hex value. While most methods in the Komodo API require the user/developer to broadcast the hex value using sendrawtransaction, the Rogue module broadcasts automatically.

NameTypeDescription
gametxid(string)the gametxid transaction id that identifies the game for which the user would like to bail out their character

NameTypeDescription
name(string)the name of the module
method(string)the name of the method
myrogueaddr(string)the address on the Smart Chain for the user's pubkey
gametxid(string)the unique gametxid transaction id that identifies this game
hex(string)a hex value containing the relevant game data; this value is broadcast automatically
txid(string)a playertxid transaction id that identifies this unique character; this txid can be used in the future with the register method to reuse the character from this game
result(string)whether the command executed successfully

Command:

./komodo-cli -ac_name=ROGUE cclib bailout 17 '["39b65c12e37f6338b2daf8b7d8d6e1b6c083622590cb7a318daadabc785b73f0"]'

cclib extract 17 '["gametxid","pubkey"]'

The extract method allows the user to extract the complete history of a game. This allows the user to view a replay of the game.

NameTypeDescription
gametxid(string)the transaction id that was returned after broadcasting the returned hex value from the newgame method
pubkey(string)the pubkey of the player for whom the user desires to extract all relevant game data

NameTypeDescription
name(string)the name of the module
method(string)the name of the method
gametxid(string)the transaction id that was returned after broadcasting the returned hex value from the newgame method
rogueaddr(string)the address for the pubkey
status(string)whether the command executed successfully
keystrokes(string)all keyboard strokes concatenated into a single hex string
numkeys(number)the total number of keystrokes (ASCII symbols)
playertxid(string)the playertxid transaction id that represents the character belonging to the indicated pubkey
extracted(string)the gameplay progress extracted via the keystrokes replay feature
seed(decimal number)the blockchain-generated random seed. This provides the necessary randomization for players to generate the current game's level design. The seed value is revealed at the start block height.
replay(string)the complete terminal command that must be executed to begin this game

Command:

./komodo-cli -ac_name=ROGUE cclib extract 17 '["6bb0efcb14cd5101a4d8d8865c6a93162aa9480c5d3e0ce33902193cebdc4c39","0325151cf0f7321d0cde232898c5adc6b60f32df71b79af3a49d10020d42925ae9"]'

cclib gameinfo 17 '["gametxid"]'

The gameinfo method returns relevant information about the indicated gametxid game.

NameTypeDescription
gametxid(string)the transaction id that was returned after broadcasting the returned hex value from the newgame method

NameTypeDescription
name(string)the name of the module
method(string)the name of the method
gametxid(decimal number)the indicated gametxid transaction id
result(string)whether the command executed successfully
gameheight(decimal number)the block height at which this gametxid was created
height(decimal number)this value is the same as the gameheight value above
start(decimal number)the block height at which the seed will be revealed
starthash(string)the hash of the start block
seed(decimal number)the blockchain-generated random seed. This provides the necessary entropy for players to generate the current game's level design. The seed value is revealed at the start block height.
run(string)the complete terminal command that must be executed to begin this game
alive(decimal number)the number of players still alive in the game
numplayers(decimal number)the total number of players that joined the game
maxplayers(decimal number)the max number of players the game allows
buyin(number)the amount of ROGUE coins required for a player to join
players(array of strings)an array containing the identifying transaction ids of each player

Command:

./komodo-cli -ac_name=ROGUE cclib gameinfo 17 '["b9ab1c3b9a1dceea75d0d87b927a03d8519743d4d64b9be061c40fdd5e4f5026"]'

cclib games 17

The games method displays a list of the user's unfinished and finished games.

NameTypeDescription
(none)

NameTypeDescription
name(string)the name of the module
method(string)the name of the method
pastgames(array of strings)an array of gametxid transaction ids of finished games, from the user's local wallet file
games(array of strings)an array of gametxid transaction ids of unfinished games, from the user's local wallet file
numgames(decimal number)the total number of games, from the user's local wallet file

Command:

 ./komodo-cli -ac_name=ROGUE cclib games 17

cclib highlander 17 '["gametxid"]'

The highlander method allows a character to exit the game and claim the buyin prize funds.

In single-player mode, the highlander method is available after safely retrieving the amulet and exiting the dungeon.

In multi-player mode, the highlander method is available either to the character that is the last man standing, or to any character that successfully retrieves the amulet and exits the dungeon.

The character that successfully executes the highlander method receives an increased ratio of conversion from in-game gold to ROGUE coins. The ratio depends upon the mode of gameplay; see below for further details.

The conversion is facilitated using globally locked ROGUE coins. The funds in this global vault automatically accrue through asset-chain activity. In the event that there are not enough globally locked funds at the time the highlander method is executed, the player must wait until the funds are generated via automated methods. You can encourage this fund to grow more quickly by encouraging other players and people to transact using ROGUE, as transactions feed the fund.

ROGUE_satoshis = gold * gold * dungeon_level_on_exit * 10

ROGUE_satoshis = gold * gold * dungeon_level_on_exit * 20

NameTypeDescription
gametxid(string)the gametxid transaction id that identifies the game for which the user would like to bail out their character

NameTypeDescription
name(string)the name of the module
method(string)the name of the method
myrogueaddr(string)the address on the Smart Chain for the user's pubkey
gametxid(string)the unique gametxid transaction id that identifies this game
txid(string)a playertxid transaction id that identifies this unique character; this txid can be used in the future with the register method to reuse the character from this game

Command:

./komodo-cli -ac_name=ROGUE cclib highlander 17 '["b94a0c14604df04a994e8fde610af7ddede76a62e1e3d86bbdac18e695662301"]'

cclib keystrokes 17 '["gametxid","keystrokes"]'

The keystrokes method executes the indicated keystroke for the indicated gametxid.

The player's keystrokes on the keyboard are recorded in ASCII format. See this link for a table of ASCII keyboard translations.

After a game concludes the complete list of keystrokes can be found in the ~/komodo/src/keystrokes.log file.

NameTypeDescription
gametxid(string)the gametxid transaction id that identifies the game for which the user would like to bail out their character
keystrokes(string)the desired keystrokes, provided in ASCII format and concatenated into a single string

NameTypeDescription
result(string)whether the command executed successfully
name(string)the name of the module
method(string)the name of the method
gametxid(string)the unique gametxid transaction id that identifies this game
keystrokes(string)the desired keystrokes, provided in ASCII format and concatenated into a single string
batontxid(string)the unique batontxid transaction id; this value is useful for tracing the route of a utxo/token through the blockchain database
playertxid(string)the unique identifying transaction id of this player
hex(string)a hex value containing the relevant game data; this value is broadcast automatically
txid(string)a unique transaction id for the keystrokes transaction
result(string)whether the command executed successfully
error(string)error messages are returned here
id(string)the returned value here, jl777, is constant and can be ignored

Command:

./komodo-cli -ac_name=ROGUE cclib keystrokes 17 '["777ba510824b467e9ddfb00a075e9cd5c6f73d1fa6f772b1a22563502def25ee","6a68686868686866686820686868682068686868206868666868686c6c6c6c6a6a6a6a6a6a6a6a6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6a6a6a68666b"]'

cclib newgame 17 '[maxplayers, buyin]'

The newgame method creates a new game.

The buyin argument is required for multi-player games. The coins contributed via buyin become a winner-takes-all pot. Either the first player to claim the amulet and return from the dungeon, or the last player standing; may claim this prize using the highlander method.

NameTypeDescription
maxplayers(decimal number)the max number of players; if set to 1, the game begins in single-player mode
buyin(number, required if maxplayers > 1)the required amount to contribute per player; the winner receives all buyin coins

NameTypeDescription
name(string)the name of the module
method(string)the name of the method
maxplayers(decimal number)the max number of players for this game
buyin(number)the required amount to contribute per player; the winner receives all buyin coins
type(string)the level of difficulty for this game
hex(string)a hex value containing the relevant game data; this value is broadcast automatically
txid(string)a transaction id that represents the gametxid
result(string)whether the command executed successfully

Command for a single-player training game:

./komodo-cli -ac_name=ROGUE cclib newgame 17 "[1]"

cclib pending 17

The pending method displays a list of unfinished games on the Smart Chain.

NameTypeDescription
(none)

NameTypeDescription
result(string)whether the command executed successfully
name(string)the name of the module
method(string)the name of the method
pending(array of strings)an array of gametxid's that represent unfinished games on the Smart Chain
numpending(decimal number)the total number of unfinished games on the Smart Chain

Command:

./komodo-cli -ac_name=ROGUE cclib pending 17

cclib playerinfo 17 '["playertxid"]'

The playerinfo method displays information about the currently active character.

There are occasions where the developer may wish to start with the tokentxid of a character(s) and from there find the most up-to-date playertxid.

The following is one solution:

  • If necessary, obtain a list of all tokens on the Smart Chain via the tokenlist method.
  • For each item in the response, execute an iterative function that executes the playerinfo method on the individual token.
    • If the method responds with an error, this means that the supplied token does not represent a character. Rather, it represents another on-chain asset, and therefore the token can be ignored.
  • For each response from the playerinfo method check two elements: whether the data contains a batontxid; whether the character is alive.
    • If there is a batontxid, the playertxid has been used in a game and is no longer valid. Therefore, this playertxid can be ignored.
    • Likewise, if the character is no longer alive, it can be ignored.
  • Each token that has a valid response, no batontxid, and represents a living character can be considered the correct tokentxid for the discovered playertxid.

NameTypeDescription
gametxid(string)the gametxid transaction id that identifies the game for which the user would like to bail out their character

NameTypeDescription
result(string)whether the command executed successfully
name(string)the name of the module
method(string)the name of the method
player(json object)a json object containing relevant player data
playertxid(string)the unique identifying transaction id of this player
tokenid(string)the unique transaction id that represents this character as a non-fungible asset for on-chain trading using the Tokens CC module
data(string)the character-state information in hex form
pack(array of strings)an array containing the items in the character's pack
packsize(number)the number of items in the character's pack
hitpoints(number)see this linked manual for further information
strength(number)see this linked manual for further information
level(number)see this linked manual for further information
experience(number)see this linked manual for further information
dungeonlevel(number)see this linked manual for further information
chain(string)the name of the Smart Chain on which this game is occurring
pname(string)the name of the user's currently active character

Command:

./komodo-cli -ac_name=ROGUE cclib playerinfo 17 '["cf2ae0997e24f100aa9da3cda747105e3134a102da69630d6d1683a6f0f7b0ab"]'

cclib players 17

The players method displays a list of all playertxid transaction ids held in the user's current pubkey.

NameTypeDescription
(none)

NameTypeDescription
name(string)the name of the module
method(string)the name of the method
playerdata(array of strings)an array containing all playertxid transaction ids in the user's local wallet
numplayerdata(decimal number)the number of playertxid transaction ids in the playerdata array

Command:

./komodo-cli -ac_name=ROGUE cclib players 17

cclib register 17 '["gametxid"(,"playertxid")]'

The register method registers your character for a game.

The optional playertxid allows the user to reuse a character that survived a previous game.

For the playertxid argument to properly call an existing character, the user's daemon must be set to the pubkey that owns the playertxid. This can be accomplished either through the pubkey launch parameter or through the setpubkey method.

NameTypeDescription
gametxid(string)the gametxid of the game the user desires to join
playertxid(string, optional)the playertxid of an existing character the user owns and would like to use

NameTypeDescription
name(string)the name of the module
method(string)the name of the method
maxplayers(decimal number)the max number of players allowed in this game
buyin(number)the required buyin amount of ROGUE coins to enter the game
type(string)the level of difficulty for this game
hex(string)a hex value of registration data; this value is broadcast automatically
txid(string)a transaction id that indicates the playertxid for this character
result(string)whether the command executed successfully

Command (registration without player):

./komodo-cli -ac_name=ROGUE cclib register 17 '["b9ab1c3b9a1dceea75d0d87b927a03d8519743d4d64b9be061c40fdd5e4f5026"]'

cclib setname 17 '["pname"]'

The setname method sets the name of a character.

A character may receive a name at any point, but the character's name may be set only once. It is not possible to rename a character.

NameTypeDescription
pname(string)the desired name for the user's currently active character

NameTypeDescription
name(string)the name of the module
method(string)the name of the method
result(string)whether the command executed successfully
pname(string)the desired name for the user's currently active character

Command:

./komodo-cli -ac_name=ROGUE cclib setname 17 '["SuperMegaWarrior"]'