Author Topic: Poison bug.  (Read 13374 times)

Offline Testlund

  • Bot God
  • *****
  • Posts: 1574
    • View Profile
Poison bug.
« on: November 01, 2005, 09:51:18 AM »
Ok, I can confirm that version 2.37.4 works much better now, but not full proof. Here's a bug report:

Tonight after I had run a simulation for 3 h 41 min I got a run-time error 6 overflow, but in a new place:

CODE:

rob(n).mem(poison) = rob(n).poison

LOCATION:

Shots_Module line 402

HOVERING INFO:

rob(n).mem(poison) = 30830

n = 837

poison = 827

rob(n).poison = 39630,29

Then I started a new simulation wich has been running with no problem for 10 h 10 min and is still running. So it works better but you might want to check out this one.
It runs very slowly, though. Check out screenshot.
The internet is corrupt and controlled by criminally minded people.

Offline Testlund

  • Bot God
  • *****
  • Posts: 1574
    • View Profile
Poison bug.
« Reply #1 on: November 01, 2005, 10:03:43 AM »
Eh? Didn't you like my screenshot, PY?  :huh:
The internet is corrupt and controlled by criminally minded people.

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Poison bug.
« Reply #2 on: November 01, 2005, 10:05:16 AM »
Screenshot?

I'm very confused.

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
Poison bug.
« Reply #3 on: November 01, 2005, 10:08:15 AM »
what value does "power" have in this subroutine. the level of poisin is defined by the "power" variable. If it has somehow become negative then I can understand this bug.

Also where do you get the line numbers from? I don't have any line numbers in my code.

For others who need more info, this crash is in routine "Releasenrg" in the "shots" module.
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D

Offline Testlund

  • Bot God
  • *****
  • Posts: 1574
    • View Profile
Poison bug.
« Reply #4 on: November 01, 2005, 10:09:34 AM »
I uploaded a screenshot to my report but then someone started kicking around my post here on the board and now my screenshot is gone. That's ok, it wasn't that important.
The internet is corrupt and controlled by criminally minded people.

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
Poison bug.
« Reply #5 on: November 01, 2005, 10:09:36 AM »
For some reason the screenshot disappeared when I moved the post.

I didn't delete it on purpose. feel free to add it back in by edit of your post if you still have the link.
« Last Edit: November 01, 2005, 10:15:50 AM by PurpleYouko »
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
Poison bug.
« Reply #6 on: November 01, 2005, 10:11:18 AM »
Quote
someone started kicking around my post here on the board
That was because it was OT for the thread in which you posted it.

I know that topics on the DB forum are normally very lax but in this bug forum I am trying to keep a tight reign on them.
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D

Offline Testlund

  • Bot God
  • *****
  • Posts: 1574
    • View Profile
Poison bug.
« Reply #7 on: November 01, 2005, 10:13:48 AM »
Quote
what value does "power" have in this subroutine. the level of poisin is defined by the "power" variable.
Here's the whole subrutine:

