The game's structure and organization are taking shape. Most of the required features have been touched upon, but none are complete.

The main Game Class holds instances of the new sprite class, called BPerson because it will probably only hold person sprites. These sprites can be controlled by the keyboard and will also have an AI that can move them.

I like the idea of having all entities (enemies, player character, etc) having the same base class so it is possible to control any by AI or keyboard. Something like this was done in a game I made called CWS (Cold War Showdown). In that case it was hard because I couldn't serialize anything, but in C++ it's always possible, you can have many unique instances and one class. Static variables can effect all members of the class and you can derive a class from another and still count it as the original type (somehow...).

I did not want the entity class to be connected to the mesh or to be an csObject, but I still decided to use a csObject for a reference back to it. Who knows why, not really that important I may remove it later.

Keep in mind this is a documentary of a work in progress program, there is no reason to be using this code.

Below is the main class definitions and header file for the current faded project. comments are a little lengthy because it is intended to show you what the various parts relate to.

 

Many things are still undecided about the game. The story, the size, and some other issues. Also trying to figure a way to make these 2d animations in a simpler way.

The logo is another thing that's not totally decided. Here is my folder of concepts and logo mishaps. Not pretty stuff by any means.

Concept Images Gallery

//this is the main game class header file for the Faded Earth program
struct iEngine;
struct iLoader;
struct iGraphics3D;
struct iGraphics2D;
struct iKeyboardDriver;
struct iVirtualClock;
struct iObjectRegistry;
struct csSimplePixmap;
struct iEvent;
struct iSector;
struct iView;
struct iDynamics;
struct iDynamicSystem;
struct iRigidBody;
struct iJoint;
struct iMeshFactoryWrapper;
struct iMeshList;
struct iCollider;
struct iCollideSystem;
//enums are just for convinience
enum e_Pm {left=0,right,up,down};
//declare, define later
class BPerson;
//these SCF calls are crystal spaces SCF stuff to make this a standard CS object
SCF_VERSION (BPersonRef, 0, 0, 1);
//BPersonRef inherits from csObject
class BPersonRef : public csObject
{
public:
//it'm main feature is that it has a reference to it's
// particuluar BPerson instance defined later
  BPerson *ref;
//
  SCF_DECLARE_IBASE_EXT (csObject);
};
//macros for SCF functions
SCF_IMPLEMENT_IBASE_EXT (BPersonRef)
SCF_IMPLEMENTS_INTERFACE (BPersonRef)
SCF_IMPLEMENT_IBASE_EXT_END

//BPerson is a class used to define sprites. 
//These sprites will be controlable via move_pm and there will also be a 
//BPersonRef just to store the pointer to this BPerson in the Mesh's iObject
class BPerson
{
    private:
        
        
    public:
        //the mesh sprite
        csRef<iMeshWrapper> sprite;
        //each instance has a BPersonRef that is attached to sprite's iObject
        csRef<BPersonRef> bpersonref;
        //the Mesh's Collider, (<csref> or pointer)
       // csRef<iCollider> coli;
       iCollider *coli;
       //how fast does it move?
        float speed;
        //constructor, when the object is created it will make a new sprite
        BPerson();
        //uses the previously defined enum e_Pm to move the sprite with MovePosition
        bool move_pm(e_Pm cmd);
};

//this is the game class. It is used in case we want to restart the game or something
//if you know what you're doing you can skip the main game class and make this stuff global
class BGame
{
    private:
 //properties, private
       iObjectRegistry* object_reg;
 //smart pointers,
      csRef<iEngine> engine;
      csRef<iLoader> loader;
      csRef<iGraphics3D> g3d;
      csRef<iGraphics2D> g2d;
      csRef<iKeyboardDriver> kbd;
      csRef<iVirtualClock> vc;
 //view has the camera etc.
      csRef<iView> view;
 //this below will be changed later to be more dynamic
      csRef<iMeshWrapper> sprite;
      csRef<iMeshWrapper> wall;
      csRef<iMeshFactoryWrapper> meshfact;
      iSector* room;
  
  //iCollider* collidersp;
      iCollider* colliderroom;
 //collision system
      csRef<iCollideSystem> cdsys;
 //functions, private
//matches this line- csInitializer::SetupEventHandler (object_reg, BGameEventHandler)
      static bool BGameEventHandler (iEvent& ev);
//is called by previous
      bool HandleEvent (iEvent& ev);
//main loop consists of start and finish -
      void SetupFrame ();
      void FinishFrame ();
//map loading
      bool LoadMap ();
//otherresource loading, includes call to loadmap()
      bool LoadRes ();
//collision detection, may be changed later
      bool cd_near (iCollider *c, csReversibleTransform *cdt);
//for later when we have pixmap HUD      
      //bool Load2DImages ();
     // void DrawFrame2D ();
 public:
 //vars public
//sprite iterator makes each serialized sprite have a unique name
     int sprite_iterator;
//here is where the just mentioned BPerson class comes in, 
//still working on a way to name pointers faster dynamically 
     BPerson *bperson[12];
 //functions, public
      BGame (iObjectRegistry* object_reg);
 //deconstructor, it deletes *bperson[12], or at least it should...
      ~BGame ();
 //initialize calls loadres and loadmap and many other things like plugins
      bool Initialize (iObjectRegistry* object_reg);
 //after start is through the game ends...
      void Start ();
 //make a new imeshwrapper and return it...
      csRef<iMeshWrapper> fact_sprite(bool interate);
 //makes a new icollider and returns it and adds it to the sprite...
      iCollider* InitCollider (iMeshWrapper* mesh);
 };