User Tools

Site Tools


hpl3:engine:entities

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
hpl3:engine:entities [2012/10/24 13:26]
thomas [Data Structure]
hpl3:engine:entities [2013/10/08 13:03]
ian.thomas Typo
Line 8: Line 8:
  
 ==== Lowlevel Structure ==== ==== Lowlevel Structure ====
-At the very basic level an entity comes as an .ent file that is loaded by the engine. The engine provides a basic loader for entities that handles loading of the basic types contained in it. The game can provide their own loader built from scratch, but one almost always wants to use the loader that the engine provides. The default game provides a few basic types like like Props (doors, buttons, dynamic crates, etc) and Agents (enemies, NPCs, etc) that are used as a foundation for the actual entity used in the game.  The final entity type is defined by a script file, which takes care of all specific entity loading, setup and logic. ​ 
  
-In order to specify a type it first needs to be added to ''"​config/​EntityTypes.cfg"''​ under the basic game type is should used (Prop, Agent, etc). Here the name (used as an identfier), the script file, the class name (refering to the main class in the script file) and if it is forced to have full game save (if all data is always saved) is specified. Then the editor must also know about this type and do do this ''"​edtitor/​EntityClasses.def"''​ needs to be updated with the type's [[hpl3:​engine:​entities#​level_editor_variables|variables]]. Once this is done, the type is ready to be used in game and editor. 
  
-Inside ​the game, each entity ​has complete copy of all data, except ​for mesh and animations. So this means that the type variables are contained in each copy of the entityThis takes up a bit of extra memory ​but make it much easier ​to handle entitiesFor instance it is okay to change ​a type-defined ​variable for one specific instance ​of an entity ​if needed+At the very basic level an entity ​comes as an .ent file that is loaded by the engine. The engine provides ​basic loader ​for entities ​that handles loading of the basic types contained in itThe game can provide their own loader built from scratch, ​but one almost always wants to use the loader that the engine providesThe default game provides ​few basic types like like Props (doors, buttons, dynamic crates, etc) and Agents (enemies, NPCs, etc) that are used as a foundation for the actual entity used in the game.  The final entity ​type is defined ​by a script file, which takes care of all specific ​entity ​loading, setup and logic.
  
-**Example:​**\\ + 
-The entity "​Prop_Lamp"​ uses the basic type "​Prop"​ and is meant to be used for any lamp-like objects in the game. The file ''"​config/​EntityTypes.cfg"''​has been updated with:+In order to specify a type it first needs to be added to ''"​config/​EntityTypes.cfg"''​ under the basic game type is should used (Prop, Agent, etc). Here the name (used as an identfier), the script file, the class name (refering to the main class in the script file) and if it is forced to have full game save (if all data is always saved) is specified. Then the editor must also know about this type and do do this ''"​editor/​EntityClasses.def"''​ needs to be updated with the type's [[:​hpl3:​engine:​entities|variables]]. Once this is done, the type is ready to be used in game and editor. 
 + 
 + 
 +Inside the game, each entity has a complete copy of all data, except for mesh and animations. So this means that the type variables are contained in each copy of the entity. This takes up a bit of extra memory but make it much easier to handle entities. For instance it is okay to change a type-defined variable for one specific instance of an entity if needed. 
 + 
 + 
 +**Example:​** \\  
 +The entity "​Prop_Lamp"​ uses the basic type "​Prop"​ and is meant to be used for any lamp-like objects in the game. The file ''"​config/​EntityTypes.cfg"''​ has been updated with:
 <code xml> <code xml>
 <​PropType ​ <​PropType ​
Line 24: Line 29:
 /> />
 </​code>​ </​code>​
-This is added to the ''​PropTypes''​ element and contains the needed data for the game \\ 
-To use it in the editor, ''"​edtitor/​EntityClasses.def"''​ has also been updated with the following: 
  
 +
 +This is added to the ''​PropTypes''​ element and contains the needed data for the game \\ 
 +To use it in the editor, ''"​edtitor/​EntityClasses.def"''​ has also been updated with the following:
 <code xml> <code xml>
 <Class Name="​Prop_Lamp"​ InheritsFrom="​Prop">​ <Class Name="​Prop_Lamp"​ InheritsFrom="​Prop">​
Line 44: Line 50:
 </​code>​ </​code>​
  
-This makes the editors (model and level) aware that the type exists and provides them with info on what variables it should have as well as any special behavior. More specifics are found [[hpl3:​engine:​entities#​level_editor_variables|below]].+ 
 +This makes the editors (model and level) aware that the type exists and provides them with info on what variables it should have as well as any special behavior. More specifics are found [[:hpl3:​engine:​entities|below]].
  
 ==== Data Structure ==== ==== Data Structure ====
hpl3/engine/entities.txt · Last modified: 2015/09/28 08:29 by mudbill