Acerca de
This was a class project wherein the goal was to create a 2D game engine in C++. We were given a few specifications and 3 libraries to use. Everything else about the engine we were given freedom as to how to program and design.
The Libraries provided were as follows:
-
A simple 2D graphics rendering library for Windows (implemented using DirectX) capable of loading and rendering image files.
-
An input abstraction library for Windows (containing the means to register a method to be called when a keyboard key is pressed).
-
A multi-threading abstraction library for Windows (containing the means to start a new thread, wait on a thread, and the necessary structures for mutexes and semaphores).
Additionally, this project makes use of the nlohmann json library.
Everything else was implemented using only the C++ Standard Library and the C++ Windows integration library.
This Engine has the following features:
-
Renders 2D Graphics using the provided library (and abstracts the graphics system for easy use).
-
Supports movement of 2D sprites in 3D space.
-
Receives input using the provided library (and abstracts the input system for easy use).
-
Is framerate independent when updating physics and gameplay.
-
Uses a full ECS system that can dynamically add and remove components during runtime.
-
Uses Smart and Weak Pointers (Owner & Observer design pattern) for game Entities.
-
Loads game Entities (with all components attached and registered) using JSON files.
-
Supports multi-threaded code and creating Entities asynchronously on another thread.
-
Associates a 3D Position, Scale, and Rotation with each Entity using a 4x4 Transform Matrix (and support transformation of that Entity).
-
Supports generic continuous swept 2D & 3D collision (with a response of fully elastic collisions, and calls events when collisions occur).
Controls Demo:
-
A and D move the paddle left and right.
-
E to spawn in a ball (when you have none).
-
The direction of the bounce of the ball is affected by where it hits the paddle.
-
The ball will speed up with every bounce.
The entity json files are included in the "data" folder, and may be viewed. The "ball.json" and "hittable_bar.json" are the most complicated examples of entities.