User Tools

Site Tools


dragengine:modules:dragonscript:abstractions

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
dragengine:modules:dragonscript:abstractions [2020/05/05 20:54] dragonlorddragengine:modules:dragonscript:abstractions [2024/03/14 16:43] (current) dragonlord
Line 15: Line 15:
 **Behavior Elements** are build on top of the **Scenery Elements** and provide a **composeable** way to build game logic. This is the fastest way to build your game by befitting elements with reusable **behavior** while still retaining all the powerful coupling to other script classes. **Behavior Elements** are build on top of the **Scenery Elements** and provide a **composeable** way to build game logic. This is the fastest way to build your game by befitting elements with reusable **behavior** while still retaining all the powerful coupling to other script classes.
  
-Behavior elements are created by subclassing from [[https://developer.dragondreams.ch/docs/dragonscript/scriptapi/latest/classDragengine_1_1Scenery_1_1BehaviorElementClass.html|BehaviorElementClass]] script class. This class extends the [[https://developer.dragondreams.ch/docs/dragonscript/scriptapi/latest/classDragengine_1_1Scenery_1_1ElementClass.html|ElementClass]] script class with support to add **Behavior Definitions**. When a [[https://developer.dragondreams.ch/docs/dragonscript/scriptapi/latest/classDragengine_1_1Scenery_1_1BehaviorElement.html|BehaviorElement]] instance is created these **behavior definitions** are used to befit the element with all the required functionality. All this can be done manually by using **Scenery Elements** but using **Behavior Elements** this boils down to just adding the **behavior definitions** you like to use.+Behavior elements are created by subclassing from #@LinkApiDocDEDS2_HTML~classDragengine_1_1Scenery_1_1BehaviorElementClass.html,BehaviorElementClass~@# script class. This class extends the #@LinkApiDocDEDS2_HTML~classDragengine_1_1Scenery_1_1ElementClass.html,ElementClass~@# script class with support to add **Behavior Definitions**. When a #@LinkApiDocDEDS2_HTML~classDragengine_1_1Scenery_1_1BehaviorElement.html,BehaviorElement~@# instance is created these **behavior definitions** are used to befit the element with all the required functionality. All this can be done manually by using **Scenery Elements** but using **Behavior Elements** this boils down to just adding the **behavior definitions** you like to use.
  
-Behavior definitions are created by subclassing from [[https://developer.dragondreams.ch/docs/dragonscript/scriptapi/latest/interfaceDragengine_1_1Scenery_1_1ECBehavior.html|ECBehavior]] script class. This stands for **Element Class Behavior**. Behavior definitions typically contain **Composeable Element Class** or **Element Class Property** instances with appropriate parameters set. This has a few nice properties making life simpler.+Behavior definitions are created by subclassing from #@LinkApiDocDEDS2_HTML~interfaceDragengine_1_1Scenery_1_1ECBehavior.html,ECBehavior~@# script class. This stands for **Element Class Behavior**. Behavior definitions typically contain **Composeable Element Class** or **Element Class Property** instances with appropriate parameters set. This has a few nice properties making life simpler.
  
 Element class properties can be used with **XML Subclassing**. You can created a new element class just using an XML file (*.deeclass) and change the properties added by the behavior definition. This is especially useful for mappers to add variations of **Game Objects** without needing to touch script code for such a simple task. Element class properties can be used with **XML Subclassing**. You can created a new element class just using an XML file (*.deeclass) and change the properties added by the behavior definition. This is especially useful for mappers to add variations of **Game Objects** without needing to touch script code for such a simple task.
Line 23: Line 23:
 Furthermore **Element Stubs** used to create **Game Objects** in your game world use the same names as the element class properties. This allows mappers to modify behaviors on a per **Game Object** basis if required. Furthermore **Element Stubs** used to create **Game Objects** in your game world use the same names as the element class properties. This allows mappers to modify behaviors on a per **Game Object** basis if required.
  
-You can query [[https://developer.dragondreams.ch/docs/dragonscript/scriptapi/latest/classDragengine_1_1Scenery_1_1BehaviorElementClass.html|BehaviorElementClass]] if it contains behaviors of a specific type. Some behavior definitions can be used more than once on the same element class. In this case you can assign each instance a unique **identifier**. This identifier is used to distinguish between the behavior definition instances and acts also as prefix modified of the added element class properties.+You can query #@LinkApiDocDEDS2_HTML~classDragengine_1_1Scenery_1_1BehaviorElementClass.html,BehaviorElementClass~@# if it contains behaviors of a specific type. Some behavior definitions can be used more than once on the same element class. In this case you can assign each instance a unique **identifier**. This identifier is used to distinguish between the behavior definition instances and acts also as prefix modified of the added element class properties.
  
-Once a [[https://developer.dragondreams.ch/docs/dragonscript/scriptapi/latest/classDragengine_1_1Scenery_1_1BehaviorElement.html|BehaviorElement]] instance is created each behavior definitions adds a subclass of [[https://developer.dragondreams.ch/docs/dragonscript/scriptapi/latest/interfaceDragengine_1_1Scenery_1_1ECBehaviorInstance.html|ECBehaviorInstance]]. These provide the actual behavior to the [[https://developer.dragondreams.ch/docs/dragonscript/scriptapi/latest/classDragengine_1_1Scenery_1_1BehaviorElement.html|BehaviorElement]] instance. Here too you can query the element if it contains instances of a specific behavior.+Once a #@LinkApiDocDEDS2_HTML~classDragengine_1_1Scenery_1_1BehaviorElement.html,BehaviorElement~@# instance is created each behavior definitions adds a subclass of #@LinkApiDocDEDS2_HTML~interfaceDragengine_1_1Scenery_1_1ECBehaviorInstance.html,ECBehaviorInstance~@#. These provide the actual behavior to the #@LinkApiDocDEDS2_HTML~classDragengine_1_1Scenery_1_1BehaviorElement.html,BehaviorElement~@# instance. Here too you can query the element if it contains instances of a specific behavior.
  
 Behaviors are split in two groups: **Basic Behaviors** and **Complex Behaviors**. **Basic Behaviors** add a small basic building block of game logic like for example a component showing the visual appearance of a game object. These are highly reusable. **Complex Behaviors** on the other hand typically expect one or more **Basic Behaviors** to be present in the element class to provide a complex behavior for example animating the visual appearance. Behaviors are split in two groups: **Basic Behaviors** and **Complex Behaviors**. **Basic Behaviors** add a small basic building block of game logic like for example a component showing the visual appearance of a game object. These are highly reusable. **Complex Behaviors** on the other hand typically expect one or more **Basic Behaviors** to be present in the element class to provide a complex behavior for example animating the visual appearance.
dragengine/modules/dragonscript/abstractions.1588712077.txt.gz · Last modified: 2020/05/05 20:54 by dragonlord