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

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
runtime 6/compile error
« Reply #45 on: October 28, 2005, 06:32:30 PM »
No I mean before the lines that cause it to crash.

Offline Testlund

  • Bot God
  • *****
  • Posts: 1574
    • View Profile
runtime 6/compile error
« Reply #46 on: October 28, 2005, 06:42:04 PM »
I don't understand what you are talking about. Either you're talking about reproducing the crash; why should I do that, or either you're talking about preventing the crash; if so I don't understand how exactly to put that value above the offending code line you're suggesting.
The internet is corrupt and controlled by criminally minded people.

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
runtime 6/compile error
« Reply #47 on: October 28, 2005, 06:44:42 PM »
Well, since the line is after the crash, I don't see it making a difference.

I can't remember if it should be commented out or not.  When I started here months ago *.vel was returning an incorrect value.  THat may be a relic from way back then.

Offline Testlund

  • Bot God
  • *****
  • Posts: 1574
    • View Profile
runtime 6/compile error
« Reply #48 on: October 28, 2005, 06:59:16 PM »
I tried Griz' example. Didn't change anything for me. Got the same crash after 9 min. No freezing. just same old run-time error 6.
The internet is corrupt and controlled by criminally minded people.

Offline Testlund

  • Bot God
  • *****
  • Posts: 1574
    • View Profile
runtime 6/compile error
« Reply #49 on: October 28, 2005, 07:11:27 PM »
Yes, it's commented out here in my version too.

Ok, now both Nums and PY is gone for awhile. I guess I'll leave this alone and go back to my adventure in Neverwinter Nights for the rest of the weekend. By the way, happy birthday, griz. Goodnight folks.
The internet is corrupt and controlled by criminally minded people.

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
runtime 6/compile error
« Reply #50 on: October 29, 2005, 11:36:21 AM »
Quote
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).
Actually they aren't quite the same thing.

The first one sets .fixed to true or false depending on the value in the sysvar .fixpos
It also sets .vx and .vy to zero at this point

The second one takes the .vx and .vy resets out of the sysvar conditional and resets them whenever .fixed is true since it is quite possible for .fixed to be true without the corresponding sysvar value.

Take veggies that are fixed from the GUI or bots that are fixed due to Altzheimers
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 #51 on: October 29, 2005, 11:45:31 AM »
Quote
With rob(n)
.mass = 1 + (.body / 10000) + (.Shell / 200) 'set value for mass
Maxspeed = 30 / (.mass / 2) 'Set maximum speed. Absolute max = 60
Absaccel = 0 'reset acceleration
If Abs(.vx) > 32000 Then .vx = 32000 * Sgn(.vx)
If Abs(.vy) > 32000 Then .vy = 32000 * Sgn(.vy)
.absvel = Cos(.aim) * .vx * -1 + Sin(.aim) * .vy 'formula changed to give velocity in the direction robot is facing rather
than always a positive number. Make *.vel work properly.

with:

With rob(n)
If .Shell < 0 Then .Shell = 0
If .body < 0 Then .body = 0: .Dead = True
.mass = 1 + (.body / 10000) + (.Shell / 200) 'set value for mass
Maxspeed = 30 / (.mass / 2) 'Set maximum speed. Absolute max = 60
Absaccel = 0 'reset acceleration
If Abs(.vx) > 32000 Then .vx = 32000 * Sgn(.vx)
If Abs(.vy) > 32000 Then .vy = 32000 * Sgn(.vy)
.absvel = Cos(.aim) * .vx * -1 + Sin(.aim) * .vy 'formula changed to give velocity in the direction robot is facing rather
than always a positive number. Make *.vel work properly.

???
btw ... I just commented out the old code ... just in case. wink.gif

This is in the physics module right?

Then it won't work.

The reason is that for any robot that is fixed, this entore routine is skipped.

If the code in this routine is actually executed then it works perfectly every time without the added limits. No matter what values of .vx and .vy come in here, they always come out at less than Maxspeed (60)

If you want this routine to work, take out the conditional at the top which excluded fixed bots. Then you don't even need to add lines of code. This was answer one in my previous options.
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 #52 on: October 29, 2005, 11:53:53 AM »
The root cause of all this crap is that rob(o) or the robot being viewed, has a velocity of some huge number.

