同步操作将从 Gitee 极速下载/Turbulenz 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
Turbulenz is an HTML5 game engine and server-side APIs available in JavaScript and TypeScript for building and distributing 2D and 3D games that run on platforms that support HTML5 features such as modern browsers without the need for plugins.
Graphics
Math
Physics
3D
2D
Sound
Networking
Input
Scene Graph
Animation
Resource Manager
Server Requests
Deferred Renderer
Forward Renderer
Default Renderer
Simple Renderer
2D Rendering
Draw2D
Canvas2D
Utilities
Leaderboards
Badges
Payments
Userdata
Userprofile
Gameprofile
Multiplayer
Datashares
Notifications
Metrics
Bridge
Utilities
The main design goals of the Turbulenz Engine are performance, modularity and customizability. Users of the engine should be able to build any kind of game without limitations, in an efficient manner and with an end product that performs optimally when loading and during play.
To achieve this target the Turbulenz team followed these rules when writing code:
Modularity
High performance
Asynchronous loading
Data driven
Simple well documented file formats
Scalability
Power without control is nothing
Fault tolerant
Fast loading
Maintainability
Targeted
The Engine was created and is maintained by Turbulenz Limited and was open sourced in April 2013.
The latest release is 1.3.2 which is tagged in the repository or a tarball/zip can be can be downloaded from here
A full history of changes can be found in the Changelog
The pre-requisites for the open source version of the Turbulenz Engine allowing you to use the various commands are
Python 2.7.x.
python2.7
C:\Python27\python.exe
You can check your version with
$ python --version Python 2.7.3
VirtualEnv - version 1.9.1 or higher recommended You can check your version with
$ virtualenv --version 1.9.1
UglifyJS, turbulenz_build, DefinitelyTyped and NvTriStrip which are included via Git submodules contained within the Turbulenz Engine repository.
Additional Python packages which will be automatically installed during the initial environment creation using a Python package manager.
Pre-requisites for building the tools cgfx2json and NvTriStrip via python manage.py tools
sudo
apt-get install libgl1-mesa-dev
), for other linux distributions find the package supplying GL/gl.h and libGL.soThere are two ways to get up and running with the Turbulenz Engine, you can downloaded a packaged fully QA'd snapshot release from the Turbulenz Hub. These installers are available for Windows, Mac OSX and Linux and will install all the required packages and dependencies to get started, a full guide can be found at http://docs.turbulenz.com/installing.html
Note: SDK versions prior to 0.26.0 were released under a non open source license.
If you want to run with the latest version or would like to contribute to the open source project the steps for getting setup are included below. Use of the open source repository is tested against Windows, Mac OSX and Linux but may also work on other unix-like operating systems.
Clone the repository http://github.com/turbulenz/turbulenz_engine (or if you wish you can fork the repository on GitHub and clone that). To clone the repository maintained by Turbulenz use
$ git clone git://github.com/turbulenz/turbulenz_engine.git
The Turbulenz Engine submodules the following technology in the external folder
Initialize the Git submodules with
$ git submodule update --init
Check you have the pre-requisites installed
From the cloned repository create a VirtualEnv environment to install the required Python packages and NodeJS, allowing you to use all the features of the Turbulenz Engine. Note if Python is not on your shell's path you will need to specify the full path for this first command.
$ python manage.py env
Activate the environment in your shell.
$ source env/bin/activate - for bash and similar shells > env\scripts\activate.bat - for Windows
If you want to move onto the API tutorial section next then your final command is to build the JavaScript sources from the TypeScript sources. The next section will detail some of the additional actions you can perform or you can move onto Getting Started With The API
$ python manage.py jslib
The manage.py script at the top level of the repository provides a set of commands for managing the Engine, the
script should be run as python manage.py command
on Windows but can usually be shortcut to ./manage.py command
on unix shells. Running the script with --help
will give a list of commands available, most of these are
described below. All the commands other than the env command expect to have the VirtualEnv environment activated
as described in the setup section.
JavaScript Sources - The Turbulenz Engine source is written in TypeScript. To generate the JavaScript version of the engine source run the command
$ python manage.py jslib
Tools - The Turbulenz Engine includes a number of Python tools which are installed during the env command. In addition the Engine includes a CGFX shader conversion tool which can be built with the following command. See the pre-requisites section for details of required compiler toolchains.
$ python manage.py tools
Documentation - The Turbulenz Engine documentation is based on restructured text sources. To build the html documentation run the command
$ python manage.py docs
Samples - Various samples are included with the Turbulenz Engine. These can be built from their TypeScript sources with the command below. This generates a set of html files, JavaScript and asset JSON files which can be served with a web server such as the Turbulenz Local Development Server.
$ python manage.py samples
Applications - The Turbulenz Engine project includes a few larger applications and some templates for building your own application. These can be found in the apps folder, and can be built with the command
$ python manage.py apps
You can also build individual apps by specifying their name e.g.
$ python manage.py apps multiworm
Command Line Tools - Various command line tools for processing code and assets are installed as part of the
virtual environment. These are available at the command line e.g. running dae2json
will execute the dae2json
tool used to convert Collada assets to a Turbulenz Engine JSON asset format. See the
tools section in the documentation for more details on the tools.
Local Development Server - Setting up the environment also includes a locally hosted web server which can be used for development of HTML5 games and applications. See the Local Server repository for more details.
To try the Turbulenz APIs requires only a text editor and a browser such as Google Chrome or Mozilla Firefox. Create an HTML file with the following content and place it in the root of the Turbulenz directory:
<html> <head> <title>Turbulenz - API - Clear Screen Example</title> <script src="jslib/debug.js"></script> <script src="jslib/webgl/turbulenzengine.js"></script> <script src="jslib/webgl/graphicsdevice.js"></script> </head> <body> <canvas id="canvas" width="640px" height="480px"/> <script> TurbulenzEngine = WebGLTurbulenzEngine.create({ canvas: document.getElementById("canvas") }); var graphicsDevice = TurbulenzEngine.createGraphicsDevice({}); var bgColor = [1.0, 1.0, 0.0, 1.0]; function update() { if (graphicsDevice.beginFrame()) { graphicsDevice.clear(bgColor, 1.0); graphicsDevice.endFrame(); } } TurbulenzEngine.setInterval(update, 1000 / 60); </script> </body> </html>
After defining a <canvas> element of 640x480 pixels, this code will create the TurbulenzEngine and request the GraphicDevice module. Using an update function called at a frequency of 60fps, the GraphicsDevice will clear the screen yellow. To run the example, open the HTML file in your browser. You should see a yellow rectangle.
To use assets such as images you will need to host a HTML file and assets on a webserver. Any webserver will work, a quick way to try is to activate the Turbulenz environment in the root of the Turbulenz directory and run:
python -m SimpleHTTPServer
This command will host the contents of the Turbulenz directory on your machine as a webserver.
To demonstrate loading an asset you can try loading an image file and drawing it as a textured sprite using the Draw2D API. Create another HTML file with the following content and also place it in the root of the Turbulenz directory:
<html> <head> <title>Turbulenz - API - Textured Sprite Example</title> <script src="jslib/debug.js"></script> <script src="jslib/webgl/turbulenzengine.js"></script> <script src="jslib/webgl/graphicsdevice.js"></script> <script src="jslib/draw2d.js"></script> </head> <body> <canvas id="canvas" width="640px" height="480px"/> <script> TurbulenzEngine = WebGLTurbulenzEngine.create({ canvas: document.getElementById("canvas") }); var graphicsDevice = TurbulenzEngine.createGraphicsDevice({}); var draw2D = Draw2D.create({ graphicsDevice: graphicsDevice }); var bgColor = [1.0, 1.0, 0.0, 1.0]; var sprite = Draw2DSprite.create({ width: 100, height: 100, x: graphicsDevice.width / 2, y: graphicsDevice.height / 2, color: [1.0, 1.0, 1.0, 1.0], rotation: Math.PI / 4 }); var texture = graphicsDevice.createTexture({ src: "assets/textures/crate.jpg", mipmaps: true, onload: function (texture) { if (texture) { sprite.setTexture(texture); sprite.setTextureRectangle([0, 0, texture.width, texture.height]); } } }); var PI2 = Math.PI * 2; var rotateAngle = PI2 / 360; // 1 deg per frame function update() { sprite.rotation += rotateAngle; sprite.rotation %= PI2; // Wrap rotation at PI * 2 if (graphicsDevice.beginFrame()) { graphicsDevice.clear(bgColor, 1.0); draw2D.begin(); draw2D.drawSprite(sprite); draw2D.end(); graphicsDevice.endFrame(); } } TurbulenzEngine.setInterval(update, 1000 / 60); </script> </body> </html>
This time, instead of opening the file in the browser, navigate your browser to http://127.0.0.1:8000 or http://localhost:8000 and select the HTML file you created. You should see a spinning textured box in the middle of a yellow rectangle.
The next step is render a simple textured mesh in 3D. To do this you will need to build some assets from their source files. Make sure you have run the tools command to build the tools for your platform:
$ python manage.py tools
Note: The requirements for building the tools is different per platform. See the Pre-Requisites section.
For this example you should use the Protolib library, which is ideal for prototyping games using Turbulenz. You will need these assets:
- models/duck.dae - textures/duck.png - textures/default_light.png - shaders/shadowmapping.cgfx - shaders/zonly.cgfx - shaders/forwardrendering.cgfx - shaders/forwardrenderingshadows.cgfx - shaders/debug.cgfx - shaders/font.cgfx - shaders/simplesprite.cgfx - fonts/opensans-8.fnt - fonts/opensans-16.fnt - fonts/opensans-32.fnt - fonts/opensans-64.fnt - fonts/opensans-128.fnt - textures/opensans-8_0.png - textures/opensans-16_0.png - textures/opensans-32_0.png - textures/opensans-64_0.png - textures/opensans-128_0.png
Copy this text into a file called "deps.yaml" and place it in the root of the Turbulenz directory. Having built the tools you can now run this command with the Turbulenz environment activated:
$ python scripts/buildassets.py --root . --assets-path assets
This will build the assets listed in the deps.yaml and output a "staticmax" directory and "mapping_table.json" file containing the processed assets and a mapping to them for the webserver. When a library tries to request one of these files, it will be able to find it in the staticmax directory. Now you can create the mesh example HTML file and place it at the root of the Turbulenz directory:
<html> <head> <title>Turbulenz - API - Textured Mesh Example</title> <script> var TurbulenzEngine = {}; </script> <script src="jslib/debug.js"></script> <script src="jslib/vmath.js"></script> <script src="jslib/webgl/turbulenzengine.js"></script> <script src="jslib/webgl/graphicsdevice.js"></script> <script src="jslib/webgl/inputdevice.js"></script> <script src="jslib/webgl/sounddevice.js"></script> <script src="jslib/webgl/mathdevice.js"></script> <script src="jslib/aabbtree.js"></script> <script src="jslib/assettracker.js"></script> <script src="jslib/camera.js"></script> <script src="jslib/draw2d.js"></script> <script src="jslib/effectmanager.js"></script> <script src="jslib/fontmanager.js"></script> <script src="jslib/forwardrendering.js"></script> <script src="jslib/geometry.js"></script> <script src="jslib/indexbuffermanager.js"></script> <script src="jslib/light.js"></script> <script src="jslib/loadingscreen.js"></script> <script src="jslib/material.js"></script> <script src="jslib/observer.js"></script> <script src="jslib/renderingcommon.js"></script> <script src="jslib/requesthandler.js"></script> <script src="jslib/resourceloader.js"></script> <script src="jslib/scene.js"></script> <script src="jslib/scenenode.js"></script> <script src="jslib/shadermanager.js"></script> <script src="jslib/shadowmapping.js"></script> <script src="jslib/soundmanager.js"></script> <script src="jslib/texturemanager.js"></script> <script src="jslib/utilities.js"></script> <script src="jslib/vertexbuffermanager.js"></script> <script src="jslib/services/turbulenzbridge.js"></script> <script src="jslib/services/turbulenzservices.js"></script> <script src="jslib/services/gamesession.js"></script> <script src="jslib/services/mappingtable.js"></script> <script src="protolib/duimanager.js"></script> <script src="protolib/jqueryextend.js"></script> <script src="protolib/simplesprite.js"></script> <script src="protolib/simplefonts.js"></script> <script src="protolib/simplesceneloader.js"></script> <script src="protolib/debugdraw.js"></script> <script src="protolib/sceneloader.js"></script> <script src="protolib/soundsourcemanager.js"></script> <script src="protolib/protolib.js"></script> </head> <body> <canvas id="canvas" width="640px" height="480px"/> <script> TurbulenzEngine = WebGLTurbulenzEngine.create({ canvas: document.getElementById("canvas") }); var mathDevice = null; var mesh = null; var rotationMatrix = null; var rotationAngleMatrix = null; var protolib = Protolib.create({ onInitialized: function onIntializedFn(protolib) { mathDevice = protolib.getMathDevice(); protolib.setCameraPosition(mathDevice.v3Build(0, 1, -2)); protolib.setCameraDirection(mathDevice.v3Build(0, 0, 1)); protolib.setAmbientLightColor(mathDevice.v3Build(1, 1, 1)); protolib.addPointLight({ v3Position: mathDevice.v3Build(-1, 1, -1), v3Color: mathDevice.v3Build(1, 1, 1), radius: 10 }); mesh = protolib.loadMesh({ mesh: "models/duck.dae" }); rotationMatrix = mathDevice.m43BuildIdentity(); rotationAngleMatrix = mathDevice.m43BuildIdentity(); mathDevice.m43SetAxisRotation(rotationAngleMatrix, mathDevice.v3Build(0, 1, 0), (Math.PI * 2) / 360); } }) function update() { if (protolib.beginFrame()) { if (mesh) { mesh.getRotationMatrix(rotationMatrix); mathDevice.m43Mul(rotationMatrix, rotationAngleMatrix, rotationMatrix); mesh.setRotationMatrix(rotationMatrix); } protolib.endFrame(); } } TurbulenzEngine.setInterval(update, 1000 / 60); </script> </body> </html>
This file is quite similar to the previous examples, but it requires a few more Turbulenz libraries to run. This time you should see a spinning duck with a yellow texture on a white background and lit by a static point light.
For more information on how to build your own assets see the assets section in the getting started guide.
If you would like to learn more or work through this example step-by-step (with troubleshooting hints), see the Getting Started Guide in the documentation.
For more information on the various APIs, see the following links:
Full documentation for the Turbulenz Engine can be found at http://docs.turbulenz.com/index.html
This documentation is built from the source restructured text in the docs/source folder of the repository, the latest
version online is maintained from the latest release tag in the repository. If you wish to build up to date
documentation follow the setup guide and the run the manage.py docs
command, this will generate html docs in the
build/docs/html folder.
The following known issues exist with using the open source repository version of the Turbulenz Engine, additional known issues also existing in the SDK releases of the engine can be found here http://docs.turbulenz.com/known_issues/index.html
The Turbulenz Engine is licensed under the MIT license
Our contributors are listed here
Contributions are always encouraged whether they are small documentation tweaks, bug fixes or suggestions for larger changes. You can check the issues or discussion forums first to see if anybody else is undertaking similar changes.
If you'd like to contribute any changes simply fork the project on Github and send us a pull request or send a Git patch to the discussion forums detailing the proposed changes. If accepted we'll add you to the list of contributors.
We include a .pylintrc file in the repository which allows you to check your code conforms to our standards. Our documentation is built from restructured text sources in the docs folder so please consider how your changes may affect the documentation.
Note: by contributing code to the Turbulenz Engine project in any form, including sending a pull request via Github, a code fragment or patch via private email or public discussion groups, you agree to release your code under the terms of the MIT license that you can find in the LICENSE file included in the source distribution.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。