The Allegro Wiki is migrating to github at

Monday project

From Allegro Wiki
Revision as of 22:23, September 22, 2008 by Matt Smith (talk | contribs) (Game Class)
Jump to: navigation, search


It's a Monday Project. it started on n Webpage :

Getting the game

You need to install Allegro 5 first. Guide for windows Installing_4.9_Windows

Then you need LUA 5.1. Helpful guide for Windows

Then checkout the monday/trunk dir from SVN

<highlightSyntax language="bash">

 mkdir %your source dir%/monday
 cd  %your source dir%/monday
 SVN co


Alternatively, you can replace make with scons, if you have that installed.

Games & Scripting

Design Team

  • Lead - 23yrold3yrold & Mark Oates


OnlineCop has been assigned the coding task. But he's slow.

File format

Format to be decided by programming team. 23yrold3yrold will make his editor spit out maps accordingly.


A script should be able to order a map switch.

Entities (Items & Objects & Characters)

  • Entity
    • Lua bindings
    • Set_function(action, function)
    • Set/get position
  • Entity_manager
    • Pick_up
    • Attack
    • Interact
    • Lua bindings
      • Create_entity
      • Destroy_entity


    Map   -  every object is associated with the map it is on.  
    Parent Object -  An object may not be in plain view on the map, but may be  e.g. in a player's inventory
    x,y,z - In terms of the Map renderer or relative to the Parent Object      
    quat rot;  <-- may be handy here too, giving the same properties as LocRot in blender

This class is not in the code so far, but is a candidate to replace the Vector in Item, Character & Player

<highlightSyntax language="cpp"> class Locator { public:

  float Get_angle_256();              /* returns angle (in allegro degrees) on x,y plane from rot */
  void  Set_angle_256(float angle);   /* sets rot to angle (in allegro degrees) */
  float Get_map_distance(Locator& l2);   /* returns distance (in map units) to another locator.  This could be x,y for now */
  Map *   map;     /* Map that the Item is on */  
  Item *  item;    /* parent object.  set for an Item if it is attached to another Item or in a Player's inventory */
  Vector3  xyz;    /* position of Item in parent's axes */
  AL_QUAT  rot;    /* rotation of Item relative to parent */  

} </highlightSyntax>

Item* takes priority over Map* (they should ideally be merged into a single global object). If (item!=NULL) then xyz and rot are in parent-defined co-ords, otherwise they are in map co-ords


Trezker's TODO

  • Inventory
    • Item management //No, it's pretty different from the Item_manager, so no inheritance please.
  • Inventory menu // Yes, this is a menu. Opened with some button in game.
    • Info about item // On mousover
    • Render function // Layout?
    • Equip // just a click; right click to bind to right mouse button, left to bind to left.
    • Use/Drop item // Low prio, this is not in design

Matt Smith: An inventory can be implemented as a map. An Item's location will have a parent which can be a Map, a Character , or even another Item.


Loading and Saving

Trezker's TODO

  • Loading // Can use Init script for now
    • Map
    • Entities

Game Class

Game interface.png

The interface between the Game and the system (Main.cpp) should do the following

<highlightSyntax language="cpp"> class Game() { public:

  Init();      /* This is called before any other Game method */ 
  NewGame(int num_Players);   /* Resets the game state to a new game */
  Run();       /* Sets the game state into power on/ menu mode */        
  Play();      /* Sets the game state into game playing mode */  
  main_event_t Update();    /* This is called once per frame. the return value is used to trigger system events */
  Render();    /* The game draws the current frame onto display */
  int Get_frame_rate();    /* Returns the Games chosen refresh rate.  
                           Main uses this to decide how often to call Update() and Render() */

} </highlightSyntax>

  • MAIN_EVENT_EXIT Game saves .cfg and exits
  • MAIN_EVENT_PAUSE Game requests system goes into paused mode
  • MAIN_EVENT_RESUME Game requests system comes out of paused mode
  • MAIN_EVENT_GAME_REINIT Game requests that it be shut down and reinitialised.
  • MAIN_EVENT_GAME_ERROR Game requests that it be shut down and an error reported.
  • MAIN_EVENT_MENU_SAVEGAME Game requests system savegame manager
  • MAIN_EVENT_MENU_LOADGAME Game requests loadgame
  • MAIN_EVENT_MENU_KEYBOARD Game requests system keyboard preferences manager
  • MAIN_EVENT_MENU_JOYSTICK Game requests system Joystick preferences manager


  A list of maps.
  A list of levels.  each level can take place over several maps
  A game state. 

game scripts

Menu Class

Trezker & Matt Smith are making a top level menu system, which will may be configurable by a LUA script