4 ms·
This is a decent primer, but when it comes to actually implementing projectiles in games, things get more complicated (games are very complex). It’s important
by Kapura 7y ago
This is a decent primer, but when it comes to actually implementing projectiles in games, things get more complicated (games are very complex).
It’s important to keep performance considerations in mind, and be cognizant of when the performance characteristics change. For instance, if you’re working on a networked game, you have a huge set of constraints on what’s “easy” and what’s “performant” that do not exist in offline games. The projectile code is some of the most complicated in our engine just so that syncing state is consistent.
But right now I’m working on a boss fight, so I can optimize some damage code by only checking the projectile’s distance from the player against the projectile radius, instead of doing raycasts through our damage system. I also have more control of which things in the environment can be damaged by projectiles; another example of games being complex with lots of moving parts.