v0.0.2 Alpha
Pi3C is a fast, C++ graphics engine and toolkit tailored for Raspberry Pi 5. It's small size and innovative techniques make it fast enough to run highly detailed 3D games ...
Supported
SBC | Supported | Notes |
---|---|---|
Raspberry Pi 5 | ✅ | N/A |
Raspberry Pi 4 | N/A | N/A |
Raspberry Pi 3 | ❌ | N/A |
Raspberry Pi 2 | ❌ | N/A |
Rock 5B | ✅ | N/A |
Windows | ❌ | N/A |
Examples
Example | Working |
---|---|
CastleCreator | ✅ |
Blocks | ❌ |
3D modeller | ❌ |
Extruder | ❌ |
HelloWorld | ✅ |
Invaders | ❌ |
MD viewer | ❌ |
NoahsArk | ❌ |
PerlinMap | ❌ |
ShaderToy | ✅ |
Snow | ✅ |
click image to watch video
Or, how about a Minecraft style game? ...
click image to watch video
Pi3C is designed to be simple to use and encourage youngsters (or anyone) new to programming by exploring the basic tutorials, games and apps provided.
These range from a few lines of simple, self explained code to more complex, real-world and heavy-weight examples.
Pi3C tries to avoid the complexities of C++ by providing a top-level class called Pi3C. This class has simple commands to help you start your journey into the exciting world of C++ programming. Pi3C's utilizes the 'Simple DirectMedia Layer' (SDL 2.0) cross-platform development library (https://www.libsdl.org/).
Pi3C provides functions to render Open GLES 3.1 graphics using shaders. It also provides a high speed, Immediate Mode Graphics User Interface (IMGUI) with various buttons, text and common widgets. Using these functions, complex Apps and games can be made with relative ease.
Pi3C will also includes tools for 3D modelling and scene arrangemet with 1st person capabilites for testing scenes such as free flight, point and jump, and full screen renderng. Other tools planned will include an IMGUI interface designer and C++ code generator that will jump-start your project.
Pi3C is currently under heavy development and functions may/will change over time as new Apps, Games and Demos are developed. These developments will continue to greatly improve, enhance and simplify the Pi3C graphics engine and speed up your coding.
I hope that you will enjoy your experience with Pi3C as it develops!
Tim Skillman
2. What you need and Setting up
- The main program
- Including stuff
- Compile & Run
With Pi3C you can write high speed 2D or 3D games. Or, you can write fast applications.
The following games can be explored in this repo ...
- Invaders
The following apps can be explored in this repo ...
- 3D Modeller
- Castle Creator
- Blocks (Minecraft experiment)
- HelloWorld
- Snow
- Extruder
- PerlinMap
- ShaderToy
- MD viewer
- NoahsArk
C++ is one of the most popular, industry standard programming languages.
You will need the following parts
- Raspberry Pi (preferably 4/5 for faster compiling)
- 5 volt, 2.5 amp power supply with Micro-USB connector
- Keyboard and Mouse
- Monitor or TV with HMDI
- HDMI cable
- 16GB or 32GB Micro-SD card
The easiest ways to download and modify Pi3C for your own use it use Git
Git is usually installed with the Raspberry Pi OS, but if not, download Git with;
sudo apt install git
Make sure you're in the 'home/pi' directory (indicated by the ~ (tilde character) with nothing after it) and enter;
git clone https://github.com/randomnumgen1/Pi3C_RPI5.git Pi3C
Pi3C will be cloned onto your Pi and a Pi3C directory, with all the necessary code and resources, will be downloaded.
This will install all the SDL 2.0 libraries, configure your GPU memory and enable the video drivers for your particular Raspberry Pi.
Open a terminal window, navigate to the Pi3C folder and enter:
sudo sh Installer.sh
When prompted, type "Reboot" to restart your Raspberry Pi.
Now you should be setup and ready to play with Pi3C ... Congratulations!
Pi3C folders are laid out in the following way;
Examples (Example games, apps and demos in here)
SharedCode (Pi3C core and helper code)
Resources (Models, textures and sounds stored here)
ThirdParty (Windows only - not needed on the Pi, but keep if developing on a Windows machine as well)
MyProjects A place to put your projects and reference the Pi3C SharedCode
The Examples folder contains all the examples to try out.
So lets try out some examples!
Opening the Examples folder you will see several examples such as 'Castle Creator' and others. Let's try out Castle Creator first and see how it works ...
Open a terminal window (if already closed) and navigate to;
cd Pi3C/Examples/CastleCreator
Run the Castlre Creator by entering ...
./CastleCreator
Note: If it doesn't work, you need to change CastleCreator's permissions and do the following ...
- In the desktop folder, navigate to 'CastleCreator' and click the right button and select 'Permissions'
- Under the Permissions tab, All three dropdowns should be set to 'Anyone' and then select OK.
- Try ./CastleCreator again and it should run
You will notice the 'options.txt' file and other txt files in the CastleCreator folder. If you feel adventurous, open these files and try changing the screen resolution or set fullscreen to 'true'. The 'options.txt' file is an easy way of customising a game or an app without having to recompile your code.
Try the other examples such as Blocks, Invaders, Snow, 3D modeller and others using the same info for CastleCreator.
Of course, we're trying out precompiled examples - so let's get coding your own stuff!
If setup correctly, Pi3C examples and tools should be ready to build and run.
To build a project do the following;
1. Enter the Project folder you want to build
cd Invaders
Note: you don't need to type the whole word 'Invaders' ... type the first few characters such as 'Inv' and then press the TAB key ... this will auto-complete the word. You can do this shortcut for any part of a long pathname for example.
2. Build with 'make'
make
Make will build the whole project and all of its dependent code.
Dependent code in this case is 'SharedCode' containing Pi3C. If not built previously, Pi3C code will also build and it can take some time. However, this only happens once since the compiler is clever enough to only compile code that has changed after that.
Once built, you will notice a "_build" folder appearing next to the Pi3C folder. This folder contains all the object files created from the source. These files are then 'linked' together to create the final program.
3. Run
You will also notice the built, executable file in your project folder.
To run the executable on the Raspberry Pi (Invaders for example), type;
./Invaders
4. Clean
Sometimes your project won't compile as expected - and that's not due to any bad coding! ... For example, when you update Pi3C the object files in the build folder need cleaning out. To clean the project entirely, type;
make clean
This basically deletes all the object files in the build folder (note: don't worrry, it won't delete anything important) Cleaning will ensure that all your built code is fresh and using the latest changes.
You should clean after updating Pi3C or making significant changes. However, it is not necessary if Pi3C SharedCode has not changed.
Keeping up-to-date with the latest code is simple. In a terminal window navigate to the Pi3C folder, and type;
git pull origin master
This command will import (pull) all the latest Pi3C changes from the GIT repository.