(NativeObjectWorldArchitecture) NOWA-Engine

(NativeObjectWorldArchitecture) NOWA-Engine

Written by:

NOWA

  • Lukas Kalinowski

Introduction

Games fascinated me even as a child. I was keen on understanding how a game does work behind the scenes. So I started to study media and computing to lay the foundations.

During my study, I started to develop an application in C++ to ease the creation of graphical simulation.
At that time I was inspired by Advanced Ogre Framework. Henceforward, all my projects where developed using the OgreBaseArchitecture, which is an DLL and can be linked to applications.
This had also the effect, that the OgreBaseArchitecture had been extended bit by bit. Now a few years have passed since 2010 and the engine is still growing. I re-branded the name to NOWA-Engine (NativeObjectWorldArchitecture-Engine). NOWA is a word play for the same polish word, which means ‘new’. Put It in another words: from something old, something new emerges like a star that explodes in a nova creating something new.

The idea of the NOWA-Engine is to ease the development of games as far as possible, so the engine is as generic as possible.
Thus a lot of design patterns are used in the engine like Observer-, Eventing system with delegate functions, generic factory-, Composite-, State-, Strategy-, Singleton-, Null-Object-pattern, Curiously recurring template pattern etc.
The NOWA-Engine is intended for C++/lua developer and Designer with basic knowledge of the scripting language Lua.
The developer can concentrate on a higher level building a game without the need of taking care of lower level issues.
The NOWA-Engine became a hobby project and will be extended in future.

Update 2019.07.12: The NOWA-Engine has become monolytic over time and now has approx. 196307 lines of code (blank lines have been subtracted).

Contained components of the NOWA-Engines:

The NOWA-Engine is now used in a runtime virtual environment editor called NOWA-Design.

Feature videos of NOWA-Engine:

Performance NOWA-Engine:

A stress test with the NOWA-Engine and the NOWA-Design editor.

Scenario: Spawning lots of barels which are also physically simulated.

First test:

Ogre3D Threads 4, Newton Physics Threads 1: ~250 Barels FPS went down

Second test:

Ogre3D Threads 4, Newton Physics Threads 4: ~650 Barels FPS went down
Note: In the video the FPS went down earlier because of the additional resources consumption of the screen capturing tool.

See:

