Darwinbots Forum
Bots and Simulations => Bot Tavern => Topic started by: Testlund on December 18, 2009, 12:16:54 PM
-
I couldn't find any explanation on the wiki how to stop a bot once it has started moving, to prevent it from keep moving forever.
-
I don't think I understand the question... you mean like .fixpos or fluid resistance ?
-
You can check against *.velup, etc. and feed the negative of that value in to .up, etc.
See Sysvar list (http://www.darwinbots.com/WikiManual/index.php?title=Sysvar) if you haven't yet. There's good references there for different sysvars you can use.
-
I've been looking through the sysvar lists and bot tutorials the whole evening. I understand what they mean but not how they are supposed to be combined. I tried this, but it has no effect on stopping the bot:
cond
*.shflav -1 =
start
25 .up store
stop
cond
*.myup 25 =
start
-25 .up store
stop
cond
*.shflav -6 =
start
25 .dn store
stop
cond
*.mydn 25 =
start
-25 .dn store
stop
-
mydn is not you movement speed, it's the amount of .dn commands in the dna...
.veldn is your speed... and if you set .up to -25 you'll be moving backwards...
-
do you want it to start moving again afterwards or just stop altogether
-
I just want it to move away a bit whenever it gets shot.
-
Whenever you want it to stop, try
*.velup - .up store
*.veldx - .dx store
-
I'm trying all sorts of combinations but nothing works. Sorry, but I don't see any logic at all in bot programming. Maybe you can tell me how I put it together?
-
I think this works
//resetter put this before the other gene!
cond
*.fixed 0 !=
start
0 .fixpos store
stop
cond
(when bot should stop)
start
.fixpos inc
stop
-
cond
*.velup 0 !=
*.veldn 0 !=
start
*.velup - .up store
*.veldx - .dx store
stop
I think this is the most simple solution.
-
No, it doesn't work.
-
Is the aim of the bot to move away from a bot that is shooting it...
if so then you could
cond
*.shflav -1 =
*.shflav -6 = or
start
*.refvelup 30 add .up store
*.refveldx 30 add .dx store
stop
cond
*.shflav 0 =
start
*.velup - .up store
*.veldx - .dx store
stop
Im hoping that'll work.
-
I tested the genes, and they work. Both they have a short impulse speed for one cycle then stop.
Could you post the bot you're working on.
If your problem is slight random movement every cycle, brownion movement is causing that. You could deactivate that in the physics tab.
Also if your goal is just to stop the bot moving the next cycle you can use toggle zero momentum with the (advanced)physics options.
Gene testing code.
cond
*.velup 0 !=
*.veldn 0 !=
start
*.velup - .up store
*.veldx - .dx store
stop
cond
*.robage 10 =
start
*.maxvel .up store
stop
and
cond
*.fixed 0 !=
start
0 .fixpos store
stop
cond
*.velup 0 !=
*.veldn 0 !=
start
.fixpos inc
stop
cond
*.robage 10 =
start
*.maxvel .up store
stop
-
I have ammended the code
cond
*.shflav -1 =
*.shflav -6 = or
start
*.maxvel .up store
*.maxvel .dx store
stop
cond
*.shflav 0 =
start
*.velup - .up store
*.veldx - .dx store
stop
-
I must be adding the code in the wrong place then, because all I get is a bot twitching with movement vectors pointing in 4 directions, or the code is completely ignored.
I want a bot that moves away a short distance just to get out of the way of a shooting bot and then stop moving.
-
whos piece of code mine or pete's
-
This makes the bot move forever:
[div class=\'codetop\']CODE[div class=\'codemain\' style=\'height:200px;white-space:pre;overflow:auto\']start
*.refxpos 0 >
*.refxpos *.refypos angle .setaim store
8 .shootval store
-6 .shoot store
stop
start
*.nrg 16000 >
10 .strbody store
stop
start
*.body 16000 >
50 .repro store
15 .aimdx store
stop
cond
*.shflav -1 =
*.shflav -6 = or
start
*.maxvel .up store
*.maxvel .dx store
stop
cond
*.shflav 0 =
start
*.velup - .up store
*.veldx - .dx store
stop
-
Don't forget to reset .shflav, it isn't done automaticaly...
.up however is reset automaticaly, so for instance :
*.shflav 0 !=
0 .shflav store
*.aim *.shang sub .setaim store '(This line just aims in the direction you where shot from, I can't remember if aim is adjusted before movement, but I think it is)
*.maxvel .dn store
This should give you full power for one cycle then stop acceleration, if there's no fluid resistance you may keep moving though, otherwise you should stop by yourself.
Countering movement speed is a bit tricky if you're also turning, since you'll keep trying to adjust in every direction.
If you have no fluids and you want to stop fast, you can use 1 .fixpos store to stop completely and lock in place. (Just have .fixpos dec in a gene with no condition at the start of your code)
-
Yes! That did it! Here's the complete bot:
[div class=\'codetop\']CODE[div class=\'codemain\' style=\'height:200px;white-space:pre;overflow:auto\']start
*.refxpos 0 >
*.refxpos *.refypos angle .setaim store
8 .shootval store
-6 .shoot store
stop
start
*.nrg 16000 >
10 .strbody store
stop
start
*.body 16000 >
50 .repro store
15 .aimdx store
stop
cond
*.shflav -1 =
start
25 .up store
stop
cond
*.shflav -6 =
start
25 .dn store
stop
start
*.shflav 0 !=
0 .shflav store
*.aim *.shang sub .setaim store
*.maxvel .dn store
stop
It has a hard time escaping an efficient hunter though, but it's ok.
-
Actually, now it moves away from ANYTHING it touches, so now it can't feed much. I just wanted it to move away when shot at.
-
Change this :
*.shflav 0 !=
0 .shflav store
*.aim *.shang sub .setaim store
*.maxvel .dn store
To this :
*.shflav 0 !=
*.shflav -2 != and
0 .shflav store
*.aim *.shang sub .setaim store
*.maxvel .dn store
'(And maybe add some counter shots while fleeing if you want that)
-6 .shoot store
20 .shootval store
-
Ok, thanks for your help and patience folks! I made it so it will shoot all it's waste at an offender, if it has any.
[div class=\'codetop\']CODE[div class=\'codemain\' style=\'height:200px;white-space:pre;overflow:auto\']start
*.refxpos 0 >
*.refxpos *.refypos angle .setaim store
8 .shootval store
-6 .shoot store
stop
start
*.nrg 16000 >
10 .strbody store
stop
start
*.body 16000 >
50 .repro store
15 .aimdx store
stop
cond
*.shflav -1 =
start
25 .up store
stop
cond
*.shflav -6 =
start
25 .dn store
stop
start
*.shflav 0 !=
*.shflav -2 != and
0 .shflav store
*.aim *.shang sub .setaim store
*.maxvel .dn store
-4 .shoot store
*.waste .shootval store
stop
end
-
Not unlike many animals IRL, some empty bowels while fleeing, makes them lighter and faster and can get in the way of the predator. And I know birds and monkeys will aim it at predators to make them leave the area below.
-
I was thinking about an octopus when I came up with this idea. Thought I should try it out in IM but I think a virus infected flyfruit came in and whiped all my bots out!
-
Didn't know if it was working, tryed activating IM and the teleporter popped up, but if I tried showing the IM pop graph then everything crashed. So didn't actualy think it got out there.
Anyway I won't spread it on IM again if people are trying to run evo sims there. It was mostly because EricL challenged bot coders to hit 9000 bots on IM, and the idea was for the alge to eventualy infect a regular bot with a virus version of FruitFlies and have the infected bot take over the sim. Other than that it spread viruses to get rid of the other alge, and also as part of it's own clever virus defence capable to assimilating new viruses and spread them without taking damage from them. So if everything just died it actualy didn't have the desired effect, it was suposed to make enough fruitflies to freeze your sim
But I'll only put evo bots on IM if that's what people are running atm (Back then it was up against Seasnake3 I think)
-
The same happened to me when I went onto internet mode, it showed me the graph for a little while but then when it tried to update it crashed.
-
Didn't know if it was working, tryed activating IM and the teleporter popped up, but if I tried showing the IM pop graph then everything crashed. So didn't actualy think it got out there.
Yes, these pop up/under graphs are tiresome, especially if you're a perfectionist like me and want all graphs nice and tidy on the screen.
If you minimize them and restart internet mode they tend to get stuck so you can't open them again.
...the idea was for the alge to eventualy infect a regular bot with a virus version of FruitFlies and have the infected bot take over the sim.
Yes, that is what happend. My touch bot 'PokeMe' exploded into tiny bots all over the screen and dissapeared.
So if everything just died it actualy didn't have the desired effect, it was suposed to make enough fruitflies to freeze your sim
That's because I run with lots of costs and nrg/body distribution set to zero so the bots have to use their own nrg/body transfer. I think that's more realistic.
Well, I've given up trying to evolve zero bots in my sims which have been my main interest with DB, one of the reasons why I never got into bot designing, but I thought I should give it a try to learn it and see if I can design a few simple bots, preferably based on real unicellular organisms.
Maybe you guys would be interested in running a pure evosim under the Christmas holiday, while being away from the computer celebrating?
Hopefully Nums may be able to fix the saving problem until then so any cool sim don't get lost.