Skip to content

👻 A cross-platform C++ multithreaded async app & game development framework

License

Notifications You must be signed in to change notification settings

romanpunia/vitex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation



Vitex Logo

C++ Cross-Platform Framework

Build Status

About 👻

Vitex is a cross-platform C++17/20/23 framework to create any type of application from a unified interface. In it's core, Vitex is based on same concepts as Node.js but made to it's extreme. As in Node, Vitex has a worker pool that not only consumes but also publishes tasks, here we don't really have a concept of event loop, every thread is on it's own an event loop.

Details

Using concept of tasks and queues, in Vitex there are two rules for optimal performace and proper CPU loading:

  1. Split work in to small pieces.
  2. Schedule those small pieces.

Scheduler processes blocking and non-blocking tasks such as event dispatching, non-blocking IO and coroutines, CPU bound tasks and blocking IO. Vitex is made to be as scalable as possible without even thinking about scalability which in turn makes development of multithreaded systems quite a lot easier.

Originally, Vitex was a game engine but now it isn't. All the features for game development are there but it can be easily stripped out to reduce size of executable and use only needed functionality. There are cases when Vitex is used as a framework for building a high performance backend server or a daemon, most of the time all we need in that case is OpenSSL and maybe Zlib with PostgreSQL or MongoDB, so we strip out everything else that way reducing compile time, executable size and runtime memory usage to minimum.

For games, Vitex is a 3D optimized engine, there is a posibility to render efficient 2D graphics with batching but that is not a priority. Main shading language is HLSL, it is transpiled or directly compiled and saved to cache when needed. Rendering is based on stacking, that way you specify renderers for a camera (order matters), when rendering is initiated we process each renderer step by step, renderer can initiate sub-pass to render another part of scene for shadows, reflections, transparency and others. Before rendering begins, render lists are prepared for geometry rendering based on culling results, for sub-passes we use frustum and indexed culling, for main passes we also use occlusion culling. Culling, physics, audio and rendering are done multhreaded if possible. In best case, we don't have any synchronization between threads but when we need to write to shared data, for example, destroy a rigid body owned by physics engine, we use scene transactions that are just callbacks that are guaranteed to be executed thread safe (in scope of scene) which in turn makes scene eventual consistent as transactions are fired later when all parallel tasks are finished.

Another important aspect of Vitex is schemas, they are used to serialize and deserialize data. For game, their main purpose is to provide containers for serialized game states such as meshes, animations, materials, scenes, configurations and other. For services, they can be used as a data transmitting containers to convert between XML, JSON, JSONB, MongoDB documents, PostgreSQL results and others.

Documentation

You may take a look at Wiki pages. There are some practical usage examples that can be drag-and-drop executed.

Cross platform (tested platforms)

  • Windows 7/8/8.1/10+ x64/x86 (MSVC, MSVC ClangCL, MinGW)
  • Raspberian 3+ ARM (GCC)
  • Solaris 9+ x64/x86 (GCC)
  • FreeBSD 11+ x64/x86 (GCC)
  • Debian 11+ x64/x86 (GCC, LLVM)
  • Ubuntu 16.04+ x64/x86 (GCC)
  • MacOS Catalina 10.15+ x64 (Xcode)

Building

There are several ways to build this project that are explained here:

Configuration

  • VI_CXX is the C++ standard (17, 20, 23) which will be used, C++20 and higher will replace stateful coroutines with std coroutines, defaults to 20
  • VI_LOGGING is a logging level (errors, warnings, default, debug, verbose), defaults to "default"
  • VI_PESSIMISTIC will enable assertion statements in release mode, defaults to OFF
  • VI_BINDINGS will enable full script bindings otherwise only essentials will be used to reduce lib size, defaults to ON
  • VI_ALLOCATOR will enable custom allocator for all used standard containers, making them incompatible with std::allocator based ones but adding opportunity to use pool allocator, defaults to ON
  • VI_FCONTEXT will enable internal fcontext implementation for coroutines, defaults to ON
  • VI_SHADERS to embed shaders to /src/vitex/graphics/shaders/bundle.hpp, defaults to ON

Dependencies

Serialization features

Networking features

Graphics features

GUI features

Other features

License

Vitex is licensed under the MIT license

Known Issues

Documentation in it's usual form is non-existant at the moment. In the nearest future that could be changed.