Work In Progress / 02 August 2023

[DevLog] [Project RXD] Calculating range

During this week, I worked on damage calculation for my project. Initially, I considered using a physics library, but due to its extensive content, which goes beyond the needs of my project, I decided to implement the attack range calculations myself.

For my character, the attack range is represented as a circular sector. To determine the valid targets within this range, I first calculated the distance between the player and each enemy. Then, I filtered out the enemies located outside the circular area of the range to optimize the subsequent intersection checks.

Once the group of close enemies was identified, I proceeded to check their intersection with the circular sector. To achieve this, I utilized vectors V1 and V3 to represent the boundaries of the sector. By analyzing whether the vector formed from the player to the enemy was clockwise or counterclockwise, I could determine if the enemy fell within the sector or not.

The implementation yielded promising results, allowing my character to efficiently identify and engage with nearby enemies. Further optimizations and enhancements are possible by exploring additional algorithms and mathematical concepts.