Cross-platform 2D and 3D game engine.

Overview

Urho3D logo

Urho3D

CI/CD Coverity Scan Build Status

Urho3D is a free lightweight, cross-platform 2D and 3D game engine implemented in C++ and released under the MIT license. Greatly inspired by OGRE and Horde3D.

Main website: https://urho3d.github.io/

License

Licensed under the MIT license, see LICENSE for details.

Contributing

Before making pull requests, please read the Contribution checklist and Coding conventions pages from the documentation.

Credits

Urho3D is greatly inspired by OGRE (http://www.ogre3d.org) and Horde3D (http://www.horde3d.org). Additional inspiration & research used:

Urho3D uses the following third-party libraries:

DXT / PVRTC decompression code based on the Squish library and the Oolong Engine. Jack and mushroom models from the realXtend project. (https://www.realxtend.org) Ninja model and terrain, water, smoke, flare and status bar textures from OGRE. BlueHighway font from Larabie Fonts. Anonymous Pro font by Mark Simonson. NinjaSnowWar sounds by Veli-Pekka Tätilä. PBR textures from Substance Share. (https://share.allegorithmic.com) IBL textures from HDRLab's sIBL Archive. Dieselpunk Moto model by allexandr007. Mutant & Kachujin models from Mixamo. License / copyright information included with the assets as necessary. All other assets (including shaders) by Urho3D authors and licensed similarly as the engine itself.

Documentation

Urho3D classes have been sparsely documented using Doxygen notation. To generate documentation into the "Docs" subdirectory, open the Doxyfile in the "Docs" subdirectory with doxywizard and click "Run doxygen" from the "Run" tab. Get Doxygen from http://www.doxygen.org & Graphviz from http://www.graphviz.org. See section "Documentation build" below on how to automate documentation generation as part of the build process.

The documentation is also available online at https://urho3d.github.io/documentation/HEAD/index.html

Documentation on how to build Urho3D: https://urho3d.github.io/documentation/HEAD/_building.html Documentation on how to use Urho3D as external library https://urho3d.github.io/documentation/HEAD/_using_library.html

Replace HEAD with a specific release version in the above links to obtain the documentation pertinent to the specified release. Alternatively, use the document-switcher in the documentation website to do so.

History

The change history is available online at https://urho3d.github.io/documentation/HEAD/_history.html

Issues
  • PBR Major improvements

    PBR Major improvements

    A small commit that improves the quality of the current PBR implementation. Changes include Gamma correction to ensure the color and brightness of materials. I also made some changes to the demo scene that includes, pre-filtered skybox and zone texture along with a new floor texture that prefer.

    enhancement 
    opened by PlasmaDev5 102
  • Possibility to choose Graphics backend at runtime

    Possibility to choose Graphics backend at runtime

    Would be nice to separate graphics backend and allow the possibility to choose on Windows platform DirectX, OpenGL or even Vulkan in the future, now we can compile only one backend per library.

    enhancement feature request 
    opened by amerkoleci 102
  • kNet replaced with SLikeNet (RakNet fork)

    kNet replaced with SLikeNet (RakNet fork)

    • Existing functionality that has been provided by kNet is still available.
    • Added NAT punchtrough functionality.
    • Added LAN discovery
    • Added client-server authentication (clients can connect only with password if server has enabled it)
    • Angel script bindings added to support new functionality

    Things still in my to-do list:

    • Add samples for LAN discovery
    • Add samples for NAT punchtrough
    • Do code cleanup & style fixes
    • Add github wiki documentation later to describe new functionality
    enhancement 
    opened by ArnisLielturks 90
  • Autobinding enums for AngelScript

    Autobinding enums for AngelScript

    I need feedback from @weitjong about building system. I'm not sure I made right changes in CMake configuration files. I just made it work somehow.

    I have version with automatic generation classes and functions, but code still dirty, so I PR minimal version which binds only enums to get tips about the build system.

    But this minimal version may also be useful, as it fixes some detected problems with existing bindings (MouseButton incomplete, TileObjectType2D instead TileMapObjectType2D, etc)

    With URHO3D_GENERATEBINDINGS=1:

    1. Call doxygen to generate XMLs
    2. Build https://github.com/1vanK/Urho3D/tree/master/Source/Tools/BindingGenerator
    3. Generate https://github.com/1vanK/Urho3D/blob/master/Source/Urho3D/AngelScript/Generated.cpp
    4. Build engine

    Some notes:

    1. Automatically binds all enums from Urho3D namespace
    2. Ignored header files need to specify in https://github.com/1vanK/Urho3D/blob/master/Source/Tools/BindingGenerator/Tuning.cpp
    3. Single ignored enums are marked in source code: https://github.com/1vanK/Urho3D/blob/master/Source/Urho3D/Graphics/GraphicsDefs.h#L116
    4. Manual written bindings which require special treatment: https://github.com/1vanK/Urho3D/blob/master/Source/Urho3D/AngelScript/Manual.cpp

    Problems:

    1. Currently XMLs and bindings is regenerated every time when engine is compiled. Not sure I can fix it. How force doxygen regenerate xmls only when engine source code is changed? I do not consider this a big problem, since in most cases users does not need to enable URHO3D_GENERATEBINDINGS at all. Generated.cpp already pregenerated and can be automatically generated by server side.
    2. Currently server does not send commit with changed Generated.cpp to repo.
    3. I do not touched existed URHO3D_BINDINGS option

    EDIT: Not sure static void GetXmlFiles(string dirPath, vector<string>& result) works under linux. I tested only Win version

    enhancement 
    opened by 1vanK 82
  • Nuklear

    Nuklear

    Initial work on Nuklear UI:

    I took https://github.com/rokups/Urho3D-nuklear-ui's work on Nuklear UI and moved it into the engine code.

    Having problems with migrating to pure urho3d graphics pipeline though. There's some commented code that shows where the progress is. The Nuklear UI code uses OpenGL 3 and only works on OpenGL 3.

    It is currently missing:

    • [x] urho3d graphics pipeline integration
    • [x] DirectX 11 integration.
    • [x] fonts
    • [x] maybe urho3d resource system for images

    If someone could help me with the graphics pipeline. It'll unstick me. Please look at 074e7b0699fd158f63bc6bd6070877d3aa0005d9.

    @yushli There's two samples here for Nuklear UI. One is the overview and the other is a node editor.

    opened by fire 76
  • For CI - setup Clang-tidy as the linter tool

    For CI - setup Clang-tidy as the linter tool

    It can be configured to use C++ Core Guidelines checks. A place holder Lint build stage has been added in our primary CI configuration for a few weeks already. The Clang-tidy has an auto fix it feature, if the corresponding check support it. So, in the background we can also use this tool to check and fix our code base. Initially we will the let the warnings in the CI passed but eventually once we have configured which checks we want to enforce and after our code base has passed those checks in flying colors then a flag will be switched on to treat the warning as error. That is, PRs and commits will be subjected to those checks automatically and only accepted when they produce no errors.

    enhancement build system 
    opened by weitjong 63
  • Fix problem with anomalies in point light shadows in OpenGL mode.

    Fix problem with anomalies in point light shadows in OpenGL mode.

    This pull request is a fix for issue reported in #2606

    The problem is caused by the bilinear texture sampling filter used on the cubemap used to index into the cube depthmap render for point lights. It seems that the default mode for cubemaps in desktop OpenGL implementations will sample textures across cubemap faces, but because the content of the indirectionCubeMap is positional information and therefore should not be interpolated across cube faces otherwise it results in shadow anomalies where the projections of edges of the light's cubemap hit the scene.

    Note that I have only implemented the ability to disable seamless cubemap mode for OpenGL as I do not experience the issue in DirectX9. I can only assume that in DirectX9 seamless cubemap sampling is disabled by default in DirectX9, and therefore not exhibiting the issue?

    opened by ChrisDenham 61
  • Emscripten shell

    Emscripten shell

    Current emscripten fullscreen functionality is broken, this is an attempt to fix it by using custom HTML shell and one additional JS to C++ function which tells the Engine current canvas size. The sample now uses all the available viewport in the browser to display the content and the canvas/renderer resolution is automatically updated on resize.

    @eugeneko @weitjong @Modanung @rokups and everyone else interested in this.

    Bugs:

    • [x] Mouse tracking and grabbing when switching browser tabs
    • [x] Wrong resolution detected in the browser
    • [x] Loading app in background tab doesn't detect input when tab is activated
    • [ ] Pointer lock is lost when canvas resizing happens, user must click on canvas to re-enable it
    • [x] UI cursor issues when resolution is changed
    • [x] UI cursor position wrong in 125% DPI screens
    enhancement 
    opened by ArnisLielturks 54
  • Bullet RaycastVehicle support

    Bullet RaycastVehicle support

    Hi!

    This is initial release of RaycastVehicle component, which is wrapping of Bullet btRaycastVehicle.

    Many features are missing, which will be added later. The commit contains C++ code and AngelScript + Lua binding. But there is no Lua demo yet. The component is not able to save/load yet (don't know how to do it).

    The purpose of this PR is to recieve feedback and review. Please remember that:

    It is my first submission and many things can be wrong. Please have patience and explain to me what is wrong, I'll be more than happy to fix all things. Especially coding style errors might happen. I'm from C/Linux kernel/MCU scenery and have very little (VERY little) C++ experience. So please comment on general design errors, if I'm doing something wrong in general. I have very little experience with gamedev, so I might do things not efficiently because of lack of experience. Please point me on these, I want to learn. The motivation behind this PR is current vehicle example is not that effective, and also very rigid. I can't spawn 100 cars and have no frame drop. However with this component I can run 100 cars without slowdowns. Also the flexibility is very good. And it is easier than making everything from scratch.

    The code is based on forum example by @Lumak edited and simplified by me to be minimal. I plan to implement all features provided by btRaycastVehicle and provide Lua demo too. Also I plan to do general cleanup.

    This video demonstrates abilities: https://youtu.be/LKjzcN3s65Y With particles: https://youtu.be/zC0iSozwiLM

    Sorry for spamming, but github did not allow me to reopen for some reason. A friend helped me to resove the issue with unreferenced symbols. This happens when btRaycastVehicle.h is included, so I had to reimplement RaycastVehicle class using opaque data, so no bullet headers are included with RaycastVehicle.h.

    Remaining items (working on till weekend (till April 24)):

    • [x] Remove CMAKE option, build with URHO3D_PHYSICS
    • [x] Update AngelScript API to accomodate C++ changes
    • [x] Update Lua API to accomodate C++ changes
    • [x] Add Lua demo
    • [x] Improve encapsulation (should not require wheel node hand-manipulation
    • [x] Resolve motor wheels not rotating if no ground contact (Bullet behavior, but it is very annoying)
    • [x] Fix save/load crash
    • [x] Implement wheel dust in demo (use @Lumak offroad vehicle code for this)
    • [x] Move component code to physics subdirectory
    • [x] Check coding style consistency (is there some automatic tool?)

    Well, current wheel handling code is adequate. The problem might arise when simulating vehicles with differentials, but I need to read more about this, but it could be implemented later. Wheel blocking by brakes can be easily implemented outside the component, as it is only a few lines and not needed to be put in FixedUpdate. So I put this on post merge "some time later" schedule.

    Sometimes later TODO:

    1. Block/slow down wheels on intense brakes (component code)
    2. Implement skids. (demo code)
    3. Implement side momentum (demo code)
    enhancement feature request 
    opened by slapin 48
  • Cannot create a new project for MSVC using CMake

    Cannot create a new project for MSVC using CMake

    Error when i press Configure

    The C compiler identification is MSVC 19.0.23026.0
    ...
    CMake Warning at CMake/Modules/Urho3D-CMake-common.cmake:128 (message):
      Could not use MKLINK to setup symbolic links as this Windows user account
      does not have the privilege to do so.  When MKLINK is not available then
      the build system will fallback to use file/directory copy of the library
      headers from source tree to build tree.  In order to prevent stale headers
      being used in the build, this file/directory copy will be redone also as a
      post-build step for each library targets.  This may slow down the build
      unnecessarily or even cause other unforseen issues due to incomplete or
      stale headers in the build tree.  Request your Windows Administrator to
      grant your user account to have privilege to create symlink via MKLINK
      command.  You are NOT advised to use the Administrator account directly to
      generate build tree in all cases.
    Call Stack (most recent call first):
      CMakeLists.txt:21 (include)
    
    
    CMake Error at CMake/Modules/FindUrho3D.cmake:322 (message):
      Could NOT find compatible Urho3D library in Urho3D SDK installation or
      build tree.  Use URHO3D_HOME environment variable or build option to
      specify the location of the non-default SDK installation or build tree.
      Change Dir: D:/MyGames/MiniGame/Build/CMakeFiles/CMakeTmp
    

    Cmake found libraries but not detect lib_type

    in condition

    if (URHO3D_INCLUDE_DIRS AND URHO3D_LIBRARIES AND URHO3D_LIB_TYPE AND URHO3D_COMPILE_RESULT)
    

    URHO3D_LIB_TYPE == "" URHO3D_COMPILE_RESULT == false

    Maybe the error occurred for a long time. Last time I used an empty VS project to start new project.

    wontfix build system 
    opened by 1vanK 45
  • BillboardSet::UpdateVertexBuffer optimization

    BillboardSet::UpdateVertexBuffer optimization

    Made the sine calculations there much faster in two steps. That brought the big loop there down from 22.03ms to 8.25ms and the total FPS from 20 to 24 in my test scene.

    wontfix 
    opened by damu 42
  • Dropping macOS support

    Dropping macOS support

    GitHub deprecated macOS 10.15 enveronment image https://github.com/actions/virtual-environments/issues/5583

    At the same time, our engine does not compile with macOS 11 image https://github.com/1vanK/Urho3D/runs/7651590372?check_suite_focus=true

    If someone is interested in supporting Apple's garbage, then he can send a PR

    backlog macos 
    opened by 1vanK 4
  • Segfault on SetModel in headless mode

    Segfault on SetModel in headless mode

    Trying to load and set Model or GetResource results in SegFault when there is no window open.

    I'm seeing this migrating from 1.7 to latest w/ my headless server app. This works on 1.8-tag but not on master (df3d93ce8). I'm willing to find the commit which introduced it if needed.

    How to reproduce: rake new [crash,tmpdir]. Create Setup func in .h and in .cpp use void crash::Setup() { engineParameters_ ["Headless"] = true; }.

    // This line will segfault when there is no window
    object->SetModel(cache->GetResource<Model>("Models/Mushroom.mdl"));
    
    [Tue Jul 19 21:17:06 2022] INFO: Initialized engine
    [Tue Jul 19 21:17:06 2022] DEBUG: Loading resource Models/Mushroom.mdl
    
    Thread 1 "rep-server" received signal SIGSEGV, Segmentation fault.
    __memmove_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:416
    416     ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S: No such file or directory.
    (gdb) bt
    #0  __memmove_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:416
    #1  0x00007ffff7a3d35e in __GI__IO_file_xsgetn (fp=0xda8870, data=<optimized out>, n=50640) at fileops.c:1304
    #2  0x00007ffff7a30ee3 in __GI__IO_fread (buf=0x0, size=50640, count=1, fp=0xda8870) at iofread.c:38
    
    opened by ProtonPunk 2
  • Dropping 32 bit support

    Dropping 32 bit support

    Motivation:

    1. Support of 32 bit is dropped almost everywhere
    2. Testing for both 32 and 64 bits requires extra effort
    3. Support of large files (> 4 gb). For example Cyberpunk uses 15 Gib file https://steamdb.info/depot/1091501/
    4. Problems with big cpp files. Latest mingw can not build 32 bit debug version even with hack https://github.com/urho3d/Urho3D/blob/master/Source/Urho3D/CMakeLists.txt#L31-L35
    backlog proposal 
    opened by 1vanK 1
  • ios crash

    ios crash

    I successfully compiled 01helloworld and ran it successfully on the simulator. But when I debug the app to the mobile phone, it will crash when it starts. The Internet says that I have no permission. I have tried my permission, but I still can't. is my permission wrong? Or other errors. The error messages are as follows:

    libsystem_kernel.dylib`__abort_with_payload: 0x21403f310 <+0>: mov x16, #0x209 0x21403f314 <+4>: svc #0x80 -> 0x21403f318 <+8>: b.lo 0x21403f338 ; <+40> 0x21403f31c <+12>: pacibsp 0x21403f320 <+16>: stp x29, x30, [sp, #-0x10]! 0x21403f324 <+20>: mov x29, sp 0x21403f328 <+24>: bl 0x2140151e0 ; cerror_nocancel 0x21403f32c <+28>: mov sp, x29 0x21403f330 <+32>: ldp x29, x30, [sp], #0x10 0x21403f334 <+36>: retab
    0x21403f338 <+40>: ret

    I have a headache and hope to get help.

    stale macos 
    opened by zxm1985 1
  • Use int for containers

    Use int for containers

    We use unsigned to store sizes and indices. If user write size1 - size2, then overflow occurs if size1 < size2. Those, sizes still need to be converted to int before being used in calculations, and user can easily forget about it

    Cycle for (unsigned i = 9; i >= 0; i--) will never stop, because i >= 0 is always true. User can workaround this in many ways, but why? Again, this is an additional source of error.

    We disable warning to allow using cycles like

    void Audio::UpdateInternal(float timeStep)
    {
        URHO3D_PROFILE(UpdateAudio);
    
        // Update in reverse order, because sound sources might remove themselves
        for (u32 i = soundSources_.Size() - 1; i < soundSources_.Size(); --i)
        {
    

    Scott Meyers recommeds use signed types in interfaces https://www.aristeia.com/Papers/C++ReportColumns/sep95.pdf

    Bullet uses int for capacity & size & indices https://github.com/urho3d/Urho3D/blob/master/Source/ThirdParty/Bullet/src/LinearMath/btAlignedObjectArray.h

    Related: https://github.com/urho3d/Urho3D/pull/2939

    backlog proposal 
    opened by 1vanK 3
Releases(1.8)
Cross-platform, graphics API agnostic, "Bring Your Own Engine/Framework" style rendering library.

bgfx - Cross-platform rendering library GitHub Discussions Discord Chat What is it? Cross-platform, graphics API agnostic, "Bring Your Own Engine/Fram

Бранимир Караџић 11.9k Aug 14, 2022
Cocos2d-x is a suite of open-source, cross-platform, game-development tools used by millions of developers all over the world.

Cocos2d-x is a suite of open-source, cross-platform, game-development tools used by millions of developers all over the world.

cocos2d 16.3k Aug 4, 2022
Open 3D Engine (O3DE) is an Apache 2.0-licensed multi-platform AAA Open 3D Engine

Open 3D Engine (O3DE) is an Apache 2.0-licensed multi-platform 3D engine that enables developers and content creators to build AAA games, cinema-quality 3D worlds, and high-fidelity simulations without any fees or commercial obligations.

O3DE 5.2k Aug 10, 2022
PainterEngine is a application/game engine with software renderer,PainterEngine can be transplanted to any platform that supports C

PainterEngine is a application/game engine with software renderer,PainterEngine can be transplanted to any platform that supports C

DBinary 1.4k Aug 11, 2022
A modern cross-platform low-level graphics library and rendering framework

Diligent Engine A Modern Cross-Platform Low-Level 3D Graphics Library Diligent Engine is a lightweight cross-platform graphics API abstraction library

Diligent Graphics 2.4k Aug 12, 2022
Horde3D is a small 3D rendering and animation engine. It is written in an effort to create an engine being as lightweight and conceptually clean as possible.

Horde3D Horde3D is a 3D rendering engine written in C++ with an effort being as lightweight and conceptually clean as possible. Horde3D requires a ful

Volker Vogelhuber 1.3k Aug 5, 2022
Brand new engine with new and QoL features. Grafex is Psych engine with some additions and Better graphics

Friday Night Funkin' - Graphex Engine Credits: Grafex Mod aka Psych Graphic Rework: Xale - Lead Coding, Artist PurpleSnake - Second Coder Psych Engine

Xale 4 Aug 9, 2022
Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.

RetroArch RetroArch is the reference frontend for the libretro API. Popular examples of implementations for this API includes video game system emulat

null 6.9k Aug 14, 2022
Gearcoleco is a cross-platform ColecoVision emulator written in C++.

This is an open source project with its ongoing development made possible thanks to the support by these awesome backers.

Ignacio Sanchez Gines 34 Apr 20, 2022
A small cross-platform graphics library made in C

minigfx Small graphics library made in C Intended to be: Simple to understand Intuitive Fun to use Features Cross platform: Windows and Linux. To see

Laurentino Luna 27 Jul 18, 2021
Ksnip is a Qt-based cross-platform screenshot tool that provides many annotation features for your screenshots.

Ksnip is a Qt-based cross-platform screenshot tool that provides many annotation features for your screenshots.

ksnip 1.4k Aug 7, 2022
Android studio native project template using cross platform raylib graphics library.

rayturbo Android studio native project template using cross platform raylib graphics library. https://www.raylib.com/ This project use Android Studio

Ciapas Linux 10 Mar 5, 2022
A low-level, cross-platform GPU library

vgpu is cross-platform low-level GPU library. Features Support for Windows, Linux, macOS. Modern rendering using Vulkan and Direct3D12. Dependencies U

Amer Koleci 9 Jul 28, 2022
Dust3D is a cross-platform open-source 3D modeling software

Dust3D is a cross-platform open-source 3D modeling software. Auto UV unwrapping, auto rigging with PBR Material support, pose and motion authoring all in one.

Jeremy HU 2.4k Aug 9, 2022
ORE (OpenGL Rendering Engine) is a rendering engine developed for my college minor project assessment.

ORE (OPENGL RENDERING ENGINE) What is ORE? ORE(OpenGL Rendering Engine) is a rendering engine with great and easy to use UI that allows the user to lo

HARSHIT BARGUJAR 4 Dec 20, 2021
Pure C Game Engine

Corange game engine Version 0.8.0 Written in Pure C, SDL and OpenGL. Running Corange is a library, but to take a quick look at some of the things it d

Daniel Holden 1.5k Aug 11, 2022
A completely free, open-source, 2D game engine built on proven torque technology.

Torque2D 4.0 Early Access 1 MIT Licensed Open Source version of Torque2D from GarageGames. Maintained by the Torque Game Engines team and contribution

Torque Game Engines 564 Aug 10, 2022
DirectX shader bytecode cross compiler

HLSLcc DirectX shader bytecode cross compiler. Originally based on https://github.com/James-Jones/HLSLCrossCompiler. This library takes DirectX byteco

Unity Technologies 709 Aug 4, 2022
A multi-platform library for OpenGL, OpenGL ES, Vulkan, window and input

GLFW Introduction GLFW is an Open Source, multi-platform library for OpenGL, OpenGL ES and Vulkan application development. It provides a simple, platf

GLFW 9.4k Aug 6, 2022