Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(2 edits)

Interestingly, I did nearly the same in Godot ! A tutorial from KidsCanCode recommended to use an AnimationPlayer to toggle the collider on and off (since in Godot everything can be animated) so you don’t need to write code to toggle it. Since my gameplay components were split among several scenes, it was simpler for me to use a timer variable though.

I was very generous with the hit collider, but I think it was the right choice - it fits the animation well and gives a bigger feeling of control to the player.

Now, a thing I discovered and used for the first time during this jam was object pooling ! In every engine and language, creating a new object has a cost. In Godot, since you’re often loading other scenes (which is similar to prefabs in Unity) this cost can be reduced by loading the scene at the start and instancing it when needed. But even that is slow because the instance needs to be added to the scene tree.

For a single object that is only created once, or created multiple times but at very large intervals, this is perfectly fine. But in a bullet-hell where hundreds of bullets are created each second, this will slow down the game extremely fast !

In our game, we have a bullet-hell boss that shoots around 10 bullets/s. The player’s bullets use instancing, but it wasn’t gonna be possible for this boss. The solution to this problem is bullet pooling: You instance a set number of objects at the start of the scene, and just show/hide them when needed !

Here’s how I do it for the Flesh Monolith:

  • at the start of the scene, I instance a limited amount of bullets (200 here)
  • I hide and deactivate them all, then put their references in an array and use a pool_index variable to track the current bullet
  • when the boss needs to shoot a bullet, I take the current bullet (the bullet at the pool_index in the array), show it and activate it with the wanted direction and speed. Then I increase the pool_index by 1
  • when the bullet leaves the screen or hits something, it hides itself

If you instance enough bullets at the start of the scene, it will be unnoticeable ! There’s also a version where I switched bullets from a pool_available to a pool_process array, but reindexing the array every time wasn’t the best idea.