Built by: Utsav Lal and Jayesh Gajbhar
Library: SDL2, ZeroMQ, nlohmann/json and C++ 20
The engine was started from the template shared by Dr. Alexander Card in moodle and grew from the same template. Current capabilities include:
- A fully functional Entity Component System
- Keyboard movement using WASD
- Physics with customizable gravity in x and y directions
- Collisions between objects with conservation of kinetic energy
- A simple state machine animation controller
- Fully multithreaded engine
- Custom timeline class with ability to pause, play and increase decrease speed.
- Asynchronous networking capabilities using ZMQ for client server and peer to peer between 3 clients.
- A fully functional Event System where you can raise an event immediately or later or send it to the server.
PS: Remember to run the server first and then the clients
- If there is an existing
buildfolder runrm -r buildto clear and remove the folder - Run
mkdir build && cd buildfrom the root to create a new build folder and change directory to it - Run
cmake ..to generate required make files in build folder - Run
make allto compile the binaries (this includes the game engine and game binaries) - Run
./shade_engine_serverto start the server for the game engine - Run
./shade_engineto start the game engine or the game in this version
Please ensure that both the server and the game are started with the same messaging system.
PS: Another way to build the project would be to simply open it in CLion IDE and setting the env variables from the build menu.
No further action is required for building the games. The engine and game are run from the same executable for this version.
- Use
ADto move the player - Use
Spaceto jump - Use
Shift + Dto dash right orShift + Ato dash left
- If you fall down you will die and respawn after 5 seconds.
- If you land on a platform the character will get locked on it unless you move. This is a feature so that player doesn't fall off the platform when it moves.
- If you move towards the right of the screen the camera will pan ahead
- Events: We have the following events in the game: EntityRespawn,
EntityDeath,EntityCollided,EntityInput,EntityTriggered,MainCharCreated,PositionChanged,DashRight,DashLeft. There names are self-explanatory. - Delayed Events:
EntityDeathis a delayed event. It is raised after 5 seconds of the player falling down. - Handlers: Inside
systems/files which end withhandlerare event handlers. They are responsible for handling the events. For examplecombo_event_handleris responsible for handling theDashRightandDashLeftevents. - Networked Events:
MainCharCreatedandPositionChangedevents are networked events - Chords:
DashRightandDashLeftare input chord events. They are raised when the player pressesShift + DorShift + Arespectively.
To clean up
- Run
cd ..to come back to parent directory - Run
rm -r buildto remove build folder
main.cpp: This is the main entry point to the codeCMakeLists.cpp: This is the build file which helps run Cmake and build the projectgame/: contains the game code (if any) for the projectlib/: This contains all the source code for the project.core/: The core elements of the game engine like setting up screen, etcdata_structures/: The custom data structures for the engineenum/: Contains all the enumerations for the game engineECS/: Contains the elements of the Entity Component SystemEMS/: Contains the elements of the Event Management Systemenum/: Contains all the enums used in the projectgame/: This contains game specific code. One such is aGameManagerwhich is a singleton containing variables shared between the enginegeneric/: This contains generic classes which might be used by us in the futurehelpers/: This contains helper functions like random, constants, etcmodels/: This contains the models for the game engine like theComponentandData Modelserver: This contains a file calledworker.cppwhich is the main worker for the server.strategy/: All the classes for strategy pattern (in our case we use it for selecting messaging by JSON or array of vectors)systems/: All the systems for the game engine likePhysicsSystem,CollisionSystem, etc. Systems that end withhandlerare event handlers.