The small3d library
|
[Source Code] [API Documentation]
Minimalistic, open source library for making 3D games in C++
This library provides a sufficient level of game development functionalities for C++ developers to be able to build cross-platform games based on a single code-base. Supporting as many platforms as possible while minimising the amount of code and time needed for maintenance is favoured over richness of features and the use of cutting edge methods and technologies.
All of the above can be found here: https://github.com/dimi309/small3d-first-games
Running on OpenGL on PC and OpenGL ES on mobile, this library is extremely backwards compatible. It can run on iOS 9.3 and Android 4.1.
Note: There used to be Vulkan support too, but it has been discontinued. Here is an article on the reasons for this:
https://www.gamedev.net/blogs/entry/2275791-abandoning-vulkan/
And here is the last Vulkan commit before the Vulkan renderer got removed:
https://github.com/dimi309/small3d/releases/tag/1.8015.last.vulkan
Note that despite the official deprecation of OpenGL on Apple devices, OpenGL and OpenGL ES still work just fine there. If and when that changes, I will implement a renderer in Metal or something.
https://www.gamedev.net/tutorials/programming/engines-and-middleware/small3d-tutorial-r5655/
The following need to be installed, with the relevant environment variables and tools accessible via the command line:
Run the build script which is suitable to your platform from the scripts
directory (build-vs.bat
, build-mingw.bat
or build.sh
).
Then, the unit tests are executed by running unittests
binary from build/bin
.
If any of this fails or you would simply like to restart the building procedure, the best way to clean the repository is by using git:
git clean -fdx
For building your own project, you need:
build/include
directorybuild/lib
directorybuild/shaders
directorysmall3d/cmake
directory if you will be using cmakeYou can also deploy using conan. The conan package is provided in a separate repository.
Builds for mobile platforms can be performed by executing either build-android
or build-ios
from the scripts
directory. You can then use the test projects in the android
, ios
and ios-opengles
directories to check if everything works, or as a starting point for your own projects.
If the Android project produces an NDK or SDK related error when opened in Android Studio, just close it without exiting Android Studio and open it again.
Also on Android, while a game or the unit tests are running, the error .../GL2Encoder.cpp:s_glGetBufferParameteriv:3386 GL error 0x502
might appear in the log. You can ignore it. It is produced when glGetBufferParameteriv is called in the Renderer to check if a model has already been copied to the GPU and the model is not found (as expected when it has been newly loaded).
Note that, while on the PC edition I use GLFW for windowing functionalities and I/O, on mobile I access the native infrastructure directly.
If you would like to start with an empty project that has the basic game loop and input already set up, you are looking for this:
https://github.com/dimi309/small3d-boilerplate
It is highly recommended to use this boilerplate if you intend to port your game to Android and / or iOS. While it is pretty straightforward to get this library working for the desktop and you might prefer the freedom and flexibility of working with a project set up from scratch, mobile platforms have many specificities and quirks to take care of, so the boilerplate can save you a lot of time in that respect.
The following dependencies' source code repositories (not binaries) are distributed in this same repository (in the deps
directory). They can be built by executing a single script (see "Building", above) and they can also be used directly in your application / game code.