Linux SoftwareProgrammingLibrariesGames::Object 0.11

Games::Object 0.11


Games::Object is a Perl module to provide a base class for game objects. SYNOPSIS package MyGameObject; use Games::Obj
Developer:   Peter J. Stewart
      more software by author →
Price:  0.00
License:   Perl Artistic License
File size:   83K
Language:   
OS:   
Rating:   0 /5 (0 votes)
Your vote:  
enlarge screenshot


Games::Object is a Perl module to provide a base class for game objects.

SYNOPSIS

package MyGameObject;
use Games::Object;
use vars qw(@ISA);
@ISA = qw(Games::Object);

sub new {
# Create object
my $proto = shift;
my $class = ref($proto) || $proto;
my $self = $class->SUPER::new(@_);
bless $self, $class;

# Add attributes
$self->new_attr(-name => "hit_points",
-type => 'int',
-value => 20,
-tend_to_rate => 1);
$self->new_attr(-name => "strength",
-type => 'int',
-value => 12,
-minimum => 3,
-maximum => 18);
...

return $self;
}

package MyObjectManager;
use Games::Object::Manager;
use vars qw(@ISA);
@ISA = qw(Games::Object::Manager);

sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
my $self = $class->SUPER::new(, @_);
bless $self, $class;
...
return $self;
}


my $world = new MyObjectManager;
my $object = new MyGameObject;
$world->add($object);

ABSTRACT

The purpose of this module is to allow a programmer to write a game in Perl easily by providing a basic framework in the form of a module that can be either subclassed to a module of your own or used directly as its own object class. The most important items in this framework are:

Attributes

You can define arbitrary attributes on objects with rules on how they may be updated, as well as set up automatic update of attributes whenever the object's process() method is invoked. For example, you could set an attribute on an object such that:

It ranges from 0 to 100.

Internally it tracks fractional changes to the value but accessing the attribute will always round the result to an integer.

It will automatically tend towards the maximum by 1 every time process() is called on the object.

A method in your subclass will be invoked automatically if the value falls to 0.
This is just one example of what you can do with attributes.

Flags

You can define any number of arbitrarily-named flags on an object. A flag is a little like a boolean attribute, in that it can have a value of either true or false. Like attributes, flags can be created independently on different objects. No "global" flag list is imposed.

Load/Save functionality

Basic functionality is provided for saving data from an object to a file, and for loading data back into an object. This handles the bulk of load game / save game processing, freeing the programmer to worry about the mechanics of the game itself.

The load functionality can also be used to create objects from object templates. An object template would be a save file that contains a single object.

Object Managers

New to version 0.10 of this module is object managers. An object manager is a Perl object that allows you to manage groups of related game objects. The object manager allows you to relate objects together (for example, you could define a relationship that allows certain objects to act as containers for other objects). In effect, the object manager acts as your world or universe.
Like the game object class, the manager class can be subclassed, allowing you augment its functionality. An object manager can be loaded and saved, which in turn performs a load or save of the objects being managed by it.

Requirements:
  • Perl
    tags object manager  games object  the object  self class  you can  can define  class the  this module  object class  for example  example you  that allows  allows you  

    Download Games::Object 0.11


     http://ftp.casaafacerilor.ro/mirrors/CPAN/authors/id/P/PS/PSTEWART/Games-Object-0.11.tar.gz


    Authors software

    Games::Object 0.11 (by Peter J. Stewart)
    Games::Object is a Perl module to provide a base class for game objects.

    SYNOPSIS

    package MyGameObject;
    use Games::Obj


    Similar software

    Games::Object 0.11 (by Peter J. Stewart)
    Games::Object is a Perl module to provide a base class for game objects.

    SYNOPSIS

    package MyGameObject;
    use Games::Obj

    Basset::Object::Persistent 1.03 (by Jim Thomason)
    Basset::Object::Persistent is a subclass of Basset::Object that allows objects to be easily stored into a relational database

    Class::Tangram 1.57 (by Sam Vilain)
    Class::Tangram is a Perl module for tangram-friendly classes, DWIM attributes.

    SYNOPSIS

    package MyObject;

    use base qw(Clas

    Games::3D 0.09 (by Tels)
    Games::3D is a package containing an object system for (not only) 3D games.

    SYNOPSIS

    use Games::3D::World;

    m

    SOAP::Data::ComplexType 0.041 (by Eric Rybski)
    SOAP::Data::ComplexType is an abstract class for creating and handling complex SOAP::Data objects.

    SYNOPSIS

    package My:

    Class::InsideOut 1.02 (by David A. Golden)
    Class::InsideOut is a Perl module with a safe, simple inside-out object construction kit.

    SYNOPSIS

    package My::Class;

    u

    Object::Relation::Meta::Class::Schema 0.1.0 (by Kineticode, Inc.)
    Object::Relation::Meta::Class::Schema is a Perl module for Object::Relation database store builder.

    This module is provides metada

    Class::CGI 0.20 (by Curtis Poe)
    Class::CGI is a Perl module to fetch objects from your CGI object.

    SYNOPSIS

    use Class::CGI
    handlers => {

    Object::Relation::Meta::Type 0.1.0 (by Kineticode, Inc.)
    Object::Relation::Meta::Type is an Object::Relation Data type validation and accessor building.

    Synopsis

    Object::Relation::Me

    Object::Relation::Meta::Attribute::Schema 0.1.0 (by Kineticode, Inc.)
    Object::Relation::Meta::Attribute::Schema is a Perl module for Object::Relation database store builder.

    Synopsis

    # Assuming M


    Other software in this category

    zlib 1.2.3 (by Jean-loup Gailly)
    zlib is designed to be a free, general-purpose, legally unencumbered, lossless data-compression library for use on virtually any comp

    libjpeg v6b (by Independent JPEG Group)
    libjpeg is a library for handling the JPEG (JFIF) image format

    OpenSSL 0.9.7c (by The OpenSSL Project Team)
    The OpenSSL Project is a collaborative effort to develop a robust, commercial-grade, full-featured, and Open Source toolkit implement

    libxml2 2.6.27 (by DV)
    Libxml2 is the XML C parser and toolkit developed for the Gnome project (but usable outside of the Gnome platform), libxml2 library i

    GNU C library 2.4 (by Andreas Jaeger)
    GNU C library (glibc) is one of the most important components of GNU Hurd and most modern Linux distributions.

    GNU C library is us

  •     search


    Featured Software

    jEdit 4.3 pre8
    jEdit is an Open Source text editor written in Java

    Opera 9.02
    Surf the Internet in a safer, faster, and easier way with Opera browser

    GNU Aspell 0.60.4
    GNU Aspell is a Free and Open Source spell checker designed to eventually replace Ispell


    Subscribe in Rojo
    Google Reader
    Add to My Yahoo!

    Add to My AOL
    Subscribe with Bloglines
    Subscribe in NewsGator Online
    Add 'nixbit linux software' to Newsburst from CNET News.com
    del.icio.us nixbit linux software


    Top tags