U3D
Open-source, cross-platform 2D and 3D game engine built in C++
Loading...
Searching...
No Matches
Examples

The examples included with Urho3D consist of two larger applications built in AngelScript, and a set of smaller sample applications provided in both C++, AngelScript and Lua, which demonstrate a specific engine feature.

NinjaSnowWar

The first of the larger examples is a third-person action game. To start, run NinjaSnowWar.bat or NinjaSnowWar.sh in the bin directory, or use the command Urho3DPlayer Scripts/NinjaSnowWar.as

Key and mouse controls:

WSAD        Move
Left mouse  Attack
Space       Jump
ESC         Exit
F1          Toggle console
F2          Toggle profiling display
F3          Toggle physics debug geometry
F4          Toggle octree debug geometry
F5          Toggle event profiling display

If a joystick is connected, it can also be used for controlling the player character.

NinjaSnowWar also supports client/server multiplayer. To start the server, run the command NinjaSnowWar.bat -server (-headless option can optionally given so that the server will not open a graphics window.) To connect to a server, specify the option -address followed by the server address (for example -address 127.0.0.1). Optionally set client username with the option -username, followed by the desired name. Use -nobgm option to switch music off.

Editor

The second larger example is a scene and UI layout editor application written in script. To start, run Editor.bat or Editor.sh, or use the command Urho3DPlayer Scripts/Editor.as

For details on how to use the editor, see Editor instructions.

Sample applications

The sample applications start from the very simple (a "Hello World" program) and progress to demonstrate more complex engine features. The code is heavily commented and should be easy to follow for learning. The applications display on-screen instructions when run.

The AngelScript and Lua versions reside in the bin/Data/Scripts and bin/Data/LuaScripts directories. Batch files to run each of them are not provided due to their large amount: instead run the player application with the script file name as the parameter, for example Urho3DPlayer Scripts/01_HelloWorld.as

The C++ versions need to be explicitly enabled in the build with the CMake option -DURHO3D_SAMPLES=1. When enabled, the executables will be produced into the bin directory and can be run from there. Their source code is in the Source/Samples directory.

The samples provide the following common key controls:

ESC         Exit
F1          Toggle console
F2          Toggle debug HUD
1           Cycle texture quality
2           Cycle material quality
3           Toggle specular lighting
4           Toggle shadow rendering
5           Cycle shadow resolution
6           Cycle shadow filtering quality
7           Toggle occlusion culling
8           Toggle dynamic instancing
9           Take a screenshot and save to the Data directory