It only happens when rob(o) is fixed

The cause is that somewhere down the line, the accelerations are just being added to a fixed bot and velocity is not being reset.

Answer. Reset all .vx, .vy, .ax and .ay variables for all fixed bots on every cycle

If my previous fix didn't work I think it may have been because it wasn't resetting accelerations but was only resetting velocities. Accelerations are added to current velocities later in the program cycle so if accelerations continue to grow, then eventually we are going to add one that pushes velocity out of bounds.

That would explain how my previous fix allowed the program to run for longer before crashing since it wasn't compounding the error on each cycle.

Try this instead.

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
  .ax = 0
  .ay = 0
Endif
« Last Edit: October 29, 2005, 11:55:47 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 Testlund

  • Bot God
  • *****
  • Posts: 1574
    • View Profile
runtime 6/compile error
« Reply #53 on: October 29, 2005, 02:20:02 PM »
Looks like we're not gonna find a solution any time soon, eh?

RUN-TIME ERROR 6: OVERFLOW

OFFENDING CODE:

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

HOVERING INFO:

rob(n).mem(refvelup) = 0

n = 794

refvelup = 699

rob(o).vx = 0

o = 800

rob(n).aim = 5,91204

rob(o).vy = 210549,3

rob(n).mem(velup) = 7980

velup = 200

I added a picture to show how the simulation looked like when it crash. maybe it whould give someone a hint, I don't know.
The internet is corrupt and controlled by criminally minded people.

Offline Testlund

  • Bot God
  • *****
  • Posts: 1574
    • View Profile
runtime 6/compile error
« Reply #54 on: October 29, 2005, 08:37:14 PM »
Well, it's any of those codes in that routine, choices at random. I'm quite sure it's the pond mode that is causing it.

My suggestion is: either get rid of 'Pond mode' (whould be a little boring I think) or make it work!
« Last Edit: October 29, 2005, 08:38:39 PM by Testlund »
The internet is corrupt and controlled by criminally minded people.

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
runtime 6/compile error
« Reply #55 on: October 30, 2005, 03:11:32 PM »
Quote
Quote
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).
Actually they aren't quite the same thing.

The first one sets .fixed to true or false depending on the value in the sysvar .fixpos
It also sets .vx and .vy to zero at this point

The second one takes the .vx and .vy resets out of the sysvar conditional and resets them whenever .fixed is true since it is quite possible for .fixed to be true without the corresponding sysvar value.

Take veggies that are fixed from the GUI or bots that are fixed due to Altzheimers
To me it seems that they are identical in effect (not in implementation obviously).  Try walking trhough it manually with different values for different things and see if you can provide a case where they're not.  I could just be a little sleepy.

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
runtime 6/compile error
« Reply #56 on: October 30, 2005, 03:14:30 PM »
You guys, if desperate, can actually comment out the lines that are crashing.  They provide information to the bots but don't hurt the simulation if mising.

Some bots (mostly mine) won't work without it, but many bots will.  Dominator Invincibalis for one.

Offline Testlund

  • Bot God
  • *****
  • Posts: 1574
    • View Profile
runtime 6/compile error
« Reply #57 on: October 30, 2005, 05:44:22 PM »
What does that code do for the bots anyway. Whouldn't want to comment out something that whould cripple the bots or make them less advanced or something.

Right now I don't see any use for the program as I can't load a saved sim or insert a bot that's been autosaved. Can't evolve bots if I have to start over with a new simulation all the time. I think maybe that worked in version 2.36.7, but you don't have the sourcecode for that version, do you?
The internet is corrupt and controlled by criminally minded people.

Offline Endy

  • Bot Overlord
  • ****
  • Posts: 852
    • View Profile
runtime 6/compile error
« Reply #58 on: October 30, 2005, 09:21:11 PM »
Windiff over on the downloads section at bottom. Allows you to select diff pages and find changes between them.

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
runtime 6/compile error
« Reply #59 on: October 30, 2005, 10:12:06 PM »
The one in downloads is actually better than the standard one that comes with VB because it ignores capitalization differences.

I modified it myself ;)