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 10:17]
thomas [Level Editor variables]
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. 
  
-**Example:​**\\ +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. 
-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 22: 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 42: 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 ====
  
-An entity is built up from several different elements, all contained or referenced to by the ent file. None of these are required, and an entity can contain all of these types, just a single one or any variation (except for animations which require a mesh).+An entity is built up from several different elements, all contained or referenced to by the ent file.
  
 **Mesh**\\ **Mesh**\\
-This is the core object for almost all entities. The data is a mesh file ("​.dae"​ or "​.msh"​) that can that comes in the form of a separate file which the entity references to. An entity can only have a single mesh connected to it. Note that several entities can connect to the same mesh file.+This is the core object for almost all entities. The data is a mesh file ("​.dae"​ or "​.msh"​) that can that comes in the form of a separate file which the entity references to. An entity can only have a single mesh connected to it. Note that several entities can connect to the same mesh file. This is the only part of the data that is required for the entity to load properly.
  
 **Animations**\\ **Animations**\\
Line 79: Line 88:
 Particles, lights, sounds, etc are now added and attached to bodies or joints if applicable. The entity can be tested inside the model editor to make sure every thing works according to plan. The entity file is saved and the model editor can be closed down. Particles, lights, sounds, etc are now added and attached to bodies or joints if applicable. The entity can be tested inside the model editor to make sure every thing works according to plan. The entity file is saved and the model editor can be closed down.
  
-Now the final step in the model editor: setting up type variables. This is some of the of the variables that have been specified in the ''"​EntityTypes.def"''​ file used by the level editor. Usually this deals with type specific gameplay related properties like how long a door takes to open, how fast a creature is, etc. Each different entity type has a different set of type variables (but share many with other entity types).+Now the final step in the model editor: setting up type variables. This is some of the of the variables that have been specified in the ''"​EntityClasses.def"''​ file used by the level editor. Usually this deals with type specific gameplay related properties like how long a door takes to open, how fast a creature is, etc. Each different entity type has a different set of type variables (but share many with other entity types).
  
-Now the entity is ready to be added to the game. To do this the editor is opened and the entity mode is selected. One can now find the menu according to its placement in the file structure (this is usually ''"​entities/​[category]/​[subcategory]/​[entityname]/"''​) and select it. The entity can now be placed in the level. After this, there are some instance variables available (e.g. lamp color, if a door is locked, etc). These variables have also been specified in ''"​EntityTypes.def"'​.+Now the entity is ready to be added to the game. To do this the editor is opened and the entity mode is selected. One can now find the menu according to its placement in the file structure (this is usually ''"​entities/​[category]/​[subcategory]/​[entityname]/"''​) and select it. The entity can now be placed in the level. After this, there are some instance variables available (e.g. lamp color, if a door is locked, etc). These variables have also been specified in ''"​EntityTypes.def"​''.
  
 Once the game loads up the saved map file the entity will appear there, with bodies, effects and everything. Once the game loads up the saved map file the entity will appear there, with bodies, effects and everything.
 +
 ==== Level Editor variables ==== ==== Level Editor variables ====
  
-The level editor variables are set in the ''"​EntityClasses.def"''​ file. They contain a number of entity types (element ''​Class''​) that can inherit variables from the elements '​BaseClass''​.+The level editor variables are set in the ''"​EntityClasses.def"''​ file. They contain a number of entity types (element ''​Class''​) that can inherit variables from the elements ​''​BaseClass''​.
  
 The editor contains three different sets of variables that can be defined in each ''​Class''​ element: The editor contains three different sets of variables that can be defined in each ''​Class''​ element:
hpl3/engine/entities.txt · Last modified: 2015/09/28 08:29 by mudbill