Link to downloadable: https://drive.google.com/uc?export=download&id=1EWKodWYD41nRqkjcuclFuLYcWQVw_1kN
It is a Top down Shooter, where use WASD to move the player, Arrow key to shoot bullet. The following image shows how this game works.
The red part is the stand plane, the blue cube is the player. Player can move around this red area; the bullet will shoot in four directions depending on which arrow key is pressing. Bullet will be spawned nearby the player. When the bullet hit the enemy, enemy will die and respawn in random position in the area.
Using Engine Systems
I used my input system to handle player input like moving the player, shooting the bullet. I felt like I am comfortable to use my system when the game did not require complicated input. But I forget to provide the clean up function for other to clean up the handle. Other users need to clean up manually.
I have created a PlayerActor class that inherited my core object class and use the following function to handle input.
The following codes showed how I handled the shooting interval.
Additionally, I used PlutoShe’s Collision system to do the collision detection for bullets and the enemy. Here is the link to his website: http://www.plutoshe.com/blog/project1_writeup
I will add a box collider to both the bullet and the enemy. Other than that, I added collision response to them, when the bullet is colliding with the enemy, the enemy will be respawned.
When I trying to call delete m_Boxcollider, it said that there is no destructor for Collider class
Other than that, it was fun to look at other’s code and see their implementation of builder and why they do that.
Making a game
It was tricky to know what data is needed to be submitted to render thread. I allocated 10 bullet actors at the initialization of the game. I declared a parameter call visibility in the actor. If any actor is invisible, in this submission, it will not be submitted. To achieve that, I did something like the following picture:
I cleared the render list, and checked the visibility for every actor every frame. If the actor is visible, I added the pair of <Geometry, Effect> to the render list and submit this list to render thread.
My question is that whether it is a correct and efficient way to check the visibility of rendering components or not when there are large amount of rendering components needed to be iterated through.
If I have more time, I would like to do more research about how industries engine handle this situation.