Skip to content

SoupeauCaillou/sac

Repository files navigation

sac

sac is Soupe au Caillou's 2D C++ game engine.

Disclaimer

This engine has been done for experimentation and learning purpose. It's not suitable for production and contains lots of ugly hacks - but with limited free time available we chose to work on what was fun (adding features, publishing games). If you can't stand the varing coding-style or other horrors you might find, send a PR to fix it :)

Features

  • Entity/System design. Game objects do not have to inherit from a base class like Node or GameObject but are instead a simple identifier (32 bit integer). We then use composition to add/remove features to individual objects. See (0) and (1) for more details on the concept.

  • Multithreaded OpenGL renderer. Or more precisley: game logic updates happen on 1 thread, and rendering using OpenGL is done in another thread. The 2 threads only share 1 data structure: a rendering commands queue. The queue itself is built by transforming all renderable entities in render commands. In a second step this queue is sorted using a 64 bits key containing rendering states (which texture atlas, blending enabled or not, etc). See (2) for a more in-depth article

  • Debug UI using (imgui). Allow inspection and manipulation of all entities/components as well as enabling debug info on various systems.

  • Rewind: at any time you can pause the game and rewind (or move backward/forward frame by frame). This is really handy when debugging. You can also see graphic batches.

  • The engine is multiplatform (Android, Linux, Mac, Windows, Web) but uses a single build system: cmake

  • Music and Sound playing is supported as well. While Sound is really simple, Music can do some nice things: multi-tracks, looping at specific time, blending, etc

  • Entities can be defined in resources files, in a pseudo-ini format.

  • Assets hot reload (only on desktop), allows to see modifications to assets while running the game

  • Logging: the engine uses macros for logging - LOGI(), LOGE_IF(), LOGW_EVERY_N() etc. They can be easily disabled in release build

  • Multitouch support

  • Physics: we built our own physics engine - it's obviously not as good as Box2D and the like, but it can handle simple things well. Similarly we have a few Collision routines (and raycasting support).

  • Minimal amount of c++ costly construction (std::string, std::map, etc). Where performance matters we replaced them by hashes or vector kind of storage.

Games using sac

Heriswap Recursive Runner

  • Heriswap is an Android match-3 game (Google Play or F-droid or direct link) which wants to be zen and smooth. Sources are available here.

  • Recursive Runner is an Android runner game (Google Play or F-droid soon or direct link) where your main obstacle is yourself! Sources are available here.

  • Assault serie is a set of tactical turn-based wargames during the WWII. A demo Headquarters (Google Play) is available, first episode Normandy (Google Play) and also second episode Bastogne (Google Play) are available on the market.

Documentation

See (wiki)