General > Announcements

Version 2.42.5 Released

<< < (4/5) > >>

EricL:

--- Quote from: Numsgil ---I thought poffs were strictly ornamental.
--- End quote ---

Perhaps they should be, but today makepoff() calls createshot() (20 times) passing RobSize * 2 which gets assigned to the shot energy.  Magic energy from death... reminds me of Larry Niven's Magic Goes Away novels...

If poffs were strictly ornimental, I could exclude them entirely from collision detection.  That would be nice.

Numsgil:
I am 95% certain that poffs are strictly decoration.
 
 Corpses fire off shots periodically, which is the way I think the simulation is meant to deliver energy from dead things.
 
 Plus the disable poff button wouldn't make much sense if they effected the simulation.
 
 If poffs aren't just decoration, I think it's a "bug" (more unintended feature than bug really, but still).

PurpleYouko:
Corpses were a feature that I added around V3.1. prior to that there was no way that I was aware of that energy could be redeamed from a dead bot.

If as you say, the POFFs contain energy then it is a bug/feature that has been entirely overlooked for a long long time.
I say time to break out the bug squisher.  

EricL:

--- Quote from: Numsgil ---Hehe, okay, this is taking less time than I thought
 
 
--- Code: --- deltapos = botpos - shotpos
 deltavel = botvel - shotvel
 L2vel = squaredlength(deltavel)
 
 t0 = -(deltapos) dot deltavel + bot radius * sqrt(L2vel)
        -----------------------------------------------
                  L2vel
 
 t1 = -(deltapos) dot deltavel - bot radius * sqrt(L2vel)
        ------------------------------------------------
                      L2vel
 
 bool uset0 = true, uset1 = true
 time t <-- collision time
 
 if(t0 < 0 || t0 > 1)
     uset0 = false
 
 if(t1 < 0 || t1 > 1)
     uset1 = false
 
 if(uset0 = false and uset1 = false)
     the shot and bot don't collide
 
 if(uset0 = true and uset1 = true)
     t = min(t0, t1)
 
 else if(uset0 = true)
     t = t0
 
 else
     t = t1
 
 Now that we have t, we can find the pos of the bot and shot when they collided:
 
 posbot = oldbotpos + t * botvel
 
 posshot = oldshotpos + t * shotvel
--- End code ---

 That's all from the top of my head, so someone feel free to double check the figures.  The basic algorithm is sound though (construct a quadratic and solve it)
--- End quote ---


I've been looking at this and I don't get the same factors.    Hey Nums, can you elaborate on your derivation for factoring the quadratic equation?

Numsgil:
The vector math makes some things a little funny.
 
 Solving the quadratic equation you get:
 
 t = -2 * deltapos dot deltavel +/- sqrt( (2 * deltapos dot deltavel) ^ 2 - 4 * deltavel dot deltavel * (deltapos dot deltapos - radius ^ 2)) / (2 * deltavel dot deltavel)
 
 I believe.  The vector math makes things tricky.  I don't remember exactly how I got whatever answer I got.  If I had the resources I'd just let something like matlab do the factoring.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version