Darwinbots Forum
Code center => Bugs and fixes => Bug reports => Topic started by: EricL on March 13, 2006, 12:07:48 AM
-
Not sure if anyone cares about bugs in the VB fork anymore, but this one repros pretty quick, say within 5 minutes of starting the sim. You don't have to do anything, just run the sim and wait.
Nothing too special about the bots. Just a snapshot of my first bot attempt which uses some venom and the recently posted Swarm (http://forum.darwinbots.com/index.php?showtopic=1156).
If people care and the cause isn't immediatly obvious, I can try to repro it in VB and get a stack trace tomorrow...
Sim is attached.
-E
-
I'll give it a look see later tomorrow.
If this is a different bug from the one Griz found, we might release a fixed version.
-
sorry, the Overflow.sim file won't load for me.
not in 2.37.6 or 2.4x
all I get is the last sim I ran ...
and in the case of version 2.4, a sim load error.
I did run sims using your Swarm bot many times the other day ...
in many different sim settings and never had a problem.
that was using my revised version 2.37.6 ..
with the repro bug I found, bandaged.
btw ... that was an error with overflow due to
rob(n).venom > 32000
not sure if your Swarm bot even uses it.
will see if I find time today to run Swarm with the 2.37.6
version before that patch and see what happens.
perhaps you could upload a 'settings' file ...
so I can get some of those set to the same config.
-
I also ran numerous sims with just swarm yesturday. No crashes then. I only get the crash when I put my bot (Ericl1) and swarm together. Then I get it everythime within a few minutes using any one of a variety of settings. I do suspect it has something to do with venom and may very well be the same bug referenced below. Swarm does not use venom by mine does. My bot is a half baked, half finished attempt to use swarm's proximity against it using venom. I started getting the crashes after I had successfully learned how to use venom to overwrite swarm's .myeye.
Attached is a settings file (slightly different settings then the sim) which exhibits the crash in about 3 minutes under 2.4A for me.
-
Here is my half-baked, half finished bot which plays with venom.
-E
-
I'll bet it's the same bug then.
-
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.
-
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).
If .Paralyzed Then
.Paracount = .Paracount - 1
.mem(837) = .Paracount '<- OVERFLOW OCCURS HERE
If .Paracount < 1 Then .Paralyzed = False: .Vloc = 0: .Vval = 0
End If
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.
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.......
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.
-
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.
-
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.
If ((rob(n).Paracount + power) > 32000) Then
rob(n).Paracount = 32000
Else
rob(n).Paracount = rob(n).Paracount + power
End If
I'm doing the addition twice in the main line case but good enough for now...
Regards,
-E