GithubHelp home page GithubHelp logo

edunad / rawrbox Goto Github PK

View Code? Open in Web Editor NEW
15.0 4.0 0.0 125.82 MB

PSX..ish game engine made with DiligentCore

Home Page: https://box.rawr.dev/

License: MIT License

CMake 2.30% Python 4.44% C++ 78.03% Shell 0.32% Lua 8.17% HLSL 0.88% GLSL 0.21% Dockerfile 0.07% GSC 0.05% C 5.53%
game-engine psx cplusplus diligent diligentcore dx12 vulkan luau scripting clustered-rendering

rawrbox's Introduction

logo
RawrBox - PSX..ish game engine

template

Why PSXish?

This engine started as a C++ training project, with hopes of being applied in upcoming games. Don't expect it to rival big players like Unity, Unreal or Godot; it's not geared towards advanced rendering techniques such as anti-aliasing or ray-tracing. Rather, it's tailored for crafting straightforward, PlayStation 1-style games. Surprisingly, it runs on Vulkan/DirectX12, keeping it somewhat modern despite its retro inspiration.

FEATURES

Module Features
Engine - Tick based system
- Limit FPS and TPS
Animation - Skeleton data support
- Blendshapes support
- Multiple armature animation support
- Vertex animation
Data - File formats:
    - Meshes (using assimp):
        - glTF/GLB
         - OBJ
         - FBX
         - DAE
         - 3DS
         - MD5mesh
    - Images:
        - PNG, JPEG, BMP, TGA, GIF (using stb)
        - SVG (using lunasvg)
        - WEBP (using libwebp)
        - WEBM (video only) (using libwebp)
    - Fonts:
        - TTF (using stb)
    - Audio (using BASS):
        - OGG
        - MP4
        - MP3
        - WAV
        - Supports url audio
    - JSON (using glaze)
Math - Vectors, colors, matrices & quaternions support
- Bezier curve & easing
- Packing support (float16, etc)
Physics - 3D multi-threaded physics (using JoltPhysics)
- 2D physics support (using Muli)
Rendering - Vulkan & DirectX 12 support using (Diligent)
- Material system similar to unity
- Window & Input callbacks (using GLFW)
- Clustered rendering :
        - Decals (WIP)
        - Lights (point / spot/ directional)
