Skip to content

DamienFremont/c99-raylib5-gl3-3dgame-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

236 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

3D Game Starter - C 2017, RayLib 5.0, OpenGL 3

License: MIT Twitter Follow "Buy Me A Coffee"

2024's small template to start your raylib game. Featuring 3D, C 2017, Raylib 5.0, OpenGL 3 and a modular architecture.

Big thanks to Raysan5 for his amazing lib. โค๏ธ

alt text

Content


Features

  • ๐Ÿ“บ Render: PostProcessing Bloom, AA MSAA, Texture Filtering
  • ๐Ÿ“บ Lighting: World Lighting, Player Lighting, Player Shadows
  • ๐Ÿ“บ Meshes: Meshes, Textures, Shaders, Materials
  • ๐Ÿ“บ Sky: Color, Cubemap, Fog
  • ๐ŸŽฅ Camera: ThirdPerson, Follow
  • ๐ŸŽฅ Animation: Character
  • ๐ŸŽฎ Input: Keyboard, Arrows, Gamepad Input, F1 Console
  • ๐ŸŽฎ Control: Tank control
  • โš™๏ธ Simulation: Tick Systems
  • โš™๏ธ File: Scene JSON format

Dependencies

  • ๐Ÿ“ฆ C++ 2020 / C 2017
  • ๐Ÿ“ฆ RayLib 5.0
  • ๐Ÿ“ฆ OpenGL 3.30

Screenshots

alt text

alt text

alt text

alt text

alt text

Repository layout:

โ”œโ”€โ”€ assets
โ”‚ย ย  โ”œโ”€โ”€ resources
โ”‚ย ย  โ”‚   โ”œโ”€โ”€ images
โ”‚ย ย  โ”‚   โ””โ”€โ”€ scene.json
โ”‚ย ย  โ””โ”€โ”€ src
โ”‚ย ย      โ””โ”€โ”€ player.blend
โ”œโ”€โ”€ docs
โ”œโ”€โ”€ infra
โ”œโ”€โ”€ lib
โ”‚ย ย  โ”œโ”€โ”€ raylib-5.0_win64_msvc16
โ”‚ย ย  โ”œโ”€โ”€ winmm-10-win64
โ”œโ”€โ”€ platform
โ”‚ย ย  โ”œโ”€โ”€ engine
โ”‚ย ย  โ””โ”€โ”€ game
โ”œโ”€โ”€ standalone
โ”‚   โ”œโ”€โ”€ desktop_win64
โ””โ”€โ”€ tools
 ย ย  โ””โ”€โ”€ blender
 ย ย  โ””โ”€โ”€ ci

Install

Windows

CMake:

  • Download the v3.28.3 release of CMake at http://www.cmake.org/download/.
  • Pick Windows (Windows x64 Installer).
  • Run the installer
  • When asked for, select Add CMake to the system PATH for all users.
  • Run software installation...

Visual Studio:

  • Download the Community version of Visual Studio 2022 release of Visual Studio at https://visualstudio.microsoft.com/downloads/
  • Run the installer...
  • Run software Visual Studio Installer
  • When asked for, click on modify under Visual Studio 2002
  • Select Desktop development with C++ (contains MVC package)
  • Click on modify

PowerShell:

cmake -S "." -B "build" -G "Visual Studio 17 2022"

Usage

CLI (pure CMake)

  • Pros: basic, no Editor, CI friendly.
  • Cons: manual actions intensive.
.\tools\ci\install.bat

.\tools\ci\dev.bat
# OR
.\tools\ci\release.bat

VisualStudio 2022 (IDE)

  • Pros: better integration, 1 step compile+debug.
  • Cons: very laggy UI, bad search tools.
.\tools\ci\install.bat

alt text

alt text

VSCode

  • Pros: better code editor, lightweight.
  • Cons: 2 steps compile+debug
.\tools\ci\install.bat

.\tools\ci\watch.bat

Run (press Ctrl+F5, or Menu > "Run" > "Run without Debugging")

Debug (press F5, or Menu > "Run" > "Start Debugging")

alt text

Update

  1. download latest Raylib release https://github.com/raysan5/raylib/releases
  2. extract raylib-5.5_win64_msvc16 to /lib folder
  3. download latest Raylib release https://github.com/raysan5/raylib/tree/master/examples/shaders/resources/shaders/glsl330
  4. copy files \assets\resources\shaders\glsl330
  5. download latest rlights from https://github.com/Bigfoot71/rlights
  6. copy rlights.h to /lib folder
  7. run .\tools\ci\install.bat
  8. run .\tools\ci\dev.bat

Assets

Pipeline

Installation:

  1. Download io_scene_m3d.py
  2. Start Blender
  3. Go to menu, "Edit" > "Preferences..." > "Add-ons" tab > "Install..." button
  4. Browse and double click on the downloaded file
  5. On the "Add-ons" tab, search for "m3d"
  6. Click on "Enable Add-on."
  7. Now in the menu, "File" > "Export" > "Model 3D (.m3d)" (and eventually "File" > "Import" > "Model 3D (.m3d)") should appear

Get 3D Models:

  1. Start WebBrowser...
  2. https://www.mixamo.com
  3. Click Characters
  4. search "X bot"
  5. Click Download
  6. Check Format: fbx, pose: t-pose
  7. Click Download
  8. Start Blender...
  9. Go to menu, File > New > General ...Delete Cube
  10. Go to menu, File > Import > FBX > "X bot.fbx"
  11. Click on the "Texture Paint" tab > click "new" > type "X_bot_diffuse"
  12. On right side panel > click "material" > "base color" > "image texture" > select "X_bot_diffuse"
  13. Go to menu, File > Export > M3D > scale: 2.0 > "X_bot.m3d" > Export

Get 3D Animations:

  1. Start WebBrowser...
  2. https://www.mixamo.com
  3. Click Animations
  4. search "Slow Run"
  5. check "In Place" box
  6. Click Download
  7. Check Format: fbx, Skin: with skin
  8. Click Download
  9. Start Blender...
  10. Go to menu, File > New > General ...Delete Cube
  11. Go to menu, File > Import > FBX > "Slow Run.fbx"
  12. Click on the "Animation" tab > click "editor type icon" > "non linear animation" (new channel editor)
  13. click "push down action" (new channel)
  14. Go to menu, File > Export > M3D > scale: 2.0 > "Slow Run.m3d" > Export

FAQ

Why Models are sometime unlit ?

Cause: Blender export changes materials indexes (start with 0 or 1) and lighting shader needs to be applied to real material.

  • *.obj, *.iqm formats: use material[0]
  • *.m3d, *.glb formats: use material[1]

alt text

What about performance ?

Condition: GPU: RTX-2060, CPU: i5-9600K, RAM: 32 GB

  • Raylib (GL3) "High": ~2500 FPS (AA 4x, Postpro Bloom)
  • Raylib (GL3) "Low": ~3000 FPS
  • Unreal (DX12) "Low": ~150 FPS (Settings=Low)

alt text

alt text

What about scene format ?

It's JSON, with structure similar to Godot YAML *.tscn files.

alt text

Resources

References

There are several games made with raylib to highlight:

There are also many small games (and tools) made with raylib on itchio: https://itch.io/c/380928/made-with-raylib

About

2024's small template to start your raylib game. Featuring 3D, C 2017, Raylib 5.0, OpenGL 3 and a modular architecture.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages