This is a game engine I built from scratch on C++
It includes the following systems:
- A Linear Memory-Pool Allocator
- A Fixed Size Allocator
- A Custom Smart-Pointer System
- A 2D-Physics Engine
- A Box-2D Collision Engine
- Unreal's Actor Hierarchy System (To build Player & NPC actors from)
- Dynamic Component Attachment System (E.g. Keyboard Inputs, Box Collider, Circle Collider)
NOTE: Git doesn't recognize changes to the solution's Default Project. So you'd have to select Pong as the Default Startup Project under the Solution's Properties in Visual Studio
Here's a list of all the unique features the MemoryManager has:
- Primary Allocator Unit => Created a Fixed Size Allocator (FSA) & included 3 instances of it to handle allocations of different sizes (100 - 16 byte blocks | 200 - 32 byte blocks | 400 - 96 byte blocks)
- Header | C++
- The FSA is able to store anything less than its BLOCK SIZE to be stored in the first free block
- This one's highly efficient because of the BIT-ARRAY State-Keeper
- Backup Allocator => Pool Allocator
- The MemorySystem regulates the calls to the 3 FSAs or the Pool Allocator based on the size of the request
Features:
- Smart Pointer (reference) running a Reference Count book-keeping method to decide underlying pointer lifetime
- Weak Pointer running the same book-keeping method, for systems that just want to watch the underlying pointer, or get a Ref to the SmartPtr
Features:
- Config: [Mass], [Linear Damping], [Gravity], [Net Force]
- Every object has Velocity
- Acceleration is imparted based on the Mass, which in turn controls how fast the Velocity changes per frame
- Linear Damping controls the acceleration resisting force
- If you use the APPLY_FORCE(...) function, you'd change the NetForce value, which is applied each frame and cleared
Features:
- Swept-Axis Collision Check formula to deflect off 2-objects with an Impending Collision that's Less Than 1-frame-time
- Inter-Frame-Time-Forwarding to resolve more than 2 objects in collison sequentially
- Object can register a callback to get notified when it's colliding with anything
Implemented a World class which handles
- Actor Spawning (With and without JSON for prefab)
- BeginPlay()
- EventTick()
- Pause
- Quit
- Cleanup
How to play the game:
- Move the LEFT paddle up/down using W/S
- Move the RIGHT paddle up/down using I/K
- If the Ball moves past the left paddle, the right player's score increases by 1 (And vice versa)
- The first player to reach a score of 3 wins the game
- The windows shuts itself down to close the game, printing the win-state in the output log
NOTE: The walls comprise of white square bricks placed close to each other. Each reflect the ball in a random direction to give a sense of randomness to the game (Not really an interesting feature, but I just had in there since it makes it fun)