Simple Bullet Shadowing Surfer
← Thread:Talk:BasicSurfer/Simple Bullet Shadowing Surfer/reply (2)
- Both Diamond and Gilgalad use bullet shadows but IIRC Gilgalad's code was optimized for speed and made it harder to understand.
- If you plan on using bullet shadows with bins(Slightly less effective), both DrussGT and WhiteFang use it.
- DrussGT calculates all the shadows before hand while WhiteFang calculates them when the bullet overlaps the wave(Easier to implement and shorter code).
- BTW, anybody setting wave dangers as done below?
Position danger = (bulletPassed ? 0: chanceOfBulletCollision) * dangerWithoutShadows
Edit: fix a mistake
This is not correct, although I've made the same mistake the first time thinking about this.
The catch point is that, even if your bullet passed safely, you know the intersection must contain no bullet, so the shadow of the bullet still exists
- Sorry, I fixed the code.
- My point was: Wouldn't it be smarter to deduct (100 - x) percent of the danger if the chance of the bullet colliding is x percent.
This is incorrect, because bullet shadow has nothing to do with whether bullets collide or not — it’s all about information. You know perfectly you won’t get hit in the shadow, so danger is 0. You still get hit by the part outside of shadow in the incoming wave though.
You do not have permission to edit this page, for the following reasons:
You can view and copy the source of this page.
Return to Thread:Talk:BasicSurfer/Simple Bullet Shadowing Surfer/reply (7).
Okay, I think I get it. Would the formula be
PositionDanger = bulletPassedWave == true ? 0 : normalDanger
And if you are surfing multiple waves, you can estimate the chance that the wave2 will have a shadow by calculating in the percent chance the bullet will collide and add that to your calculations. Of course, once wave1 breaks, you can know for sure whether the position is 100% safe or not.
Yes, bullet shadows can be deleted, when the bullet casting shadow is destroyed before intersection happens.
However, I don’t think modeling this helps anything, since 1. we are already recalculating shadows when collision happens 2. the chance of actual collision is always low for normal battles. 3. You don’t know that chance exactly, an estimation may decrease performance actually.
To accurately model the chance of bullet getting destroyed before intersection happens, you should consider more than a flat probability — since once a bullet passes all other waves except target wave, the only chance bullet collision happening is with the target wave.
I don’t think this added complexity should outperform traditional way that updates shadows when collisions actually happen.