Author Topic: Slam_Funk2.0(F3)(Ta-183)-4.26.09  (Read 5625 times)

Offline Ta-183

  • Bot Destroyer
  • ***
  • Posts: 105
    • View Profile
Slam_Funk2.0(F3)(Ta-183)-4.26.09
« on: April 26, 2009, 01:45:58 PM »
ROBOT TOO BIG TO FIT!

After sitting on these bots for about a month, I decided I'd finish them today. I can't really see EXACTLY how well this one is doing in the leagues (computer haet league) but I figured that since it's pretty near complete and it seems to run fine, it's ready to be released. Fell free to edit it for errors and tweak the numbers, I haven't been able to do so very well. Have fun with it guys, run it in the leagues next chance you get.
« Last Edit: May 13, 2014, 02:19:56 PM by Botsareus »

Offline Moonfisher

  • Bot Overlord
  • ****
  • Posts: 592
    • View Profile
Slam_Funk2.0(F3)(Ta-183)-4.26.09
« Reply #1 on: April 26, 2009, 02:44:16 PM »
Hmm when I ran it, it lost to Beholder...

Offline Ta-183

  • Bot Destroyer
  • ***
  • Posts: 105
    • View Profile
Slam_Funk2.0(F3)(Ta-183)-4.26.09
« Reply #2 on: May 13, 2009, 07:47:58 PM »
I am well into the development of my next release, Slam Funk2.1!

SF2.1 will fix a lot of the errors in SF2.0's coding and syntax, and at this point it behaves as it should, though it still looses to Beholder at this point. However, so does Spyrus. It makes me think that the F3 leaguetable needs to be redone, because Beholder seems to be tougher than it should be.

New features to expect in future releases may include;
Fractal-based defensive shield
More optimized performance
Better aim
Better maneuvering
And more!

I don't expect the SF2 series to dominate the F3 league. But I AM going to make it beat Beholder. You folks won't get a copy of SF2.1 until it can, so you guys should hope I get it to because this one is a treat to see. It doesn't have any of the quirks of SF1.1 and SF2. But it still isn't quite done.

Expect a release within the end of the month.

Offline Moonfisher

  • Bot Overlord
  • ****
  • Posts: 592
    • View Profile
Slam_Funk2.0(F3)(Ta-183)-4.26.09
« Reply #3 on: May 14, 2009, 02:45:13 AM »
Beholder has a lot of strong genes in it, but it also has some major flaws... I think it looses to a tutorial bot, because the bot is moving too fast and beholder is just too slow to keep up.
But you can never predict the outcome of the leagues... I had a realy hard time making sure each new tutorial bot was stronger than the previous one. Even weaknesses can prove to be strengths against the right oponent.
And strengths will turn into weaknesses against some oponents, like a complex bot may be able to outsmart or outmaneuver a slow bot, but a fast bot will just confuse the complex one.

Look at the DNA for the tutorial bots that manage to beat Beholder.... they're very simple and straightforward. Most tutorial bots just go straight ahead and shoot all the time.

I think if I had to summarize some of the most important areas when it comes to combat it would be :
- Size, keeping the right body/energy ratio and producing offspring of the right size and amount at the apropriate time. (I see most new F3 bots are WAY off in this area)
- Boosting shots by the right amount. (This is more tricky)
- Returning shots when shot at (Preferably stronger shots)
- Tracking oponents by aiming and matching movement.
- Not killing ones own offspring, not just by having a conspec but also by not giving birth in the midle of a burst of shots. (Not saying you can't give birth during combat or while feeding though, in fact it's probably an advantage to be able to reproduce while feeding off vegies)

A good way to debug eyes is to set eye5width to 300, this will make it about as wide as all your eyes put together with a shorter range. If your bots behavior changes a lot from this, then theres probably a problem with the eyes.

And ofcourse whenever you're fighting a bot which isn't nr 1 in it's league, then you can always watch the next fight to see how the next bot is beating it.
I think the major weaknesses in beholder are it's speed and size. It has small offspring and moves very slowly. It doesn't cut ties to the offspring, letting them act as a sort of tentacle, which also means that oponents that engage it slowly will get surounded by the offspring.


Also I should mention, the fractal bases defence shield sounds like a challenge that won't nessesarily help you in the league. The field is very small, so fights are determined rather fast, your oponent starts right next to you and you barely have time to turn before he shoots at you. Don't make long term plans in the regular leagues, not unless your first stage takes into account that you need to be quick (And usualy if you win the first stage then you should be able to win the fight following the same strategy.... usualy)
Speed and quick reflexes are important, especialy in a very small hostile field, most league bots don't think, they're not realy an AI, they're more of a stimulous response... thingy.

Offline Ta-183

  • Bot Destroyer
  • ***
  • Posts: 105
    • View Profile
Slam_Funk2.0(F3)(Ta-183)-4.26.09
« Reply #4 on: May 26, 2009, 06:43:05 PM »
I'm trying to exploit Beholder's weaknesses, but I keep coming up with a common issue. Over time, SF2.1 becomes smaller and smaller. After each generation, the following bunch become smaller and smaller. Most other bots don't do that; they hold a near uniform size. Plus, SF2 can't out fight Beholder one-on-one. There's just something about it that makes SF unable to shoot up beholder. It can't kill it. I have a feeling that if I just got an EFFECTIVE shot gene, it could beat it. I've seen some promising performance improvements from optimizing the values a bit, but I tested increasing numbers of starting SF2's versus a single Beholder. It looses every time no matter how many SF's start the sim, because it just can't kill beholder.

Here's the shot gene. If anyone can run this and give me a better one, PLEASE do.
EDIT: Forgot to initialize a variable.
Code: [Select]
def lead 987

cond
*.eye5 50 >
*.refeye *.myeye != and
*.IFFF *.foe = and
start
*.refxpos *.refypos dist *.refvelup add *.xpos add
*.ypos *.refvelsx add
angle
*.refxpos *.refypos angle add
.setaim store
*.refxpos *.refypos dist 30 sub 500 div *.maxvel mult *.refvel *.vel *.refeye sgn mult sub 1 mult add .up store
*.refveldx .dx store
*.eyef *.refveldx 400 mult *.refbody div 4 add >
-6 .shoot store
28 .shootval store
*.refnrg *.refbody <
*.refpoison *.refshell < or
-1 .shoot store
1600 *.refvelsx 2 pow sub sqr *.xpos add
*.ypos *.refvelsx add
angle .lead store
*.refvelsx *.velsx <
1256 *.lead sub .lead store
dropbool
*.lead .aimshoot store
stop
« Last Edit: May 26, 2009, 06:47:58 PM by Ta-183 »

Offline Moonfisher

  • Bot Overlord
  • ****
  • Posts: 592
    • View Profile
Slam_Funk2.0(F3)(Ta-183)-4.26.09
« Reply #5 on: May 27, 2009, 07:17:56 AM »
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.

Offline Ta-183

  • Bot Destroyer
  • ***
  • Posts: 105
    • View Profile
Slam_Funk2.0(F3)(Ta-183)-4.26.09
« Reply #6 on: May 27, 2009, 05:29:54 PM »
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.


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.
« Last Edit: May 27, 2009, 06:32:22 PM by Ta-183 »

Offline Ta-183

  • Bot Destroyer
  • ***
  • Posts: 105
    • View Profile
Slam_Funk2.0(F3)(Ta-183)-4.26.09
« Reply #7 on: May 27, 2009, 06:37:55 PM »
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.
« Last Edit: May 27, 2009, 08:01:06 PM by Ta-183 »