Treasure Diver: Dev Log #2

The plan for today is to get the start button connected, the game over screen to allow for a 5 character name to be entered, have the score submit to the server and written to the database.
On opening up the file and giving the game a quick play test I was not really happy with the hit box for the player, things would hit the hit box and not the player due to the same hit box being used for both idle and swimming just being rotated which means that either the hit box was either to small and chests would be missed or it was too big and register so caused unfair death.

Fixing The Collisions

Fixing the collisions was simple enough, switch from a rectangular collider to a polygon collider and then setting two separate colliders for the two states (idle and swimming) and disabling the one that was not in use. This seems to work fairly well for now.

The Difficulty System

I wanted the game to get progressively harder as the player accrued more and more points. The best way I could think to do this was have 3 main factors to the difficulty

  • Amount Of Enemies On Screen
  • Enemy Speed
  • Variation Of Enemies

Amount Of Enemies On Screen

Every time a new chest is collected the amount of enemy’s allowed on screen increases by 1, this did however come with it’s own issue. when the window is smaller than full screen on a 1080p panel the game would feel right, however maximizing the window would cause the window to feel empty, I needed a way to increase the base number of enemies based on the resolution of the monitor.

max_active_enemies=round(float(sub_viewport_size.y)/float(sub_viewport_size.x)*50) 

To do this I got the Y and X values of the playable area, divide them and multiply the output by 50. Why 50? the answer to that is just 100 gave me 55 enemies on screen (based on a 1080p monitor) and that felt like too much and half that amount feels a lot better as a starting point.

Enemy Speed

The enemy speed is selected from a range, it picks a random number between 170 and 250 to start with and every second chest that is picked up increases the speed that enemies will be moving at by 20 (so after the second chest the speed numbers become 190 and 270), its a small enough difference that it is not super noticeable at first but as the game goes on the enemies become faster and faster but due to the slow build up it never feels like they are moving too fast.

Variation Of Enemies

At the moment there are 3 enemy types with another 3 planned. The current 3 are all fish that are generated on a side of the screen, pointed at a rotation and then sent on their trajectory. The game starts with a single enemy type and then every 3rd chest that is collected a new enemy type is added into the list of available enemies. They differ in size and are selected at random so each time the game is played the starting enemy may be different. The next set of enemies will be dropped in from the top of the screen, at the moment I am undecided if they will be on their own timer or if I will use the chest timer and have it sometimes drop a chest that can be collected or a barrel that will kill the player, or if I will set it up on it’s own timer so that the barrel drops are independent of the chests.

Leave a Reply