Leaderboards and aggressive enemies


Work has not stopped on the Space Bomber project. The last couple of days resulted in adding two relatively major updates, which I'm more than happy to describe below.

Leaderboards

Since there is no story in the game yet, it must offer some other kind of challenge that could keep players coming back to it. Adding a simple score with the last update was the first step. Now, the game comes equipped with a persistent local leaderboard where up to three high scores can be stored alongside a classic arcade-style three-letter acronym representing the player. Challenge your friends and yourself to get to the top.

Nothing about this feature is especially crazy from the coding point of view. Each high score row is instantiated from a prefab and the names and scores are stored in PlayerPrefs. Players can use the arrow keys to jump between letter and to select characters from a predefined set. The code is built in such a way that extending the number of rows is a matter of changing a single variable so the high score system can be easily modified in the future.


Aggressive AI

On the gameplay side, the enemies are now much more aggressive and can detect and rush toward the player character. This makes the game more challenging but also more interesting. It also led me to decrease the number of enemies per level because having dozens of them on relatively small levels was pandemonium and the two HP buffer proved to be insufficient. I'm still not sure if the difficulty is balanced enough but this is always a work in progress. 

The two different enemy types use different mechanisms to detect the player. The Ghost enemy has a radar that can see the player even through the obstacles. This is done by checking the distance between the player and the enemy and comparing it to a detection radius value that increases with each completed level. No physics components are used in this case - just simple vector maths. On the other hand, the Walkers use directional sonars which can shoot in two directions at the time - the direction they are moving at the moment and one perpendicular to that, depending on the previous movement direction. The sonar is implemented using raycasting and it can't pass through obstacles, so even putting a bomb in front of the enemy will discourage it from pursuing the player. Similarly to the Ghost's radar, Walkers get more sensitive as the game progresses and their detection range increases every time the hero walks through the portal.

The video below shows the aggressive behavior of the Ghost but feel free to check out the game itself and let me know how you like the new features and how they could be made better. Thank you for taking the time to read this entry and for helping me make Space Bomber a more enjoyable game.

Get Space Bomber

Leave a comment

Log in with itch.io to leave a comment.