' robot n, hit by shot t, releases energy
Public Sub releasenrg(n As Integer, t As Integer)
  'n=robot number
  't=shot number
  Dim vx As Integer
  Dim vy As Integer
  Dim vs As Integer
  Dim vr As Single
  Dim power As Long
  Dim h2 As Integer
  Dim range As Single
  Dim scalingfactor As Single
  Dim Newangle As Single
     
  h2 = Half / 4
  vx = (Shots(t).vx - rob(n).vx) / -2 + rob(n).vx
  vy = (Shots(t).vy - rob(n).vy) / -2 + rob(n).vy
 
  If SimOpts.EnergyExType Then
    power = Shots(t).value * (Shots(t).nrg / Shots(t).range)
  Else
    power = SimOpts.EnergyFix
  End If
  If power > 8000 Then power = 8000
  If power > rob(n).nrg And Not rob(n).Corpse Then power = rob(n).nrg
  If rob(n).Corpse Then power = power * 0.5
 
  range = Shots(t).range     'new range formula based on range of incoming shot
 
  If rob(n).poison > power Then 'create poison shot
    createshot Shots(t).x, Shots(t).why, vx, vy, -5, n, power, range, vbYellow
    rob(n).Waste = rob(n).Waste + (power * 0.1)
    rob(n).poison = rob(n).poison - (power * 0.9)
    If rob(n).poison < 0 Then rob(n).poison = 0
    rob(n).mem(poison) = rob(n).poison
  Else ' create energy shot
    createshot Shots(t).x, Shots(t).why, vx, vy, -2, n, power, range, vbWhite
    rob(n).nrg = rob(n).nrg - power * 0.9  'some of shot comes from nrg
    rob(n).body = rob(n).body - power * 0.01 'some of shot comes from body
    rob(n).Radius = rob(n).body / factor
  End If
  If rob(n).body < 0 Or rob(n).nrg < 0 Then
    rob(Shots(t).Parent).kills = rob(Shots(t).Parent).kills + 1
    rob(Shots(t).Parent).mem(220) = rob(Shots(t).Parent).kills
  End If
  Shots(t).Exist = False
End Sub
The internet is corrupt and controlled by criminally minded people.

Offline Testlund

  • Bot God
  • *****
  • Posts: 1574
    • View Profile
Poison bug.
« Reply #8 on: November 01, 2005, 10:16:35 AM »
Oh, and I have included this fix as you can see:

If power > 8000 Then power = 8000
The internet is corrupt and controlled by criminally minded people.

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
Poison bug.
« Reply #9 on: November 01, 2005, 10:17:26 AM »
[hint]use the code tags to copy code up to the board or else you lose all formatting[/hint]

I know which routine it came from. I want to know what the hover value is for power when it crashed.
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D

Offline Testlund

  • Bot God
  • *****
  • Posts: 1574
    • View Profile
Poison bug.
« Reply #10 on: November 01, 2005, 10:18:46 AM »
Then I have to wait for another crash, right?
The internet is corrupt and controlled by criminally minded people.

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
Poison bug.
« Reply #11 on: November 01, 2005, 10:21:15 AM »
did that fix it? :blink:

It shouldn't have made any difference.

Code: [Select]
If rob(n).poison > power Then 'create poison shot
   createshot Shots(t).x, Shots(t).why, vx, vy, -5, n, power, range, vbYellow
   rob(n).Waste = rob(n).Waste + (power * 0.1)
   rob(n).poison = rob(n).poison - (power * 0.9)
   If rob(n).poison < 0 Then rob(n).poison = 0
   rob(n).mem(poison) = rob(n).poison
Else ' create energy shot

as you can see with the line..

Code: [Select]
rob(n).poison = rob(n).poison - (power * 0.9)rob(n).poison is reduced by a value equal to 0.9 time power.

If power is big then it should be reduced more

I suspect that power is actually negative since poison has increased.

That should NOT be able to happen.
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
Poison bug.
« Reply #12 on: November 01, 2005, 10:23:50 AM »
Quote
Then I have to wait for another crash, right?
'fraid so.
Once it crashes then you can do all kinds of stuff.
When it's happily running you are effectively shafted as far as debugging goes.

That is precisely the problem that Num and I have been up against for so long.
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Poison bug.
« Reply #13 on: November 01, 2005, 10:24:59 AM »
I've had to just leave it running over night.  The problem is that interesting simulations tend to have all the bots die from time to time...

Offline Testlund

  • Bot God
  • *****
  • Posts: 1574
    • View Profile
Poison bug.
« Reply #14 on: November 01, 2005, 10:27:33 AM »
No, I mean the above fix I put in was for the crash you had recently. I just read about it and put it into the subroutine I posted above. I thought that was related to this issue.

So... If I crash next time at the same location you want the hovering info from THIS code instead?

rob(n).poison = rob(n).poison - (power * 0.9)

Is that what you mean?
The internet is corrupt and controlled by criminally minded people.