- Linux (steamdeck) support
- Bindless rendering
- Post-processing support
- 2D rendering
- Custom rendering plugins
- GPU Picking
- GPU Particle system
Network - HTTP / HTTPS requests (using libcpr)
- Packet network implementation
- NetVar & NetArray support for snapshot implementation
- Simple socket implementation
Scripting - Scripting / modding support with LUAU (using luabridge3 + luau)
Other - I18N (internationalization) support
- Settings support
- Steamworks support
- Custom UI
- DEV Console with support for custom commands & scripts
- Timer utils (based on GMOD's timers)
- File watcher implementation
- Threading utilities

SAMPLES

001-stencil
002-generated-models
003-light
004-instancing
005-post-process
006-decals
007-particle-system
008-ui
009-assimp
010-bass-audio
011-physics-3D
012-physics-2D
013-webm
014-scripting
015-gpu-picking
016-steamworks

BUILDING

WINDOWS

REQUIRED SOFTWARE

  • GIT or something similar to GIT
  • CMAKE at least > 3.16.3
  • Download and install C++ Build Tools (2022 is recommended)
  • Download and install a IDE, Visual Code is recommended.
  • Download and setup ninja (make sure it's in the enviroment path)
    • pip install ninja if you have python3 installed

IDE SETUP (Visual Code)

  1. Open the workspace file (.code-workspace) and install the recommended extensions (at least C++ & CMAKE)
  2. Run cmake configure
  3. Select [Visual Studio Build Tools <version> Release - amd64] on the kit popup (for all of the projects)
  4. Run the compiler by hitting F5

LINUX

REQUIRED SOFTWARE

SETUP

  1. Build the container : podman build -t rawrbox .
  2. Run the container : podman run -ti rawrbox /bin/bash
  3. Run cmake_rawrbox (ALIAS) to prepare the cmake rawrbox
  4. Run build_rawrbox (ALIAS) to build rawrbox

LIBS

LIB DESCRIPTION USAGE DEPENDENCIES
RAWRBOX.RENDER Rendering lib (aka, contains window, stencil, etc) Contains window, stencil, model / texture loading. Basically anything related to rendering ENGINE & MATH
RAWRBOX.MATH Math lib Contains vector, color and other math related classes
RAWRBOX.BASS Bass lib (aka sound loading) Loads sounds using the BASS lib, supports 3D & http sound streaming ENGINE & MATH
RAWRBOX.UTILS Utils lib Utils for game development
RAWRBOX.ENGINE Engine lib (aka game loop) The engine it self, contains the game loop mechanism UTILS
RAWRBOX.UI UI lib UI components lib RENDER & RESOURCES
RAWRBOX.RESOURCES Resources manager lib Resource manager. Handles loading and stores the pointers for easy access UTILS
RAWRBOX.PHYSICS.3D 3D Physics lib Handles 3D physics ENGINE & MATH
RAWRBOX.PHYSICS.2D 2D Physics lib Handles 2D physics ENGINE & MATH
RAWRBOX.ASSIMP Assimp lib Handles assimp model loading RENDER & RESOURCES
RAWRBOX.WEBM WEBM lib Handles webm loading RENDER & RESOURCES
RAWRBOX.SCRIPTING Scripting lib Handles lua & mod loading ENGINE & MATH
RAWRBOX.NETWORK Networking lib Handles networking
RAWRBOX.STEAMWORKS Steamworks lib Handles steamworks UTILS



CMAKE OPTIONS

OPTION NAME NOTE
RAWRBOX_BUILD_TESTING Builds & enables project tests
RAWRBOX_BUILD_SAMPLES Builds the project sample
-- --
RAWRBOX_CONTENT_FOLDER The content folder to output assets. Default is assets
-- --
RAWRBOX_USE_WAYLAND Enables WAYLAND compiling on LINUX
-- --
RAWRBOX_BUILD_RAWRBOX_UI Builds and includes ui
RAWRBOX_BUILD_RAWRBOX_RESOURCES Builds and resouces manager (aka handling and storing loaded resources)
RAWRBOX_BUILD_RAWRBOX_3D_PHYSICS Builds the 3D physics engine
RAWRBOX_BUILD_RAWRBOX_2D_PHYSICS Builds the 2D physics engine
RAWRBOX_BUILD_RAWRBOX_BASS Enables BASS support. ⚠️ BASS IS ONLY FREE FOR OPEN SOURCE PROJECTS ⚠️
RAWRBOX_BUILD_RAWRBOX_ASSIMP Enables assimp model loading
RAWRBOX_BUILD_RAWRBOX_WEBM Enables WEBM loading
RAWRBOX_BUILD_RAWRBOX_NETWORK Builds network support
-- --
RAWRBOX_BUILD_RAWRBOX_SCRIPTING Enables lua & modding support
RAWRBOX_BUILD_RAWRBOX_SCRIPTING_UNSAFE Enables io support on lua (loading and saving files on the data folder)
RAWRBOX_BUILD_RAWRBOX_SCRIPTING_EXCEPTION Enables scripting throwing exceptions instead of catching them
-- --
RAWRBOX_BUILD_RAWRBOX_STEAMWORKS Enables steamworks support
STEAMWORKS_APPID Sets the steamworks appid
-- --
RAWRBOX_BUILD_QHULL Builds QHull util
-- --
RAWRBOX_BUILD_MSVC_MULTITHREADED_RUNTIME Builds libraries with MSVC Multithreaded runtime (Auto-enabled if jolt is used)
-- --
RAWRBOX_DISABLE_SUPPORT_DX12 Disable dx12 support
RAWRBOX_DISABLE_SUPPORT_VULKAN Disable vulkan support
-- --
RAWRBOX_DEV_MODE Enables all the modules, used for rawrbox development
-- --
RAWRBOX_TRACE_EXCEPTIONS Enables exception tracing



INTERNAL DEPENDENCIES



dependencies




EXTERNAL DEPENDENCIES

LIB NOTE
DiligentCore Used for vulkan / directx rendering
glfw Used for window management
-- --
glaze Used for JSON loading
fmt Used for text formatting
utfcpp Used for utf support
-- --
stb_image.h Used for loading images (png,gif,jpeg)
stb_image_write.h Used for writting images
stb_freetype.h Used for loading fonts
stb_easy_font.h Used for drawing debug text
-- --
thread-pool Used for managing async threading
qhull Used for calculating convex hulls from given points
assimp Used for loading models
catch2 Used for testing
bass Used for loading sounds
JoltPhysics Used for managing 3D physics
muli Used for managing 2D physics
-- --
webmlib & vpx Used for loading webm
libwebp Used for WEBP loading
-- --
luabridge + luau Used for loading & managing lua scripting
curl + libcpr Used for HTTP / HTTPS requests
lunasvg Used for SVG loading
cpptrace Used for easy error tracing

rawrbox's People

Contributors

bromvlieg avatar dependabot[bot] avatar edunad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

rawrbox's Issues

[BUG] Vulkan is throwing validation errors on render target

RawrBox lib

  • rawrbox.assimp
  • rawrbox.bass
  • rawrbox.engine
  • rawrbox.math
  • rawrbox.network
  • rawrbox.physics_2d
  • rawrbox.physics_3d
  • rawrbox.render
  • rawrbox.resources
  • rawrbox.scripting
  • rawrbox.ui
  • rawrbox.utils
  • rawrbox.webm

  • UNKNOWN

Description

Diligent Engine: ERROR: Vulkan debug message (validation): VUID-VkImageMemoryBarrier-oldLayout-01211
                 Validation Error: [ VUID-VkImageMemoryBarrier-oldLayout-01211 ] Object 0: handle = 0x852b56000000006a, name = RawrBox::RenderTarget, type = VK_OBJECT_TYPE_IMAGE; | MessageID = 0x3e9335e3 | vkCmdPipelineBarrier(): pImageMemoryBarriers[1].oldLayout (VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL) is not compatible with VkImage 0x852b56000000006a[RawrBox::RenderTarget] usage flags VK_IMAGE_USAGE_TRANSFER_SRC_BIT|VK_IMAGE_USAGE_TRANSFER_DST_BIT|VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT. The Vulkan spec states: If srcQueueFamilyIndex and dstQueueFamilyIndex define a queue family ownership transfer or oldLayout and newLayout define an image layout transition, and oldLayout or newLayout is VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL then image must have been created with VK_IMAGE_USAGE_SAMPLED_BIT or VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT (https://vulkan.lunarg.com/doc/view/1.3.275.0/windows/1.3-extensions/vkspec.html#VUID-VkImageMemoryBarrier-oldLayout-01211)
                 Object[0] (image): Handle 0x852b56000000006a, Name: 'RawrBox::RenderTarget'

[BUG] Vulkan / AMD

RawrBox lib

  • rawrbox.render

Description

Vulkan on AMD does not support NonUniformResourceIndex well and so it creates small artifacts on those vertexes

[TODO] Add shader compilation on cmake

Taken from https://github.com/DiligentGraphics/DiligentSamples/blob/master/Samples/Asteroids/CMakeLists.txt

set_source_files_properties(${SHADERS} PROPERTIES VS_TOOL_OVERRIDE "None")

set(COMPILED_SHADERS_DIR ${CMAKE_CURRENT_BINARY_DIR}/CompiledShaders)
file(MAKE_DIRECTORY "${COMPILED_SHADERS_DIR}")

foreach(SRC_SHADER ${SHADERS})
    get_filename_component(SHADER_NAME ${SRC_SHADER} NAME_WE)
    get_filename_component(SHADER_EXT ${SRC_SHADER} EXT)
    set(COMPILED_SHADER ${COMPILED_SHADERS_DIR}/${SHADER_NAME}.h)
    list(APPEND COMPILED_SHADERS ${COMPILED_SHADER})

    set(PROFILE vs_5_0)
    if(${SHADER_NAME} STREQUAL "asteroid_ps")
        set(PROFILE ps_5_1)
    elseif(${SHADER_EXT} STREQUAL ".psh")
        set(PROFILE ps_5_0)
    endif()

    add_custom_command(OUTPUT ${COMPILED_SHADER} # We must use full path here!
                       COMMAND fxc /T ${PROFILE} /E ${SHADER_NAME} /Vn g_${SHADER_NAME} /Fh "${COMPILED_SHADER}" "${SRC_SHADER}"
                       WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
                       COMMENT "Compiling ${SRC_SHADER}"
                       VERBATIM
    )
endforeach(SRC_SHADER)

# NB: we must use the full path, otherwise the build system will not be able to properly detect
#     changes and shader compilation custom command will run every time
set_source_files_properties(${COMPILED_SHADERS} PROPERTIES GENERATED TRUE)

[BUG] Barrier being called too many times

RawrBox lib

  • rawrbox.assimp
  • rawrbox.bass
  • rawrbox.engine
  • rawrbox.math
  • rawrbox.network
  • rawrbox.physics_2d
  • rawrbox.physics_3d
  • rawrbox.render
  • rawrbox.resources
  • rawrbox.scripting
  • rawrbox.ui
  • rawrbox.utils
  • rawrbox.webm

  • UNKNOWN

Description

rawrbox::BindlessManager::barrier is being called too many times, need to add an ID so it doesn't queue it again if it's already queued?

293 D3D12 WARNING: ID3D12CommandList::ResourceBarrier: Called on the same subresource(s) of Resource(0x000001B18C2C5120:'RawrBox::Texture::Pack') in separate Barrier Descs which is inefficient and likely unintentional. Desc[0] and Desc[1] on (subresource : 0). [ RESOURCE_MANIPULATION WARNING #1008: RESOURCE_BARRIER_DUPLICATE_SUBRESOURCE_TRANSITIONS]

[BUG] Samplers not working

Description

setSample not working due to immutableSamplers, but disabling that requires better sampler management

[TODO] Improve GPUPick by copying a small area of the texture

Staging texture can then be 4x4 or smaller

 CopyTextureAttribs CopyAttribs;
    CopyAttribs.pSrcTexture = pMeshIdTexture;
    CopyAttribs.pDstTexture = pStagingTex;
    Box SrcBox{m_Params.LocationX, m_Params.LocationX + 1, m_Params.LocationY, m_Params.LocationY + 1};
    CopyAttribs.pSrcBox                  = &SrcBox;
    CopyAttribs.SrcTextureTransitionMode = RESOURCE_STATE_TRANSITION_MODE_TRANSITION;
    CopyAttribs.DstTextureTransitionMode = RESOURCE_STATE_TRANSITION_MODE_TRANSITION;
    pCtx->CopyTexture(CopyAttribs);

https://github.com/DiligentGraphics/DiligentFX/blob/master/Hydrogent/src/Tasks/HnReadRprimIdTask.cpp#L115

[BUG] Clustered rendering sometimes crashes on the steam deck

RawrBox lib

  • rawrbox.assimp
  • rawrbox.bass
  • rawrbox.engine
  • rawrbox.math
  • rawrbox.network
  • rawrbox.physics_2d
  • rawrbox.physics_3d
  • rawrbox.render
  • rawrbox.resources
  • rawrbox.scripting
  • rawrbox.ui
  • rawrbox.utils
  • rawrbox.webm

  • UNKNOWN

Need to check the other samples, might be a AMD issue

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.