The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Volity::GameRecord - Information about a completed Volity game.

SYNOPSIS

use Volity::GameRecord;

DESCRIPTION

An object of this class represents an information record about. In practical terms, it's an abstraction of the information that a game referee sends to its Volity network's bookkeeper once a game has finished. Through the methods this class provides, it's easy for a parlor to build and sign this RPC call, and just as easy for the receiving bookkeeper.

Note that, since RPC is the neutral middle ground, a Frivolity game parlor (a.k.a. a Perl object of a Volity::Game::Server subclass) can pass a Volity::GameRecord object to any Volity bookkeeper, regardless of its platform. Similarly, A Volity::Bookkeeper object can knit a Volity::Gamerecord object out of any game parlor's RPC request, whether or not that parlor runs Frivolity. (In reality, this latter situation will probably be quite common.)

USAGE

Game module designers don't have to worry about using this module at all. Records are automatically created by Volity::Referee objects when a game wraps up, and incoming records are automatically parsed by the bookkeeper. Your main responsibility with game record handling involves the winners list, available through the winners() method of your Volity::Game subclass and manipulatable through the methods described in Volity::WinnersList.

The following documentation is really here for completeness' sake, but those wishing to modify the Frivolity referee or bookkeeper behavior might find it interesting.

METHODS

Class methods (constructors)

new_from_hashref($hashref)

Creates a new object based on the given hash reference, typically one that has been freshly translated from an RPC <struct> argument.

For the opposite functionality, see render_into_hashref under "Object Methods".

Object accessors

All these are simple accessors which return the named object attribute. If an argument is passed in, then the attribute's value is first set to that argument.

In the case of lists, either an array or an array reference is returned, depending upon context.

This module inherits from Class::Accessor, so all the tips and tricks detailed in Class::Accessor apply here as well.

id
signature
winners
start_time
end_time
game_uri
game_name
parlor
finished

Object methods

sign

Referee only.Generates a signature for this record, and attaches it.

The signature is based on a specific subset of the record's information, which both sender and receiver agree upon. Refer to the Volity protocol documentation for more information on this procedure.

verify

Verifies that the record is signed, and that said signature is valid. Returns truth if everything looks OK, and falsehood otherwise.

unsign

Removes the signature from the record, if it has one.

render_as_hashref

Returns an unblessed hash reference describing the game record. It just so happens that this hash reference is in the very same format that the Volity record_game RPC request requires as its <sruct> argument. Fancy that!

AUTHOR

Jason McIntosh <jmac@jmac.org>

COPYRIGHT

Copyright (c) 2003-2006 by Jason McIntosh.