The T7 engine is a DLL that extends the A7 core engine. While the A7 engine is a general engine for all sorts of simulations and virtual reality applications, the T7 engine provides specialized functions for action, role playing, or vehicle games. The T7 engine is used by the Gamestudio Template system and is based around Game Entities (GEs) and Components (CMPs).
The T7 engine works with all Gamestudio Editions (Extra, Commercial, and Pro), but not with the "lite-C only" editions. It's goals are
The complete source code of the T7 Game Engine is available under an Open Source license with the Commercial Edition C , and under a full license with the Pro Edition P .
That's it! Press the Run button in WED and enjoy your new game.
Game Entities are entities (models, sprites etc.) that are controlled (in part or in whole) by the T7 engine. GEs can be created automatically from data, made by other GEs, or by calling the entity_add(..) function with the entity as an argument. In addition to managing the entity, GEs can have zero or more Components attached to them.
GEs can be created several ways. The traditional way of adding and editing entities using WED works the same as with Template6:
The key difference to the Template6 system is that the T7 lite-c actions contain logic and the data used to create the GE is stored in a separate data file. For example, the t7biped_player action looks like this:
/// action: t7biped_player /// title: Player (biped) /// desc: Simple biped player behavior /// Should one be one per level. /// behavior: biped_player action biped_player() { wait(1); // allow the entity to load if (!entity_add(me)) // add as GE return; camera_set_target_ent(me); // make this the target of the camera system // additional game logic can follow... }
The “behavior” tag in the header points to the data structure containing the CMPs and editable fields:
<Behavior name="biped_player" class="bipedEntity" group="Player"> <Doc>Player controlled avatar.</Doc> <Component name="health"> <Edit name="health" value="100" /> <!-- start with 100 health --> </Component> <Component name="control"> <Edit name="type" value="joypad" /> </Component> <Component name="physBiped"> <Edit name="xForce" value="8" /> <Edit name="yForce" value="5" /> <Edit name="aForce" value="5" /> <Edit name="jumpHeight" value="30" /> </Component> ....
The separate data structure is easier to maintain, allows for easy editing, and allows reuse. When the user edits the entity using the Behavior dialog, those modifications are stored in another data structure:
<Entity name="test_mdl" behavior="biped_player"> <Component name="health"> <Edit name="health" value="75" /> </Component> </Entity>
The name is the link.name of the ENTITY struct, and only the values which the user changes will be stored. This saves space and frees us from the limits of WED. When an entity is loaded in the game, its action will call entity_add(me) which will create a GE and look up the data structure for the entity. The data is used to load CMPs and starting values into the GE. The GE will be updated once a frame until it is removed.
Entities attached to GEs can still be used like normal entities (although some things, like directly moving or removing an entity isn't recommended). Plus they can be controlled by sending it messages (edits and actions). For example, the following is a simple moving biped:
/// action: t7_biped_dumb /// title: Dumb AI (biped) /// desc: Example of a dumb AI biped. /// behavior: biped_baseAI action t7_biped_dumb() { wait(1); // allow the entity to load entity_add(me); // add as GE while(me) { entity_edit_vec(my,t7EntityEdit_setForce,0.5,0,0); // move forward half speed entity_edit_vec(my,t7EntityEdit_setAForce,0.25,0,0);// in a circle wait(1); } }
In this example, entity_edit_vec() sets the linear and angular forces of the GE. These forces are used by CMPs in the GE that move and animate the entity.
Components (CMPs) are self-contained logic units that add features to GEs. For example, the PhysBiped CMP makes the GE move like a biped. The Animate CMP animates the GE depending on its state.