A game made in C++ using SFML for Uni assigment
├── game // Game files
│ ├── assets // Images, presets and so on
│ ├── include
│ └── src
├── lib // External libraries and programs
│ ├── json
│ ├── ...
│ └── vendor
│ └── premake // Build system
└── World.ldtk // LDtk file containing levelsstart.config- starting setting of the game like the level that's first loaded.json/.jsonc- Files containing information about the game like player speed.level- Generated files containing game levels extracted from LDtk (see below)
F2- Hides and locks the consoleF3- Hides/Shows the console (shift forces console in Release)F4- Toggles slowmodeF5- Reloads all the assetsF6- Toggles display mode between "Just Actors", "Just Gizmos" and "Gizmos and Actors"F10- Shows list of all actors
You can get it here, this is a handy tool for simple level creation with suport for tilesets and entities.
This program outputs .ldtk file. Said file is in .json format and contains a lot of data not useful at runtime. We strip this additional data externally and output .level file which looks like so:
This file is then directly read by the game
Game assets are stored in .jsonc or .json format and later parsed at runtime
sf::Rect<T>-[x, y, width, heigh]sf::Vector<T>-[x, y]sf::Vector<T>-[x, y, z]Asset Path-foo/baror./bar(relative to the asset)
Code is architected around code concept of "Actors" which are self contained objects in the game world, like tilemaps, player or enemies. All actors have to inherit from Actor class and can implement one of the classes like Drawable or Tickable. Actors are grouped into "Groups" that can be, for example, unloaded at once.
Simple Actor might look like so:
#include <actor.h>
class Crate : public Actor, public Drawable, public Hittable
{
public:
virtual void draw(sf::RenderTarget& target, sf::RenderStates& states) override;
virtual float getSortingYPos() { return crateSprite.getPosition().y; }
virtual void update(const GameClock& time) override;
private:
sf::Sprite crateSprite;
}Actors are created via createActor method like so:
world::createActor<Crate>();

{ "Title": "Intro", "Actors": { "Player": { "pos": [7.5, 9] }, "Cacti": [ { "pos": [13.5, 7] }, { "pos": [10.5, 5] }, // ... // ], "Tall_Cacti": [ { "pos": [22.5, 15] }, { "pos": [6.5, 15] }, // ... // ] }, "Tiles": [ { "pos": [10, 1], "tPos": [2, 0] }, { "pos": [11, 1], "tPos": [3, 0] }, // ... // ], "Ground": [ { "pos": [0, 0], "tPos": [0, 0] }, { "pos": [1, 0], "tPos": [0, 0] }, // ... // ] }