Code center > Solved Bugs
runtime 6/compile error
PurpleYouko:
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: ---If .mem(216) <> 0 Then
.Fixed = True
.vx = 0
.vy = 0
Else
--- End code ---
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: ---If t <> moving And Not rob(t).Fixed Then
Maxspeed = 30 / (.mass / 2) 'Set maximum speed. Absolute max = 60
--- End code ---
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 fixedI think the latter will run faster
find this section of code in "Updatepos"
--- Code: ---If .mem(216) <> 0 Then
.Fixed = True
.vx = 0
.vy = 0
Else
.Fixed = False
End If
--- End code ---
and change it to
--- Code: ---If .mem(216) <> 0 Then
.Fixed = True
Else
.Fixed = False
End If
if .Fixed then
.vx = 0
.vy = 0
Endif
--- End code ---
That should hopefully put this problem to bed once and for all.
PurpleYouko:
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:
Testlund:
Wich window is the above mensioned code supposed to go?
Oh, the robots module! :)
PurpleYouko:
--- Quote ---Tracing back further shows the call to "Writesenses" comes from "Updatepos" (Robots module)
--- End quote ---
That one. As I said before.
Sorry if I wasn't being explicit enough. I thought I was. :(
Testlund:
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?
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version