===================== Turbulenz Game Engine ===================== The Turbulenz Game Engine provides solutions for the development of next generation quality games playable directly in the browser. The technology is organized in two main blocks: - **Runtime**: executed on the final user machine - **Offline**: used only during development of the game This section gives an overview of these two areas of functionality as well as some recommendations and guidelines for developing games for the browser. .. ------------------------------------------------------------ -------------------- Runtime API Overview -------------------- The runtime may be broadly categorized into two types of code: - **Low-level API**: A set of interfaces providing access to low-level functionality. The APIs at this level are similar in functionality to known APIs such as OpenGL, OpenAL, etc. This functionality is provided either by the Turbulenz browser extensions (native code), or by a thin wrapper on top of interfaces provided by the browser (such as WebGL, WebAudio, etc). In the second case, the Turbulenz API will determine which interfaces the browser provides and dynamically select the most appropriate. - **High-level API**: a collection of JavaScript libraries that built on top of the Low-level APIs that provide developers with features such as a Scene Graph, Material System, Forward and Deferred Renderers, etc. Low-level API ------------- The interface consists of several modules called *Devices*, providing: - Efficient interface on top of existing stable and flexible libraries, for example Bullet, OpenAL or WebGL. - Efficient interface on top of low level hardware access, for example the input mechanisms or vector math operations. These Devices are not limited to specific kinds of games, they are powerful enough and flexible enough to cover next generation game requirements. *Device* objects are usually created once by passing a parameters object to *create* functions on the :ref:`TurbulenzEngine ` global object. Once created they can later be retrieved by calling the corresponding *get* functions. See, for example, :ref:`tz_creategraphicsdevice` and :ref:`tz_getgraphicsdevice`. :ref:`GraphicsDevice ` - Simple shader-based immediate mode API. - A Shader may contain multiple Techniques, either single or multi-pass. - Once a shader Technique is set on the Device, the parameters required by the program code can be updated by a TechniqueParameter object. - TechniqueParameter objects hold multiple references to Textures, TechniqueParameterBuffers or individual values. - Multiple TechniqueParameters can be set on the Device at once. - Vertex buffers, Index buffers and Textures can be created, updated and destroyed dynamically. - Multiple Streams of Vertex buffers can be used at the same time. - Support for 1D, 2D, 3D and Cube textures. - Any pixel format supported by the hardware. - Asynchronous resource loading. - Multiple resource files can be downloaded on the fly, JavaScript code will be notified when resource is available for usage. - Multiple image file formats. - DDS, JPG, PNG and TGA. - Support for textures archives containing multiple image files. - Less flexibility than individual files but better for optimal bandwidth usage. - Occlusion queries. - Number of pixels rendered can be queried for a section of rendering. - Available in plugin mode only. - Fullscreen support (Supported platforms). - Take screenshot feature. - Video playback support. - WebM, MP4. - Render video as texture. - Playback controls play, pause, stop, resume, rewind. :ref:`MathDevice ` - Math types: - *Vector2* *Vector3*, *Vector4* - *Matrix33*, *Matrix34*, *Matrix43*, *Matrix44* - *Quaternion*, *QuatPos* - *AABB* - Storage format optimized based on available support - Optimized operations support *destination parameters*, reducing object allocation. - Array to/from Math type conversion utilities. :ref:`PhysicsDevice ` **3D** - Easy-to-use efficient physics simulation. - Optimized JavaScript implementation. - In plugin mode, this is a lightweight wrapper around the Bullet Physics Library. - http://bulletphysics.org/wordpress/ - Rigid bodies and collision objects. - Plane, Box, Sphere, Capsule, Cylinder, Cone, Triangle Mesh, Convex Hull. - Constraints. - Point to Point, Hinge, Cone Twist, 6DOF, Slider. - Ray and convex sweep queries. - Returning closest point of impact and surface normal. - Character representation. - For use with 1st/3rd person games. - Includes properties for velocity, position, crouch, jump height, death, on ground. - Contact callbacks. - Rigidbodies, characters, collision objects. - Called on presolve, added, processed, removed. - Filter responses by mask. - Triggers with no collision response. .. NOTE:: Developers may see slightly different behavior across the plugin and canvas implementations of :ref:`PhysicsDevice `. **2D** - Efficient 2D physics simulation written specifically for JavaScript. - Shapes. - Circle, Box, Rectangle, Regular Polygon, Custom Polygon. - Create shapes as sensors. - Shape grouping and mask interactions. - Collision detection. - Sweep & Prune, Box Tree Broadphases. - Utilities for Raytest, Signed Distance, Intersection, Contains Point, Sweep Test. - Simulation world. - Multiple simulation groups. - Optional gravity. - Customisable simulation iterations. - Rigid body simulation. - Dynamic, Static, Kinematic objects. - Materials. - Elasticity, Static/Dynamic/Rolling Friction, Density. - Arbiters. - Contact grouping. - Contact information: Position, Penetration, Normal/Tangent Impulse - Constraints. - Point to Point, Distance, Weld, Angle, Motor, Line, Pulley, Custom Constraint. - Debug rendering. - Rigid Bodies, Constraints, Worlds, Lines, Curves, Rectangles, Circles, Spirals, Linear/Spiral Springs. - Enabling and disabling of rendering types. - Scaling for Draw2D viewport. :ref:`SoundDevice ` - Easy-to-use efficient wrapper of hardware audio features. - Utilizes Web Audio,