Code center > Bug reports

Runtime Error '6' Overflow

<< < (2/2)

Numsgil:
I'll bet it's the same bug then.

Griz:
well ...
I did finally get the runtime error 6 overflow  ...
and a error.sim.
at about 530 cycles in, with 938 bots.
with the high population of bots, >1000 ...
even my compiled version creeps along between 0 and 1 cycles/second.
so this can take some time to get an error.
 
loaded and ran it thru the VB version ...
and now we are really slow!!!!

and I haven' been able to get it to overflow.
I have my 'venom fix commented out' but ... ???

anyway ...
rerunning it with only the eric1 bots ...
veg pop capped at 100, and veg nrg/cycle at 40 instead of 400
so it runs a little faster.
and ...
I'm wondering if a great pop of bots ....
and/or a large nrg/cycle for veggies might also lead
to an overflow of some sort.
can't get it to overflow so far. ?????
 

hey Nums ...
IF/WHEN we put out a new version of 2.37.8 ...
be sure to uncomment the error.sim saving routine before compiling.
.37.6 doesn't have it enabled.

Eric ...
in the lookoccur mod
at the very end of the subroutine ...
try inserting:

If rob(n).venom > 32000 Then rob(n).venom = 32000

just ahead of:

  rob(n).mem(825) = rob(n).venom
  rob(n).mem(827) = rob(n).poison  
End Sub

that's the venom fix we have for now.
and see it that makes any difference.

also ...
if you are going to recompile yourself ...
in this sub:
uncomment the goto fine: line
Private Function carica(path As String, n As Integer) As Boolean
  On Error GoTo fine:

to enable the error.sim write.

will continue to play ...
check back later.

oh yeah ...
here's the error.sim it saved on the overflow error

it's larger than normal ... LOTS of bots. ;)


grrrrrrrrrr!
why can't I upload a zip file?
one more try

ok ...
I get the message:
You cannot upload this type of file
ok
I get the message.
screw it.

EricL:
Got it.  It's not the same error.  The overflow is occuring in the Poisons subroutine in Robots.bas where .Paracount is being assigned to .mem(837).


--- Code: ---If .Paralyzed Then
    .Paracount = .Paracount - 1
    .mem(837) = .Paracount      '<- OVERFLOW OCCURS HERE
    If .Paracount < 1 Then .Paralyzed = False: .Vloc = 0: .Vval = 0
End If
--- End code ---
Before the overflow, .mem(837) is 32755 (which is less than 2^15).   .Paracount has the value 32803 (which is greater than 2^15).  The assignment causes the overflow.

It's been a long time since I worked in VB, but .mem is an array of (signed) integers and .Paracount is a Single.  Seems my bots shot so much venom into some other bot that it exceeded the design limits of the .mem array.

I've added these three lines at line 518 in the 'takeeven' subroutine in Shots_Module.bas.


--- Code: ---rob(n).Paralyzed = True
rob(n).Paracount = rob(n).Paracount + power

If rob(n).Paracount > 32000 Then    '<- THIS LINE ADDED
  rob(n).Paracount = 32000         '<- THIS LINE ADDED
End If                                 '<- THIS LINE ADDED

If Shots(t).Memloc > 0 Then.......
--- End code ---
Hopefully that should take care of the overflow.  Been running the fixed code for awhile now and it hasn't crashed yet...

PS Thanks Griz for the fix.  I've recompiled a private with both fixes.  From what I can tell, the issues appear different but related I.e. both are .mem integer overflows.

PurpleYouko:
Well that is certainly a new one.

It looks like the fix you have applied is the correct one. It takes care of the problem at source instead of just patching it.

The problem is that paracount is cumulative. It only decays away at a rate of one per round and if the bot gets blasted with more then it just keeps getting bigger.

EricL:
I woke up in the middle of the night realizing there was a bug in my fix.  It could still overflow .mem if a bot shot a ton of venom into a already heaviliy venomized bot all in one shot.  If power is really big, say like 1000, then Paracount could overflow before my check.  So I changed it to this which tests for a possible overflow before power gets added.


--- Code: ---If ((rob(n).Paracount + power) > 32000) Then
      rob(n).Paracount = 32000
    Else
      rob(n).Paracount = rob(n).Paracount + power
    End If
--- End code ---

I'm doing the addition twice in the main line case but good enough for now...

Regards,

-E

Navigation

[0] Message Index

[*] Previous page

Go to full version