Rust Shooter
This is a performance aware asteroids game clone. This project has a data oriented structure. Also the language I used in this project is Rust, since it felt like a good opportunity to learn it. Performance testing of this project is done by creating an fps counter and also using Visual Studio's profiler.This project also has ECS(Entity Component System) and for that I'm using the crate specs. I focused on this project for 3 weeks. The first itteration of the project has very low fps, one reason is I used to create the textures for entites in every frame. To fix this I have created a Texture Manager which creates the textures at the start and keeps them in a container. When needed I called the textures from said container. Another reason is the sdl's way of handling the UI, in order to have a dynamic UI in sdl I created their textures from text surface everyframe, which is also very performance heavy operation. To fix this I kept the existing UI elements in a list and refreshed the list every 100 frames, which increased the performance nearly %400. Also every frame, for each entity, I'm checking if they collided with the existing entites in the world. This has an exponential time complexty. This can be avoided if we use an AABB trees for collision checking, the simplest way to implement is to separate the game scene into grids and checking collision inside these grids. However we atmost going to have one player so this is not that neccesary fix. What I have done:
Created Player/Asteroids/Rocket entities using Entity Component System
Created a Position, Renderabe components.
Created movement Logic, which changes the positions of objects
Created a Texture Manager that handles the loading and using of the textures
Created an Input Manager which handles the registration and usage of keys
Created the collision detection for Rocket, Player and Asteroid entities
What can be improved:
Changing the collision logic to AABB
Using an arena allocator to handle entity creation process