Darwinbots Forum

Code center => Bugs and fixes => Solved Bugs => Topic started by: PurpleYouko on November 01, 2005, 09:21:18 AM

Title: New bug with shot power
Post by: PurpleYouko on November 01, 2005, 09:21:18 AM
My sim crashed again.

At least this one is completely unrelated to the velocity bug.

It would seem that shot power is sometimes exceeding the realms of decency (32000 that would be)

The culprit routine is "releasebod" in the "shots" module.

find this piece of code near the top of the routine.
Code: [Select]
If SimOpts.EnergyExType Then
   power = Shots(t).nrg / Shots(t).range * Shots(t).value
Else
   power = SimOpts.EnergyFix
End If
and add this line immediately after it.
Code: [Select]
If power > 8000 Then power = 8000
Why 8000 and not 32000?

Because later in this same routine, shots fired by corpses get a 4X multiple. Not really sure why that is. This section was added by Num in one of the recent releases.

Anyway, limiting the power to 8000 prevents the crash.
Title: New bug with shot power
Post by: Numsgil on November 01, 2005, 10:01:48 AM
I believe the 4x multiple is actually a relic from the origin of body shots.  That is, way before I joined.
Title: New bug with shot power
Post by: PurpleYouko on November 01, 2005, 10:13:18 AM
You could be right there. The code is so darn big that us poor programmers can't be expected to remember everything we change.

I may have to go in and re-write that section completely.

Any idea why power is getting so darn big in the first place?
Title: New bug with shot power
Post by: Numsgil on November 01, 2005, 10:14:41 AM
Probably a bot with alot of body.  Or maybe a bot is powering up a shot using shootval.
Title: New bug with shot power
Post by: PurpleYouko on November 14, 2005, 03:12:02 PM
Problem fixed by the shot - power / poison bug fix.