environment.rb

Path: lib/mues/environment.rb  (CVS)
Last Update: Sat Aug 18 22:54:10 -0700 2007

This is an abstract base class for MUES environment objects. Environments are objects which contain the main context of interaction between Users and other objects, as well as the expression of the rules of that interaction. It is the Universe of Discourse in which the interaction takes place. In a game context, for example, the Environment contains the logic for all gameplay, including rules for movement about a space, class definitions for in-game objects, and a function library which can be used in the expression of those objects to interact with the containing server and the world itself.

Synopsis

  require 'mues/environment'

  # Create a new environment object
  environment = MUES::Environment::new( "Faerith" )

  # Get the list of roles available to the user
  roles = environment.getAvailableRoles( aUser )

  # After determining the desired role, get an IOEventFilter that can be
  # inserted into the user's IOEventStream to allow interaction with the
  # Environment and insert it.
  proxy = environment.getParticipantProxy( aUser, roles[0] )
  aUser.ioEventStream.addFilters( proxy )

Contract

Subclasses are required to provide implementations of the following methods:

start()
Start the environment running, returning any startup events which should be dispatched.
stop()
Stop/shut the environment down, returning any cleanup events which should be dispatched.

If the default shell commands for interacting with environments (server/shellCommands/environments.cmd) are used, environments should also implement the following methods:

getParticipantProxy( user, role )
Factory method; should instantate and return a MUES::ParticipantProxy object (or an instance of one of its subclasses) for the specified user and role. Should raise an exception of type MUES::EnvironmentError (or a subclass) if the operation is not possible for some reason.
getAvailableRoles( user )
Should return a list of MUES::Role objects which describe the roles for participation available to the given user.

Different modes of connection to an Environment can be created by modifying or replacing the commands for interacting with them.

Subversion ID

$Id: environment.rb 1206 2004-05-09 21:25:11Z deveiant $

Authors

  • Michael Granger <ged@FaerieMUD.org>

Copyright

Copyright (c) 2000-2003 The FaerieMUD Consortium. All rights reserved.

This module is free software. You may use, modify, and/or redistribute this software under the terms of the Perl Artistic License. (See language.perl.com/misc/Artistic.html)

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.

Required files

sync   pluginfactory   mues/object   mues/mixins   mues/exceptions   mues/events   mues/role   mues/ioeventfilters  

[Validate]