Code Search for Developers
 
 
  

GameEconomyClasses.pas from Sector-37 at Krugle


Show GameEconomyClasses.pas syntax highlighted


                    //*******************************//
                    //                               //
                    // Strange Game Economy Classes  //
                    //                               //
//******************//*******************************//*********************//
//                                                                          //
//        This unit is the part of a real time 3d space strategy engine     //
//                      (www.federation.netfirms.com)                       //
//                                                                          //
//**************************************************************************//

{
Author  : Alexander Federyakov aka Da Stranger
Version : 0.001 ;-]
Date    : 22 October '2005
License : You can use this unit ONLY for educational purposes. You cannot use
          more than 10% of its code in your own personal projects. It cannot
          be used for any commercial  products.
Comments: This is the core of a 3d realtime space strategy game engine.
          Much is still to be done...
Requirements:  GLScene
Known Bugs and limitations: none

Contacts:
    Web:    http://www.sector-37.com
    E-mail: datarget@mail.ru
    ICQ:    293-963-070
    Odigo:  8077227
}
unit GameEconomyClasses;

interface

uses StrangeiniFiles, sysutils,

     GameConstants,GameUnitClasses;

type
TGameID=byte;//may be we will use byte ID's, may be strings...

TRequirements=class
  public
  Bases,
  Researches,
  Upgrades,
  Artifacts:array of TGameID;
  BaseGroups:array of byte;//you can use base groups OR bases
  RaceAvaibility:TRaceAvaibility;

  procedure LoadFromFile(ini:TStrangeIniFile;FileName:string;Section:string='General');
end;

TOldImplementation=record
  Group:byte;
  ID:TGameID;
  Parameter:byte;

  Min,Max:single;
  AverageRequirements:single;
  Penalty:single;
end;

TNewImplementation=record
  Group:byte;
  ID:TGameID;
end;

TImplementation=class
  public
  Cost:Tcost;
  New:array of TNewImplementation;
  Old:array of TOldImplementation;
end;

TUpgrade=class
  public
  //can effect a planet structures OR a Unittype (player)
  ID:TgameID;
  RealName:string;
  Description:string;
  Requirements:TRequirements;
  Implementations:TImplementation;
end;

TUpgradeData=class
  Ipgrade:TUpgrade;
  Committed :Boolean;
end;

TBuildingLevel=class
  public
  Implementations:TImplementation;
  RealName:string;
  Description:string;
  //effects are added up
end;

TBuilding=class
  public
  ID:TgameID;
  RealName:string;
  Description:string;
  Group:byte;
  MenuGroup:byte;
  BuildingLevels:array of TBuildingLevel;
  MaxNumber:byte;
  MaxHealth:integer;
  PowerConsumption:integer;//- if it eats power, + if produces
  Requirements:TRequirements;
end;

TBuildingData=class
  public
  Building:TBuilding;
  CurrentNumber:byte;
  IncreaseParameter1,       //this is what upgrades increase...
  IncreaseParameter2:single;//this is what upgrades increase...
  Health:integer;//of the last building in the block. Others are 100% or destroyed
end;

TArtifactType=class
  public
  ID:TgameID;
  Filename:string;//describes path to model, texture, and movement and rotation files
  Scale:single;
  RealName:string;
  Description:string;
  Implementations:TImplementation;
end;

TArtifact=class
  public
  ArtifactType:TArtifactType;
  ID:integer;               //Unique ID in the game
//  BoundingRadius:single;
//  ActorProxy:TglMultiProxy;//will be used almost everywhere
//  EffectsCube:TglDummyCube; //for holding effects like blur or trail and Unit Explosion effect
//  MovementCube:TglDummyCube;//for holding actorproxy...
//  Torsotags:TMD3TagList;//for MD3 animation support
end;

TMine=class
  public
  Group:byte;              //see MINE_xxx constants
  ResourceIDs:array of byte;
  ResourcesLeft:array of single;
  Parts:array of single;   // % of the mine
end;

TResearchLevel=class
  public
  Implementations:array of TImplementation;//includes the cost of implementation
  Cost:TCost;                              //The cost of Research only
  RealName:string;
  Description:string;
  LastImplementationLevels:array of single;
  //effects are replaced by successor effects
