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