Bots and Simulations > F3 bots

Slam_Funk2.0(F3)(Ta-183)-4.26.09

<< < (2/2)

Moonfisher:
That looks very complicated...
One thing I noticed is you only shoot when eye5 is over 50... but if you're seing an enemy he may be headed towards you (Or you towards him) so you may aswell start shooting the second you see him.

This is the code for Body (The next tutorial bot after Beholder)
(I added some comments to make everything as clear as possible)
[div class=\'codetop\']CODE[div class=\'codemain\' style=\'height:200px;white-space:pre;overflow:auto\']
'Always move fast forward
'I may be simple and stupid, but if I move fast the others won't have time to think.
start
30 .up store
stop

'Always shoot if I can see anything in eye5
'I even shoot my own offspring, this is in no way an advantage
cond
*.eye5 0 >
start
-1 .shoot store
stop

'Reproduce if I can't see anything in eye5 and I have enough body and energy for it.
cond
*.eye5 0 =
*.nrg 5000 >
*.body 1000 >
start
50 .repro store
stop

'If energy exceeds 3000 and I'm smaller than 1500 body, spend 100 energy on body (Producing 10 body I think)
cond
*.nrg 3000 >
*.body 1500 <
start
100 .strbody store
stop

'If energy is running low but I'm bigger than 200 body, then eat some 10 body gaining 100 nrg (I think)
cond
*.nrg 500 <
*.body 200 >
start
100 .fdbody store
stop

It's only 5 very small and simple genes. The point is to show how important the actions of these genes are.
It doesn't even boost its shots, or try to aim... it even shoots it's own kind...

So how does it beat Beholder ?
- It keeps a konstant speed of 30 which is too fast for Beholder to keep up. (This is not always an advantage, but usualy if you can set the pace for the fight you'll have the advantage.)
- It keeps balanced body and energy levels, 500-3000 energy and 200-1500 body (Aiming for 3000 energy and 1500 body ofcourse)
- It produces big strong offspring making sure they end up with atleast 2500 energy and 500 body and generaly 1500 is a fairly large body size. Bigger body = Stronger shots
(In the F3 league size makes a big difference since there's no shell, poison, venom or such.)


So my sugestion for a shot gene would be something like this :
(On a side not, I usualy just cram the fight movements into the shot gene, but I suspect you're handeling this elsewhere.)
I also haven't taken poison and shell into account since it's an F3 bot and it won't be usefull untill it's able to compete in F2.
[div class=\'codetop\']CODE[div class=\'codemain\' style=\'height:200px;white-space:pre;overflow:auto\']cond
*.eye5 0 >
*.refeye *.myeye != and
*.IFFF *.foe = and
start
*.refypos *.refxpos angle .setaim store

*.refnrg *.body 2 mult <
-1 .shoot store
not
-6 .shoot store

'Boost shots if close to oponent
*.eye5 50 >
28 .shootval store
not
0 .shootval store
stop

But from what you've mentioned it sound like regulating body is your biggest issue, so I think you'll gain even more by looking at the genes in Body (The bot )

And one last thing I'd like to mention, I think you're overcomplicating it. Behavior is not always good, it'll often get in the way of what you realy wan't to accomplish.
So making a good but is as much about removing harmfull code as it is about adding code. So it's a good idea to test every new behavior right away, and generaly you can never assume what you did will make things better, you should probably assume the oposite and check that it is in fact an improvement.
You can often improve a bot by cutting things away.

You can even get an idea about harmfull behavior by throwing the bot in a sim and letting it mutate... if you're very lucky you may even be able to start a big sim full of SF2's with mutations enabled, let them mutate a litle and then try to throw in a single Beholder. Anyway my point is that mutations may break certain genes, and sometimes the bot will become a lot stronger without that gene, revealing which genes where preventing the bot from winning.
Ofcourse it's not likely that one of the mutated bots will be able to beat Beholder, but it can happen, and if nothing else you can still just run an evo sim with SF2 alone and see what genes evolution decides to break.

So, to sum it up, appart from working on the shoot gene, I think you'll get a lot out of regulating body trying to stay big, and from cutting away genes and code that are getting in the way or slowing the bot down.

Ta-183:

--- Quote from: Moonfisher ---That looks very complicated...
One thing I noticed is you only shoot when eye5 is over 50... but if you're seing an enemy he may be headed towards you (Or you towards him) so you may aswell start shooting the second you see him.

This is the code for Body (The next tutorial bot after Beholder)
(I added some comments to make everything as clear as possible)
[div class=\'codetop\']CODE[div class=\'codemain\' style=\'height:200px;white-space:pre;overflow:auto\']
'Always move fast forward
'I may be simple and stupid, but if I move fast the others won't have time to think.
start
30 .up store
stop

'Always shoot if I can see anything in eye5
'I even shoot my own offspring, this is in no way an advantage
cond
*.eye5 0 >
start
-1 .shoot store
stop

'Reproduce if I can't see anything in eye5 and I have enough body and energy for it.
cond
*.eye5 0 =
*.nrg 5000 >
*.body 1000 >
start
50 .repro store
stop

'If energy exceeds 3000 and I'm smaller than 1500 body, spend 100 energy on body (Producing 10 body I think)
cond
*.nrg 3000 >
*.body 1500 <
start
100 .strbody store
stop

'If energy is running low but I'm bigger than 200 body, then eat some 10 body gaining 100 nrg (I think)
cond
*.nrg 500 <
*.body 200 >
start
100 .fdbody store
stop

It's only 5 very small and simple genes. The point is to show how important the actions of these genes are.
It doesn't even boost its shots, or try to aim... it even shoots it's own kind...

So how does it beat Beholder ?
- It keeps a konstant speed of 30 which is too fast for Beholder to keep up. (This is not always an advantage, but usualy if you can set the pace for the fight you'll have the advantage.)
- It keeps balanced body and energy levels, 500-3000 energy and 200-1500 body (Aiming for 3000 energy and 1500 body ofcourse)
- It produces big strong offspring making sure they end up with atleast 2500 energy and 500 body and generaly 1500 is a fairly large body size. Bigger body = Stronger shots
(In the F3 league size makes a big difference since there's no shell, poison, venom or such.)


So my sugestion for a shot gene would be something like this :
(On a side not, I usualy just cram the fight movements into the shot gene, but I suspect you're handeling this elsewhere.)
I also haven't taken poison and shell into account since it's an F3 bot and it won't be usefull untill it's able to compete in F2.
[div class=\'codetop\']CODE[div class=\'codemain\' style=\'height:200px;white-space:pre;overflow:auto\']cond
*.eye5 0 >
*.refeye *.myeye != and
*.IFFF *.foe = and
start
*.refypos *.refxpos angle .setaim store

*.refnrg *.body 2 mult <
-1 .shoot store
not
-6 .shoot store

'Boost shots if close to oponent
*.eye5 50 >
28 .shootval store
not
0 .shootval store
stop

But from what you've mentioned it sound like regulating body is your biggest issue, so I think you'll gain even more by looking at the genes in Body (The bot )

And one last thing I'd like to mention, I think you're overcomplicating it. Behavior is not always good, it'll often get in the way of what you realy wan't to accomplish.
So making a good but is as much about removing harmfull code as it is about adding code. So it's a good idea to test every new behavior right away, and generaly you can never assume what you did will make things better, you should probably assume the oposite and check that it is in fact an improvement.
You can often improve a bot by cutting things away.

You can even get an idea about harmfull behavior by throwing the bot in a sim and letting it mutate... if you're very lucky you may even be able to start a big sim full of SF2's with mutations enabled, let them mutate a litle and then try to throw in a single Beholder. Anyway my point is that mutations may break certain genes, and sometimes the bot will become a lot stronger without that gene, revealing which genes where preventing the bot from winning.
Ofcourse it's not likely that one of the mutated bots will be able to beat Beholder, but it can happen, and if nothing else you can still just run an evo sim with SF2 alone and see what genes evolution decides to break.

So, to sum it up, appart from working on the shoot gene, I think you'll get a lot out of regulating body trying to stay big, and from cutting away genes and code that are getting in the way or slowing the bot down.
--- End quote ---


Thanks for the help. I'm going to try those things ASAP. And on a side note, I think the fight movements were handled in the old shot gene. I think that's what most of the bulk is from. I just looked through my code, and I spotted a hole in the code for reproduction that would cause a gradual reduction in the body size through the population. It's current regulatory genes ought to handle it fairly well, it can also eat just fine, but since body can only be stored at 10 per cycle, it creates a bottleneck that makes it so that by the time it met reproduction conditions, it hasn't had the time to build up a respectable amount of body. This creates a general decrease in the body size of each generation. I wouldn't have spotted it otherwise, the problem was from the LACK of a piece of code, not from a bug. I'm gonna run it like this first, then with that shot gene. Then we'll see how it does.

EDIT: With the addition of that SINGLE line of code in the repro conditions, it's now able to fight it. Not 'win' yet, but it's a lot closer than it was.
EDIT2: Actually, there WAS an error. In the body maintenance genes. I forgot to add the stores. They didn't do a damn thing.

Ta-183:
VICTORY!!!!!

It beats Beholder! Now I just have to do some final tweaking, look over it for errors, and make sure everything is set where it should be. Then I'll (try to) run it in the leagues.

It gets all the way to alpha, but they each seem very evenly matched, with the edge leaning to alpha. It CAN beat alpha, but it just needs to get at it quicker. A few tweaks on the repro (and to that end I already put in an early-game blitz feature!) and it ought to be were I need it.

EDIT: It can get all the way past Defence. I'm so giddy I can barely type. It looses against Diversa Reflexum. Expect a release in two minutes.

Navigation

[0] Message Index

[*] Previous page

Go to full version