Author Topic: runtime 6/compile error  (Read 24108 times)

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
runtime 6/compile error
« Reply #30 on: October 28, 2005, 01:21:15 PM »
OK the weirdness begins.

First the offending robot o is not a corpse. Second, it is fixed so it isn't even moving even though its .vy is showing 66085.34.

Pretty fast for a bot that is rooted to the spot don't you think?  :blink:

What is even weirder is that after tracing where the call to "Lookoccur" comes from, I found it comes from the very top of "Writesenses" (senses module) before any manipulation of variable could take place.

Tracing back further shows the call to "Writesenses" comes from "Updatepos" (Robots module)

A few lines up "Updatepos" I find this chunk of code.
Code: [Select]
If .mem(216) <> 0 Then
   .Fixed = True
   .vx = 0
   .vy = 0
Else

This sets .fixed to true (as it is in the offending rob(o)). It sets both .vx and .vy to zero also

You know what is missing?  :D

Something to reset .vx and .ax if the bot is already fixed.

The code I examined earlier (updatepos in the physics module) doesn't do this. Here it is again

Code: [Select]
If t <> moving And Not rob(t).Fixed Then
    Maxspeed = 30 / (.mass / 2) 'Set maximum speed. Absolute max = 60
    

You see it specifically excludes fixed robots from this entire calculation routine to save processing time.

We have two choices.
  • remove "And Not Rob(t).Fixed" from this line of code
  • Add another little catch all condition in "Updatepos" to make sure that .vx and .vy are set to zero if a robot is fixed
I think the latter will run faster

find this section of code in "Updatepos"
Code: [Select]
If .mem(216) <> 0 Then
   .Fixed = True
   .vx = 0
   .vy = 0
Else
   .Fixed = False
End If

and change it to
Code: [Select]
If .mem(216) <> 0 Then
   .Fixed = True
Else
   .Fixed = False
End If
if .Fixed then
   .vx = 0
   .vy = 0
Endif

That should hopefully put this problem to bed once and for all.
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
runtime 6/compile error
« Reply #31 on: October 28, 2005, 01:38:17 PM »
After applying this fix, I had to restart the sim since a huge number of the bots had screwed up memories with massive values in them. While it is possible to repair them one by one as the program runs, I got sick of doing so after the first 30 or so.  :rolleyes:
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
runtime 6/compile error
« Reply #32 on: October 28, 2005, 02:01:37 PM »
Wich window is the above mensioned code supposed to go?

Oh, the robots module!   :)
« Last Edit: October 28, 2005, 02:59:45 PM by Testlund »
The internet is corrupt and controlled by criminally minded people.

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
runtime 6/compile error
« Reply #33 on: October 28, 2005, 02:58:28 PM »
Quote
Tracing back further shows the call to "Writesenses" comes from "Updatepos" (Robots module)

That one. As I said before.

Sorry if I wasn't being explicit enough. I thought I was.  :(
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
runtime 6/compile error
« Reply #34 on: October 28, 2005, 03:02:28 PM »
Just one more thing before you leave!

This fix is instead of the other ones mensioned in this topic, right, or should those be aplied as well?
The internet is corrupt and controlled by criminally minded people.

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
runtime 6/compile error
« Reply #35 on: October 28, 2005, 03:36:53 PM »
Quote
find this section of code in "Updatepos"
Code: [Select]
If .mem(216) <> 0 Then
   .Fixed = True
   .vx = 0
   .vy = 0
Else
   .Fixed = False
End If

and change it to
Code: [Select]
If .mem(216) <> 0 Then
   .Fixed = True
Else
   .Fixed = False
End If
if .Fixed then
   .vx = 0
   .vy = 0
Endif
The two are logically identical (that is, they both do the same thing).

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
runtime 6/compile error
« Reply #36 on: October 28, 2005, 03:37:33 PM »
The other fixes aren't hurting anything, so they can be kept or dropped, it doesn't matter.

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
runtime 6/compile error
« Reply #37 on: October 28, 2005, 04:25:47 PM »
Actually the hovering over the values again was so I could see if it was breaking in the same old way or in a new way.

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
runtime 6/compile error
« Reply #38 on: October 28, 2005, 05:15:25 PM »
velocity is always going to be <= 32000 beacuse they're stored in ints.

What you want to check is that it's <= MaxVel (which is 60 in 2.37.4)

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
runtime 6/compile error
« Reply #39 on: October 28, 2005, 05:45:42 PM »
Maybe velocity is stored as longs?

Still shouldn't be > 60.

Offline Testlund

  • Bot God
  • *****
  • Posts: 1574
    • View Profile
runtime 6/compile error
« Reply #40 on: October 28, 2005, 05:51:40 PM »
After 1 h 20 min I got the run-time error 6 again.

PY's solution above didn't work, as none of the solutions so far. We need something new to try, I think.

OFEENDING CODE:

rob(n).mem(refveldx) = (rob(o).vy * Cos(rob(n).aim) + rob(o).vx * Sin(rob(n).aim)) - rob(n).mem(veldx)

Location: Senses module at line 481.

HOVERING INFO:

rob(n).mem(refveldx) = 14660

n = 381

refveldx = 697

rob(o).vy = 53168,43

o = 456

rob(n).aim = 5,700001

rob(o).vx = 21,39198

rob(n).mem(veldx) = 2460

veldx = 198
« Last Edit: October 28, 2005, 05:54:20 PM by Testlund »
The internet is corrupt and controlled by criminally minded people.

Offline Testlund

  • Bot God
  • *****
  • Posts: 1574
    • View Profile
runtime 6/compile error
« Reply #41 on: October 28, 2005, 05:56:53 PM »
It's gonna crash, Griz. Just you wait!  :evil:
The internet is corrupt and controlled by criminally minded people.

Offline Testlund

  • Bot God
  • *****
  • Posts: 1574
    • View Profile
runtime 6/compile error
« Reply #42 on: October 28, 2005, 06:08:50 PM »
Quote
[QUOTEdid you put it in an try it yet?
Yep, I did. If you go back a little in this topic you see that I've posted that I still get the run-time error 6 overflow.
The internet is corrupt and controlled by criminally minded people.

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
runtime 6/compile error
« Reply #43 on: October 28, 2005, 06:15:02 PM »
code a hard limit rob(o).vx and .vy to 60 right before the crash.

I'm sort of in a rush in the moment (going to SixFlags tomorrow, hve to drive 3.5 hours to get there) so I can't produce the code to do it, but that should do it.

Offline Testlund

  • Bot God
  • *****
  • Posts: 1574
    • View Profile
runtime 6/compile error
« Reply #44 on: October 28, 2005, 06:21:32 PM »
You're talking about reproducing the crash here, right? I guess that's for you developers. I don't need to force the program to crash. lol :lol:
The internet is corrupt and controlled by criminally minded people.