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

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
runtime 6/compile error
« Reply #15 on: October 28, 2005, 11:12:31 AM »
Not more than one fix.

Num's idea in the other thread is a work-around. It addresses the symptom without finding the root cause.

This fix here will stop the robots moving too fast in the first place so the other issue will never even arise.
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 #16 on: October 28, 2005, 11:25:35 AM »
So... These are not needed anymore?

if abs(rob(o).vx) > rob(o).MaxVel then rob(o).vx = sgn(rob(o).vx) * rob(o).MaxVel
if abs(rob(o).vy) > rob(o).MaxVel then rob(o).vy = sgn(rob(o).vy) * rob(o).MaxVel

I'll only change the robot code you mensioned here, is that it?

But the code that was there before I put the .maxwell codes in are gone, so I doubt it will work just like that. I think I need to download the sourcecode again and just add the latest solutions you've mensioned here. ..I guess. O, my...
The internet is corrupt and controlled by criminally minded people.

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
runtime 6/compile error
« Reply #17 on: October 28, 2005, 12:03:40 PM »
In 2.4 I believe I changed MaxVel to either a SimOpts member or a robot member and set it equal to 60 for all bots (since heavier bots now cost more to move... didn't seem right to limit their max velocity if they can output the energy to get there).

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
runtime 6/compile error
« Reply #18 on: October 28, 2005, 12:05:40 PM »
Not only are these lines not needed. They are impossible

rob(o).MaxVel does not exist and will cause a crash as soon as you try to execute it.

Here is the original, unaltered code for the entire lookoccur routine.
Code: [Select]
' copies the occurr array of a viewed robot
' in the ref* vars of the viewing one
Public Sub lookoccurr(n As Integer, o As Integer)
  If rob(n).Corpse Then Exit Sub
  Dim t As Byte
  'If rob(n).lastviewed <> rob(o).AbsNum Then
    For t = 1 To 8
      rob(n).mem(occurrstart + t) = rob(o).occurr(t)
    Next t
    rob(n).lastviewed = rob(o).AbsNum
  'End If
  If rob(o).nrg < 32001 Then
    rob(n).mem(occurrstart + 9) = rob(o).nrg
  Else
    rob(n).mem(occurrstart + 9) = 32000
  End If
  rob(n).mem(occurrstart + 10) = rob(o).age '.refage
  rob(n).mem(in1) = rob(o).mem(out1)
  rob(n).mem(in2) = rob(o).mem(out2)
  rob(n).mem(711) = rob(o).mem(18)      'refaim
  rob(n).mem(712) = rob(o).occurr(9)    'reftie
  rob(n).mem(refshell) = rob(o).Shell
  rob(n).mem(refbody) = rob(o).body
  rob(n).mem(refypos) = rob(o).mem(217)
  rob(n).mem(refxpos) = rob(o).mem(219)
  'give reference variables from the bots frame of reference
  rob(n).mem(refvelup) = (rob(o).vx * Cos(rob(n).aim) + rob(o).vy * Sin(rob(n).aim) * -1) - rob(n).mem(velup)
  rob(n).mem(refveldn) = rob(n).mem(refvelup) * -1
  rob(n).mem(refveldx) = (rob(o).vy * Cos(rob(n).aim) + rob(o).vx * Sin(rob(n).aim)) - rob(n).mem(veldx)
  rob(n).mem(refvelsx) = rob(n).mem(refvelsx) * -1
  rob(n).mem(refvelscalar) = Sqr(rob(n).mem(refvelup) ^ 2 + rob(n).mem(refveldx) ^ 2) ' how fast is this robot moving compared to me?
  rob(n).mem(713) = rob(o).mem(827)     'refpoison. current value of poison. not poison commands
  rob(n).mem(714) = rob(o).mem(825)     'refvenom (as with poison)
  rob(n).mem(715) = rob(o).kills        'refkills
   If rob(o).Multibot = True Then
    rob(n).mem(refmulti) = 1
  Else
    rob(n).mem(refmulti) = 0
  End If
  If rob(n).mem(474) > 0 And rob(n).mem(474) <= 1000 Then 'readmem and memloc couple used to read a specified memory location of the target robot
    rob(n).mem(473) = rob(o).mem(rob(n).mem(474))
    'rob(n).mem(474) = 0
  End If
  If rob(o).Fixed Then                  'reffixed. Tells if a viewed robot is fixed by .fixpos.
    rob(n).mem(477) = 1
  Else
    rob(n).mem(477) = 0
  End If
  rob(n).mem(825) = rob(n).venom
  rob(n).mem(827) = rob(n).poison
    
End Sub

Note. In future when entering new lines of code, just comment out the old ones until you are sure you will never need them again.  :D
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 #19 on: October 28, 2005, 12:19:24 PM »
Ok, I downloaded the sourcecode again and started over. I made the changes in the robots module as PY mensioned in this topic. After that I got the overflow again.

Code:

rob(n).mem(refvelup) = (rob(o).vx * Cos(rob(n).aim) + rob(o).vy * Sin(rob(n).aim) * -1) - rob(n).mem(velup)

This was supposed to have been fixed by making the changes in the robots module, right? Looks like that's not enough.
The internet is corrupt and controlled by criminally minded people.

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
runtime 6/compile error
« Reply #20 on: October 28, 2005, 12:21:24 PM »
Can yuo hover-find the values of the varaibles again?

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
runtime 6/compile error
« Reply #21 on: October 28, 2005, 12:21:47 PM »
Can't remember if you listed it before but what exactly is rob(o)

Is it a corpse?
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 #22 on: October 28, 2005, 12:24:41 PM »
Quote
Can yuo hover-find the values of the varaibles again?
Sorry. I have to run a simulation again first and wait for another crash. Looks like the code line must be marked with yellow for the value pop-ups to appear. I'll be back.
The internet is corrupt and controlled by criminally minded people.

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
runtime 6/compile error
« Reply #23 on: October 28, 2005, 12:29:20 PM »
No it doesn't have to be yellow. It just has to be in debug mode which you enter on a crash.

When it breaks again, don't restart. There are loads of diagnostic stuff we can do while it is in debug mode.
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
runtime 6/compile error
« Reply #24 on: October 28, 2005, 12:38:52 PM »
You can also enter debug mode by going to VB and hitting pause, but this won't help if you're bug hunting because the code might be (and probably will be) just fine and without error.

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
runtime 6/compile error
« Reply #25 on: October 28, 2005, 12:43:11 PM »
And it also breaks in the wrong place and won't give access to variables by mouse hovering.

A better way is to set a break point in the routine where you want to debug.

Still no good if all the values are perfectly within normal parameters though. That is why I go into another routine (one which calls the one I want to debug), break it there with a break point, then modify values from the immediate window. Hit the go button to continue past the break point then see if you can force a crash in the routine that you are trying to debug.

That was the way I checked the Maxspeed, shell, mass and so forth earlier.
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 #26 on: October 28, 2005, 12:45:47 PM »
YAY!!!!!!  :D

I managed to recreate the error by running corpses in pond mode with Bouyancy turned on.

Now to hit the debug tools.

(cracks knuckles)
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
runtime 6/compile error
« Reply #27 on: October 28, 2005, 12:46:18 PM »
You can set a line to break on by going o it with your mouse and hitting F9.  A red circle will appear beside it to tell you it's now a beak line.

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
runtime 6/compile error
« Reply #28 on: October 28, 2005, 01:01:10 PM »
Quote
You can set a line to break on by going o it with your mouse and hitting F9.  A red circle will appear beside it to tell you it's now a beak line.
Never tried it that way.

Easier just to left click with the mouse in the left magin next to the line where you want code execution to break.
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 #29 on: October 28, 2005, 01:04:01 PM »
Quote
YAY!!!!!!  :D

I managed to recreate the error by running corpses in pond mode with Bouyancy turned on.

Now to hit the debug tools.

(cracks knuckles)
Graaah! I SUSPECTED there were something different with how we run the simulations. Try this settings file out and see what you get.

After you've loaded the settings file you need to manually change the following the the values I use, because they don't get saved in the settings file:

General tab:

Waste Treshold: 100

Boyancy: Checked

Corpse mode: Enabled

Repopulation cooldown period: 10

NRG/veggie/cycle: 10

Right after I've started the sim I enter mutations tab and change to 32x, then I lower it one step every 5000 cycles. I want to start with large diversity and later on let the natural selection decide wich bots survives. Never get very far though.
The internet is corrupt and controlled by criminally minded people.