So what are the features of the NOWA-Engine:

  • Nearly full OgreNewt physics integration:
    • Static physics objects with complex collision, which can also be automatically serialized and deserialized, when something changed on the collision map for loading speedup. Also collision map for Ogre Terrain.
    • Dynamic physics objects: For motion and physics handling for severial kinds of collision types: Quader, Ellipsoid, Pyramid, Capsule, Cylinder, Convexhull, Cone, CompoundCollisionHull, etc.
    • Compositions: Compositions of dynamic physics objects to create more complex physics objects like connecting together a Convexhull with a Quader etc.
    • Convex compound collisions: Creating most complex active physical components composed of convex hulls, that are forming together a complex collision hull. E.g. creating gears and rings.
    • Constraints: (breakable) Hinge-, Slider-, Ball-And-Socket-, Motorized-, Screwcork-, CustomDryFriction-, Kinematic-, Pulley-, WormGear-, Spring-damping, Pin-Joints to constrain some motion behavior, e.g. creating breakable swing doors.
    • Ragdolls: Integration of ragdolls for game objects with bones.
    • Vehicle: Integration of vehicles to controll cars etc. (Unfinished)
    • Category system to group kinds of physics objects together to perform collision behavior of game objects of different categories, ray casts.
    • Physics material pairs to combine two different categories to specify physics behavior on collision, like creating a trampolin, on which a game object may jump higher.
    • Buoyancy integration for motion behavior of game objects in liquid.
    • Motion constraints: Its possible to constraint axes for a object. E.g. eliminating the z-axis could be useful for 2D Jump’ n’ Run games, in which the physics just works for x- and y-axis.


  • General:
    • The NOWA-Engine uses a state system to create own levels, menues etc.
    • Generic GameObject factory, to create GameObjects, which are composed of several components, like physics component, shader component etc.
    • It uses Ogre2.x version and “Physically Based Shading” (PBS) to keep pace with newest rendering techniques.
    • Event-Delegate system to ease the communcation between different modules.
    • Process system to create chained events like explosion of bombs etc.
    • Different kinds of game loops (VSync restricted, unrestricted and adaptive).
    • MyGui layout.
    • Artificial Intelligence to integrate to game object, to move autonome, like seek, flee, move-path, flocking, arrive etc.
    • Ability to create navigation maps and obstacles for A* path finding.
    • GameObjectController: Database for gameobjects. Its possible to perform a lot of different queries, to receive the desired game objects.
    • Realtime camera manager, to specify camera behavior like base-, first-person, third-person camera and switch between the modes at runtime.
    • Game object name display above the head.
    • Skeleton visualizer to debug bones of game objects etc.
    • Animation fader, to interpolate between to animation to create a more realistic game object motion.
    • Camcorder to record and playback camera motions
    • Screenshot manager


  • Lua scripting:
    • Lua script integration, to write lua code and control game objects at runtime. Furthermore with the introduction of the LuaScriptComponent, possibility to code everything in Lua.
    • Build in console for scripting and logging.


  • Graphics:
    • Physically based shading (PBS) for realistic scene rendering and complex shadows.
    • Several predefinded workspaces: PBS, PBS and Skybox, PBS, Skybox and reflections.
    • Directional-, Spot- and Point-lights, which can be mixed.
    • Compositor effects for the screen like motion blur etc.
    • Water simulation, which can be connected with buoyancy for phyical water motion behavior of game objects.


  • Audio:
    • 3D Audio system to connect to game objects and states for sounds and music.


  • Editor:
    • Editor manager: Class container with a lot of functionalities like game objects manipulation via Gizmo, Undo/Redo, MyGUI integration etc. to create a runtime editor.
    • Picker: In order to grab and play with dynamic physics objects.


  • Resources:
    • A lot of free resources like meshes, animations, sounds, particle effects etc.


  • Networking:
    • Integration of server/client topology.
    • Replicating game objects like players statically by cloning GameObjects at realtime.
    • Efficient automatic dispatch of movements of game objects using the procedure “playout delays”.
    • Area of interest: Information about a game object will only be sent to other remote game objects, if there are in range.


    Whats still left:

    • A lot of things! Since my timewindow is small.
    • Instancing for collision objects.
    • Other constraints like magnets, pulley joint etc.
    • Planet systems


    Basics

    The most import piece is the GameObject. A GameObject represents a model in the scene. It contains mainly a position, orientation, scale and a mesh. A GameObject may be composed of so called Components. This is a really powerful design pattern. Because each Component comes with a specific behaviour. By adding Components to a GameObject, the GameObject will be armed with the functionality of the Components. Thus a GameObject knows its Components and each Component knows its GameObject (owner). Therefore a Component can also communicate via its owner with another Component. This design architecture prevents derivation explosion, as there is just the game object and a list of components.
    GameObjects are gathered by the GameObjectController. It keeps track of the lifecycle of GameObjects and has a lot of manipulation functionality. Like cloning GameObjects, query GameObjects, add categories of GameObjects to group them together for ray scene queries and physics materials. Its also possible to activate (heavy) game objects when player is in a certain range and deactivate when the player leaves the range.
    The next important piece is the DotSceneImportModule. The DotSceneImportModule is responsible for loading and parsing virtual environments described in XML. In order to save a virtual environment to XML, the DotSceneExportModule is used. In the past the Ogitor was used but it has been abandoned, as the Ogitor has being stopped developed.
    Hence yeah! Why not creating an own virtual environment editor??? Thus the NOWA-Design editor has been created for this task.

    At that time a GameObject can be combined with following components:

    • AiComponents: AiMoveComponent, AiMoveRandomlyComponent, AiPathFollowComponent, AiWanderComponent, AiFlockingComponent, AiRecastPathNavigationComponent, AiObstacleAvoidanceComponent, AiHideComponent
    • AiLuaComponent: Possibilty in Lua to describe ai states and behaviors.
    • AnimationComponent: GameObject can be animated (if skeleton does exist).
    • AnimationSequenceComponent: GameObject can be animated (if skeleton does exist) and several times animations can be played at once.
    • AreaOfInterestComponent: Component to react when a specifig game object category is in the range of this component. Reaction is also possible in a Lua script.
    • AttributesComponent: Custom attributes may be set for the game like energy, strength etc.
    • AttributesEffectComponent: A custom GameObject/Component property can be manipulated automatically at runtime.
    • BackgroundScrollComponent: Chosen background pictures can be scrolled automatically or depending on a GameObject position.
    • BillboardComponent: Component to place sprites, that are always orientated at the camera for visual effects.
    • CameraBehaviorBaseComponent: The base camera behavior, which can be controlled via mouse and keys.
    • CameraBehaviorThirdPersonComponent: The third person camera behavior, which will follow a GameObject.
    • CameraBehaviorFirstPersonComponent: The first person camera behavior, which will follow a GameObject.
    • CameraBehaviorFollow2DComponent: The GameObject 2D follow camera for 2D platformer games.
    • CameraComponent: This component is used, to control the camera or switch to a different camera.
    • CompositorEffectBloomComponent: Compositor bloom effect for post screen space effect.
    • CompositorEffectGlassComponent: Compositor glass effect for post screen space effect.
    • DatablockPbsComponent: With this component the visualization of a game object can be manipulated. The underlying technology is physically based shading.
    • DatablockUnlitComponent: With this component the visualization of a game object can be manipulated but without lighting.
    • DatablockTerraComponent: With this component the visualization of terra terrain can be manipulated.
    • DistributedComponent: Movable component, that is transmitted via network for synchronization amongst players.
    • ExitComponent: Level exit component. When reached, a new level will be loaded.
    • GameObjectTitleComponent: A game object title is shown with custom text.
    • InventoryItemComponent: Represents an inventory item, which can be added to/removed from inventory.
    • LightDirectionalComponent: Directional light
    • LightSpotComponent: Spot light
    • LightPointComponent: Point light
    • LightAreaComponent: Area light, which can be used in conjunction with a picture to create a rectangular pattern light.
    • LineComponent: Creates a line at a specifig start and end position, can also be attached to one or two GameObjects.
    • LookAfterComponent: A bone can be choosen like the neck, so that the game object will look at a specifig target.
    • LuaScriptComponent: Creates a lua script for the GameObject, that uses this component, so that the designer/developer may program complex behaviors.
    • MoveMathFunctionComponent: Moves a GameObject according to a specified math function.
    • MyGUIWindowComponent: Creates an UI Window widget.
    • MyGUITextComponent: Creates an UI Textedit widget.
    • MyGUIButtonComponent: Creates an UI button widget.
    • MyGUICheckBoxComponent: Creates an UI Checkbox widget.
    • MyGUIImageBoxComponent: Creates an UI Imagebox widget.
    • MyGUIProgressBarComponent: Creates an UI Progressbar widget.
    • MyGUIListBoxComponent: Creates an UI Listbox widget.
    • MyGUIComboBoxComponent: Creates an UI Combobox widget.
    • MyGUIItemBoxComponent: Creates an UI Itembox widget, which acts as an inventory.
    • MyGUIPositionControllerComponent: Creates a position controller in order to create an animation effect for an UI widget.
    • MyGUIFadeAlphaControllerComponent: Creates controller in order to create a fade effect for an UI widget.
    • MyGUIScrollingMessageControllerComponent: Creates controller in order to create a scrolling effect for an UI widget.
    • MyGUIEdgeHideControllerComponent: Creates controller in order to hide parts of an UI widget.
    • MyGUIRepeatClickControllerComponent: Creates controller in order simulation a widget click.
    • NavMeshComponent: A*-navigation component, which is used as obstacle, so that the path is computed around the obstacle.
    • NodeComponent: This component can be used as placeholder for positions and orientations for other components, like the path follow component or node track component.
    • NodeTrackComponent: Node animation track component, which does work with NodeComponents for animation pathes.
    • ParticleUniverseComponent: Used for particle effects
    • PhysicsActiveComponent: Physics component that is dynamic and uses law of forces.
    • PhysicsActiveKinematicComponent: Physics component that is dynamic and uses law of forces, but has no effect when colliding with other GameObjects.
    • PhysicsActiveCompoundComponent: Active physics component, that is build of several collision pieces, forming a more complex collision hull, like a ring.
    • PhysicsCompoundConnectionComponent: Active physics component, that is build of several components, forming a more complex collision hull.
    • PhysicsMaterialComponent: Used to connect to physics groups together and adding specifig physics materials like elasticity, friction, conveyor and even Lua callbacks when a physics collision occured, to react in Lua.
    • PlayerControllerComponents: PlayerController3DComponent, PlayerControllerClickToPointComponent (unfinished)
    • PhysicsActiveDestructableComponent
    • PhysicsArtifactComponent: Physics component, that will never be moved. Collision hull may be complex like buildings etc.
    • PhysicsBuoyancyComponent: Physical fluid behavior
    • PhysicsExplosionComponent
    • PhysicsRagdollComponent: Physics component, that is described in a XML file forming a physics ragdoll of a game object, that has a skeleton.
    • PhysicsTerrainComponent: Physics component, that creates a collision hull for terra terrain.
    • PhysicsTriggerComponent: Physics component, that notifies the developer, when another GameObject has triggered this component.
    • PlanarReflectionComponent: Creates a planar reflection effect.
    • PlayerControllerJumpNRunComponent: Is used to help creating a jump ‘n’ run game.
    • PlayerControllerJumpNRunLuaComponent: Is used to help creating a jump ‘n’ run game. Can only be used in conjunction with LuaScriptComponent.
    • PlayerControllerClickToPointComponent: Is used to help creating a click to point game.
    • ProceduralPrimitiveComponent: Creates a new mesh primitive (Box, RoundedBox, Capsule, Sphere, Cone, Cylinder, Tube, Prism, IcoSphere, Spring, Torus, TorusKnot, Plane).
    • ProceduralBooleanComponent: Applies a boolean operation between two primitives from ProceduralPrimitiveComponent.
    • RibbonTrailComponent: Component for special effects like trails
    • SimpleSoundComponent: Sound component, that 5.1 dolby surround.
    • SpawnComponent: This component is able, to produce other game objects with all its components.
    • TagPointComponent: Component, with which other game objects can be attached to a bone, e.g. holding a weapon.
    • TagChildNodeComponent: Component, with which a game object’s node is attached as a child. E.g. attaching a light to another game object, to follow the object.
    • TerraComponent: Creates terra terrain.
    • TimeLineComponent: Allows creating an effect at a specifig time.
    • TimeTriggerComponent: Component which activates other components at a specifig time.
    • TransformComponent: Transformers a GameObject (position, rotation, scale) during runtime.
    • PlaneComponent: With this component a floor or walls can be created.

    Physics Components can also be connected together with joints (constraints). This joints are managed by so called JointComponents. The following JointComponents types are available:

    • JointHingeComponent
    • JointHingeActuatorComponent
    • JointBallAndSocketComponent
    • JointPointToPointComponent
    • JointPinComponent
    • JointPlaneComponent
    • JointSpringComponent
    • JointAttractorComponent
    • JointCorkScrewComponent
    • JointPassiveSliderComponent
    • JointSliderActuatorComponent
    • JointSlidingContactComponent
    • JointActiveSliderComponent
    • JointMathSliderComponent
    • JointKinematicComponent
    • JointPathFollowComponent
    • JointDryRollingFrictionComponent
    • JointGearComponent
    • JointRackAndPinionComponent
    • JointWormGearComponent
    • JointPulleyComponent
    • JointUniversalComponent
    • JointUniversalActuatorComponent
    • Joint6DofComponent

    A joint can also be released, e.g. to simulate breakable joints (see PhysicsActiveDestructableComponent).

    Physics Components can also have physics materials. With this material component the physical behaviour between groups of physics components is specifed. E.g. whether a GameObject of the category ‘vehicle’ will have a high friction with the GameObject of the category ‘ground’ etc. The following material attributes are available:

    • MaterialFriction
    • MaterialSoftness
    • MaterialElasticity
    • MaterialSurfaceThickness
    • MaterialCollideable
    • MaterialContinousCollisionMode
    • MaterialContactBehaviour (ConveyorPlayer, ConveyorObject)

    The NOWA-Engine comes with a lot of helper modules, which support GameObject, Components etc. by its tasks. A module can be a Singleton when it does make sense, but not every module is one. The following modules can be listed:

    • LuaScriptModule (Singleton)
    • OgreALModule (Singleton)
    • OgreNewtModule (Singleton)
    • OgreRecastModule (no Singleton)
    • ParticleUniverseModule (Singleton)
    • RakNetModule (Singleton)
    • WorkspaceModule (no Singleton)
    • GameProgressModule (Singleton)

    Sources:

  • SourceForge
  • back