4 ms·
"Can you cast a smaller set of rays first, and only cast the in-between rays if certain conditions are met " Yes I can do this. But my case is really special a
by hutzlibu 3y ago
"Can you cast a smaller set of rays first, and only cast the in-between rays if certain conditions are met "
Yes I can do this. But my case is really special as in basically the players have to do this by themself. As it is (also) a hacking game, meaning they have a limited scan budget and need to figure out to spend it the most useful for their bots.. but since they also want to evade projectiles and other bots, they want to scan as much as possible to not miss a threat.
So it works the way it is. Just would scale better, with better raycast performance.
I probably should have hinted more above, why my case is really special, but that was kind of my point, there are always special cases. And I do not want to limit my design, because of a bad raycast implementation.
- otto2 3y agoYou can still optimize this. If the scan has to establish line-of-sight between bots, your engine can establish that, and when firing raycasts, to skip those that are known to be misses. It doesn't change anything for the bot that fires raycasts. You could also calculate extremes (leftmost and rightmost) and return positives in between. This would decrease number of raycasts by two orders of magnitude. Also add a possibility to skip every 2nd, 3rd etc frame so that you can evaluate if it impacts game play.