end;

TResearch=class
  public
  ID:TgameID;
  Name:string;
  Group:byte;
  Requirements:TRequirements;
  ImplementationID:TgameID; //where player chose to implement the technology.

  ResearchLevels:array of TResearchLevel;
  Avaible,Visible:Boolean;
  CurrentLevel:byte; //-1 means that it wasn't implemented yet
end;

implementation

{ TRequirements }

procedure TRequirements.LoadFromFile(ini:TStrangeIniFile;FileName:string;Section:string);
var
NeedToFreeini:Boolean;
begin
NeedToFreeini := False;
if ini=nil then
  begin
  ini := TStrangeIniFile.Create(Filename);
  NeedToFreeini := True;
  end;

if NeedToFreeini then ini.Free;
end;

end.
 




See more files for this project here

Sector-37

Sector-37 (real time 3D cosmic strategy)

Project homepage: http://sourceforge.net/projects/sector37
Programming language(s): Pascal
License: lgpl21

  Campaigns/
    Main/
      map.dsc
      mission1.mis
      mission2.mis
      settings.dsc
    NOT_DECIDED_YET
  Images/
    Cursors/
      Attack.bmp
      Attack.cur
      FollowAndDefend.bmp
      FollowAndDefend.cur
      Menu.bmp
      Menu.cur
      Normal.bmp
      Normal.cur
    Menu/
      Exit-Game.gif
      New-Game.gif
    Misc/
      Console.jpg
  Maps/
    MaterialScripts/
      Sprite.dsc
      clouds.dsc
      default.txt
      planet_day.dsc
      planet_day_origina_minel.dsc
      planet_night.dsc
      red.dsc
      scriptreflective.txt
      super_transparent_planet.dsc
      transparent_planet.dsc
    Meshes/
      asteroid1.3DS
      asteroid2.3DS
      asteroid3.3DS
      asteroid4.3DS
      asteroid5.3DS
      mesh.md3
      mesh_little.md3
      xxx.MD3
    Misc/
      Animations/
        animation.aaf
      Atmospheres/
        atm.dsc
        atm2.dsc
        atm3.dsc
      MovementPaths/
        complicated.dsc
        simple_saved.dsc
      MovementSettings/
        settings.dsc
      Stars/
        xxx.stars
    ObjectScripts/
      AsteroidField.dsc
      AsteroidField2.dsc
      AsteroidField3.dsc
      AsteroidField4.dsc
      Fire_Fx.dsc
      Lensflare1.dsc
      LightSource.dsc
      LightSource_enhanced.dsc
      Light_FX.dsc
      Perlin_FX.dsc
      Real SkyShere.dsc
      SkyShere1.dsc
      SkyShere2.dsc
      Sprite_jupiter.dsc
      Sprite_venus.dsc
      dustCloud1.dsc
      dustCloud2.dsc
      my skybox.dsc
      planet_day_night.dsc
      planet_day_night2.dsc
      planet_mars.dsc
      skybox1.dsc
      stardome1.dsc
      stardome2.dsc
    Textures/
      Meshes/
      Misc/
      Planets/
      SkyBoxes/
      SkySpheres/
      Sprites/
    1.dsc
    2.dsc
    3.dsc
    mission_map.dsc
    xxx.dsc
  Missions/
    Mission1/
  Objects/
    Artifacts/
    Engines/
    Equipment/
    Explosions/
    Race Types/
    Races/
    Shields/
    Unit Classes/
    Units/
    Weapons/
  Profiles/
    Default/
  GLP.nfo
  GameClassAncestors.pas
  GameConstants.pas
  GameEconomyClasses.pas
  GameEngine.pas
  GameSettings.pas
  GameStatisticsClasses.pas
  GameUnitClasses.pas
  MainForm.dfm
  MainForm.pas
  Project_Licence.txt
  Sector37.dpr
  Sector37.ico
  Sector37.res
  Sector37.stat
  Sector37.todo
  _Cleanup.bat
  config.ini
  testing_weapon_position.pas