nodeGame

Social Experiments in the Browser

Copyright(c) 2012 Stefano Balietti MIT Licensed

nodeGame is a free, open source, event-driven javascript framework for on line, multiplayer games in the browser.

(function (node) {

version

node.version = '0.6.3';

Objects

node.log

Standard out

node.log = function () {};

node.events

Instance of the EventEmitter class

Takes care of emitting the events and calling the proper listener functions

See
node.EventEmitter
node.events = {};
  

node.msg

Static factory of game messages

See
node.GameMsgGenerator
node.msg = {};
  

node.socket

Instantiates the connection to a nodeGame server

See
node.GameSocketClient
node.socket = node.gsc = {};

node.session

Contains a reference to all session variables

Session variables can be saved and restored at a later stage

node.session  = {};

node.player

Instance of node.Player

Contains information about the player

See
node.PlayerList.Player
node.player = {};

node.game

Instance of node.Game

See
node.Game
node.game = {};

node.game.memory

Instance of node.GameDB database

See
node.GameDB
node.game.memory = null;

node.game.state

Keeps track of the state of the game

See
node.GameState
node.game.state = null;

node.store

Makes the nodeGame session persistent, saving it to the browser local database or to a cookie

See
shelf.js
node.store    = function() {};

node.setup

Configures a specific feature of nodeGame and and stores the settings in node.conf.

See
Setup
node.setup    = function() {};

node.conf

A reference to the current nodegame configuration

See
Setup
node.conf = {};

node.support

A collection of features that are supported by the current browser

node.support  = {};

Dependencies

Load dependencies

if ('object' === typeof module && 'function' === typeof require) {
  
  require('./lib/modules/log.js');
  require('./lib/modules/variables.js');
  
  require('./init.node.js');
    require('./lib/nodegame.js');

    require('./lib/modules/fs.js');
    require('./lib/modules/setup.js');
  require('./lib/modules/alias.js');
  require('./lib/modules/random.js');
    

Loading Sockets

    require('./lib/sockets/SocketIo.js');
    require('./lib/sockets/SocketDirect.js');
    

Loading Event listeners

    require('./listeners/incoming.js');
    require('./listeners/internal.js');
    require('./listeners/outgoing.js');
}
else {
  if ('undefined' !== typeof JSUS) node.JSUS = JSUS;
  if ('undefined' !== typeof NDDB) node.NDDB = NDDB;
  if ('undefined' !== typeof store) node.store = store;
  
  node.support = JSUS.compatibility();
}
  
})('object' === typeof module ? module.exports : (window.node = {}));