The Issue Of Optimization
Going into this sprint, I had an issue with the melee collision boxes being too plentiful and just spawning one after another continuously. This meant that whenever you would attack, it would spawn a hitbox for an attack and wouldn't go away until a pre-determined amount of time. This could have led to some issues later down the line where the lifetime of the collider box would have to be adjusted continuously due to several factors like attack speed and cooldown. This was also very inefficient as I was creating brand new sources and variables of information and quickly deleting them all over again, which can get pretty difficult to keep track of for the computer.
The Solution
The solution I came to was making a pre-determined hitbox size for each attack and then disabling their ability to hit objects based on a cooldown that can be easily modified. This made it possible to easily and quickly modify the active time of the hitboxes during runtime as well as make it much easier for the computer to process the information since they don't have to be made and deleted constantly. Moving forward, this is not only a great optimization for the gameplay, it's also a great way of streamlining the process to modify the existing hitboxes while the game runs, however, we see fit.
Did you like this post? Tell us
Leave a comment
Log in with your itch.io account to leave a comment.