🎮 Scion2D Update – Adding Box2D Physics Lua Bindings and Debug Rendering!
Welcome back! I'm Dustin, and in this video, we continue building the physics system for the Scion2D Game Engine using Box2D.
We start by implementing the PhysicsComponent Lua bindings, allowing physics functionality to be controlled directly from Lua scripts rather than being hardcoded in the application.
We also create the RenderShapeSystem so we can visualize physics objects and collision shapes directly inside the engine. While doing this, we update the RectBatchRenderer to support model matrices, allowing our debug rendering to properly match the transformations of our entities.
By the end of this episode, we have physics entities being created through Lua and a working debug rendering system for visualizing colliders.
Topics covered in this video:
• PhysicsComponent Lua bindings
• Box2D integration improvements
• RenderShapeSystem
• Physics debug rendering
• Collider visualization
• RectBatchRenderer improvements
• Model matrix rendering
• ECS integration
• Moving physics entities into Lua
• Testing physics from Lua scripts
🎯 Challenge
For the next video, try creating a TextComponent and RenderTextSystem.
The goal is to render text through ECS rather than directly through renderer draw calls.
Suggested TextComponent members:
• fontName
• textStr
• hidden
• color
• padding
• wrap
The RenderTextSystem should also support a dedicated UI camera if needed so that UI text remains fixed on screen rather than moving with the world camera.
⚠️ Important Notice
Box2D has changed significantly since this video was originally recorded.
The latest Box2D releases use a C API and will not work exactly the same as the version used in this series.
For compatibility, you can use an earlier release:
https://github.com/erincatto/box2d/re...
Or follow the overlay port instructions provided in the repository:
https://github.com/dwjclark11/Scion2D...
Useful Resources:
Box2D Documentation:
https://box2d.org/documentation/
Box2D GitHub:
https://github.com/erincatto/box2d
Physics Engine Programming:
https://pikuma.com/courses/game-physi...
🔗 GitHub Repository
Explore the project here:
https://github.com/dwjclark11/Scion2D
💬 Join the Community
Chat, give feedback, or get help on Discord:
/ discord
📺 Watch the Full Playlist
Catch all the videos in the series:
• Build a 2D Game Engine in C++ | Scion2D Ga...
👍 Like the video and subscribe for future engine development tutorials and Modern C++ programming content.
💬 Questions or ideas? Drop a comment below—I’d love to hear your thoughts and suggestions.