Author Topic: Slam Funk 1.0  (Read 11345 times)

Offline Ta-183

  • Bot Destroyer
  • ***
  • Posts: 105
    • View Profile
Slam Funk 1.0
« on: March 26, 2009, 10:41:34 PM »
Here's my first bot. It uses very simple genes with basic defenses. It's best features are it's group following behavior and it's vision system, with conspec embedded. If it spots a friendly in eye5, it follows. If it spots a bogey anywhere, it breaks off to feed. Has some slime, poison and shell, and I put in an ass-gun after a bad experience with a simple swarmer as a test. Has rudimentary antivirus.

Code: [Select]
'Slam Funk 1.0
'Uses simple genes and a simple conspec
'To survive at least against low level bots.
'Heavily based on Animal Minimalis,
'While very little of it was actually used.
'Best feature includes a very good vision system.
'It is able to follow its friends and break off to feed.

'Raises number of .eyeX commands to make a slightly more secure conspec.
cond
start
.eye5 .eye5 .eye5 .eye5 add add add add dup sub
stop

'Body storage gene.
cond
*.nrg 15000 >
*.body 500 < and
start
500 .strbody
stop

'See nothing, start looking. I wasn't content to just have it spin.
cond
*eye5 0 =
*.up 0 = and
start
20 .up store
stop

'Theres strength in numbers. This gene makes bots follow one another if they see a fellow

bot.
cond
*.eye5 0 >
*.refeye *.myeye =
start
*.refveldx .dx store
*.refvelUp .up store
30 .aimdx store
stop

'Targeting genes. If it spots food, it turns to it.

cond
start
-1 .focuseye store
stop

'Eye4
cond
*.eye4 0 !=
*.refeye *.myeye != and
start
5 .aimsx store
stop

cond
start
1 .focuseye store
stop

'Eye6
cond
*.eye6 0 !=
*.refeye *.myeye != and
start
-5 .aimsx store
stop

cond
start
-2 .focuseye store
stop

'Eye3
cond
*.eye3 0 !=
*.refeye *.myeye != and
start
15 .aimsx store
stop

cond
start
2 .focuseye store
stop

'Eye7
cond
*.eye7 0 !=
*.refeye *.myeye != and
start
-15 .aimsx store
stop

cond
start
-3 .focuseye store
stop

'Eye2
cond
*.eye2 0 !=
*.refeye *.myeye != and
start
35 .aimsx store
stop

cond
start
3 .focuseye store
stop

'Eye8
cond
*.eye8 0 !=
*.refeye *.myeye != and
start
-35 .aimsx store
stop

cond
start
-4 .focuseye store
stop

'Eye1
cond
*.eye1 0 !=
*.refeye *.myeye != and
start
40 .aimsx store
stop


cond
start
4 .focuseye store
stop

'Eye9
cond
*.eye9 0 !=
*.refeye *.myeye != and
start
-40 .aimsx store
stop

cond
start
0 .focuseye store
stop


'Ass-shot gene. Tested it against basicswarmer, swarmers beat the snot out of my bots by

following them close behind so I stuck this in here.
cond
*.shflav 0 !=
*.shflav -2 !=
start
1256 *.shang sub .aimshoot store
8 .shootval store
-6 .shoot store
0 .shflav store
stop



'The shooting gene. It fires if the bot sighted fails the conspec check and is in range.
cond
*.eye5 40 >
*.refeye *.myeye != and
start
8 .shootval store
-6 .shoot store
*.refvelup .up store
stop

'Reproduction gene. Gotta make mo' bots.
cond
*.body 500 >
start
40 .repro store
314 .aimdx store
stop

'Poison gene, because dying sucks.
cond
 *.nrg 10000 >
 *.poison 500 < and
start
 50 .strpoison store
stop

'Shell is good. This gene creates shell.
cond
 *.nrg 10000 >
 *.shell 250 < and
start
 100 .mkshell store
stop


'Slime gene, just in case.
cond
 *.nrg 10000 >
 *.slime 300 < and
start
 100 .mkslime store
stop

'Obligatory anti-viral gene
cond
 *.mkvirus 0 !=
start
 *.mkvirus .delgene store
stop


end

Offline ikke

  • Bot Destroyer
  • ***
  • Posts: 300
    • View Profile
Slam Funk 1.0
« Reply #1 on: March 27, 2009, 02:42:23 PM »
The bot is F2 (using poison and shell).It fails to enter F2 because it is weaker than the lowest bot. I ran it again in F3 where it failed to beat Chase. Look at those bots for guidance on improving.

Offline Ta-183

  • Bot Destroyer
  • ***
  • Posts: 105
    • View Profile
Slam Funk 1.0
« Reply #2 on: March 27, 2009, 05:56:52 PM »
I thought that would be so. This thing is still new and fairly inefficient. There will be some genes I have to remove, and improvements will be made to this over time. I need to find those bots so I can determine exactly where this bot is failing to deliver, that way I will be able to get this thing rolling in the future. I think I'll just take out the poison and shell so I can call it F3 in the next release, but that will come after a bit of redesign. Thanks for running it. Criticism from other members is still very welcome. Also, where can I find a full list of the F3 bots? I cannot find them.

Oh dammit. I just downloaded only the F3 bots. Even THEY are much more advanced than my bot. Please, I need suggestions! By the way, can I use the > < != = operators within a gene for conditional control?

Alright. I ran it in F3 mode. It gets to chase and it is a surprisingly even matchup. Slam Funk's shots hit harder, but it hasn't been optimized yet so it still travels slightly too fast to aim very well, and needs a better aiming routine. Once it's aiming issues are resolved it ought to get much higher in the F3 league. I'm also going to remove the poison and shell for version 1.01a.
« Last Edit: March 27, 2009, 08:10:59 PM by Ta-183 »

Offline Ta-183

  • Bot Destroyer
  • ***
  • Posts: 105
    • View Profile
Slam Funk 1.0
« Reply #3 on: March 27, 2009, 10:59:09 PM »
Alright. Work is progressing steadily on the next release of Slam Funk. Theoretical work has also started on a tie feeding, info shot derivative. Still needs more work to get higher, as most values have yet to be fully optimized. While it can't beat Chase yet, it still puts up a hell of a fight.

And on a side note, I once witnessed a pre-release variant take out a five segment tribolis. Any version could do it in theory, but only from head on. The tail end is a death trap.

Offline ikke

  • Bot Destroyer
  • ***
  • Posts: 300
    • View Profile
Slam Funk 1.0
« Reply #4 on: March 28, 2009, 04:02:51 AM »
In F3 the robos with the sexy names as chase aim etc are more or less a tutorial series of F3 robots, with genes added sequentially to improve capabilities. I used them to learn myself and base my own bot on. This bot (gimmick) is also commented. I'll leave it up to others to say if it is well commented, but you might want to look.

Offline Ta-183

  • Bot Destroyer
  • ***
  • Posts: 105
    • View Profile
Slam Funk 1.0
« Reply #5 on: March 28, 2009, 12:43:03 PM »
Thanks for the tip, ikke. If there's something I've learned about DNA yet, it's how to, eh, 'splice' code.


I just finished another internal build, this one I have high hopes for. It has a few new tricks, though still can't switch between body and energy shots.

EDIT; It works, not as well as I'd hoped, but it's definitely an improvement. It can get past Chase no problem now and it can stand up to Roto fairly well for an early model. It can't beat Roto yet, but with some tweaks and optimization it should be able to get past it. But they do get too small, too quick. They need to keep their size up without compromising reproduction. I'm thinking about testing it with body storage disabled.
« Last Edit: March 28, 2009, 12:59:32 PM by Ta-183 »

Offline Moonfisher

  • Bot Overlord
  • ****
  • Posts: 592
    • View Profile
Slam Funk 1.0
« Reply #6 on: March 28, 2009, 02:08:19 PM »
You can't change the focus eye mid cycle...
You need to understand how the whole thing works : (Going to assume you know none of all this, so forgive me if it sounds condecending, I don't whow much you know)
When you write 50 .repro store then you're just pushing the value 50 into the memory location of .repro
Every command or sysvar has a memmory location, and can be manipulated.
Once the code is executed the value standing in the .repro location at the end will be the one executed.
So you can't write 50 .repro store a hundred times but you will still only reproduce once (You also wouldn't be able to reproduce more than once every cycle anyway).
This also means if you get hit by a virus and a gene causing you to reproduce is inserted in the bots code you can still prevent this at the end of your code.
(For instance by having an odd repro value and disalowing any others)
So basicaly changing eyefocus can only happen once every cycle, if you want a good example for an eye system look at EyeBot (An F3 bot in the starting gate).

You should also understand how the boolean and integer stack works:
Writing 50 .repro store actualy means you're pushing 50 into the integer stack, then the location coresponding to .repro (You can see all these values on the sysvars page on the wiki).
The store command pushes the first value into the memmory location pointed out by the second value.
The add command would add them together and push the result into the stack. (When values are used they are poped from the stack)
The boolean stack works in the same way, and code will be executed if the top value on the stack is true.
This is how inline conditions work... (Meaning between start and stop)
The conditions between cond and start are seperate from the regular boolean stack and work as a conditions for the entire gene. These are also and'ed together into a single boolean whereas inline conditions are handled manualy and the boolean on the top of the stack counts.
(Unlike the integer stack these are not popped when used)

EDIT: And yes the F3 league is a good place to start, look at the code in the bots you're fighting, theres some "tutorial" bots in there with a minimum of code and behavior, and they increase by 1 or 2 genes for each new bot, making it easy to tell the difference and see what new gene is making the difference. And I think the new gene in each bot may be commented... but either way the name of the bot should tell you what it's doing different. (Aim actualy aims at oponents, chase adjusts .up and .dx to match oponents, and so forth)

strbody increases body size spending energy, and fdbody eats the body to gain energy so if your bots are getting smaller you probably need to use strbody more, or base reproduction conditions on both size and energy...

Once you run into some of the top F3 bots then I recommend moving on to F2 if you get tired of trying to beat them... lots of tweeking and such, unless you have a better strategy (I know I have one ideas for a very different behavior that could probably beat the current top F3, and theres probably many other ways than what I have in mind since F3 hasn't been around too long.)
Anyway F2 allows poison and shell... and venom and mem shots
Not sure if the rules where suposed to change at some point or not... currently F2 is the same, but we did have a discussion at some point that never realy got conclusive results I think...
And F1 has no rules at all... anything goes... stuff like viruses and tie feeding makes it all very interesting

Just saying if your bots is having trouble advancing in a league I think it can be more fun to jumpt between leagues a litle to try new things and gather inspiration.
Also running other people bots against eachother to see what they're doing can be a good source of ideas.
And even evo sims can spawn some realy good ideas for league bots... evolution has a way of finding clever solutions we would never have thought about
Also a good tip... shell and poison are cheap (Not allowed in F3 though), but 10000 energy in order to replenish shell is a LOT of energy... shell/poison costs next to nothing (0.01 nrg I think) and can prevent a lot of damage.
With around 500 shell you also won't be slowed down too much and it only costs 5 nrg to make 500 shell, so something like :
*.nrg 50 >
500 *.shell sub .mkshell store

Would be quite safe and allow your bot to keep 500 shell at all times (It would also prevent bots like pacifist or certain viruses from forcing shell on it to prevent movement).
« Last Edit: March 28, 2009, 03:47:04 PM by Moonfisher »

Offline Ta-183

  • Bot Destroyer
  • ***
  • Posts: 105
    • View Profile
Slam Funk 1.0
« Reply #7 on: March 28, 2009, 03:51:41 PM »
Thanks, moonfisher. I learned all of this stuff on the fly writing this bot as I was diving through the tutorials. I'm getting pretty good results from constantly updating this bot, I'm working on my 7th or 8th internal build. I'm also going to start work on an F1 derivative using tie feeding and info shots, possibly a discrete virus to stop the target from shooting. It wont be terribly advanced but it should do some serious damage. I haven't done any work on it yet but I'm going to base it off an internal build of Slam Funk (ver 1.01b).

Offline Ta-183

  • Bot Destroyer
  • ***
  • Posts: 105
    • View Profile
Slam Funk 1.0
« Reply #8 on: March 31, 2009, 12:48:10 PM »
DISREGARD THE FOLLOWING CODE.

I'm at school and I need a place to save my 'notes'. The following genes are (more than likely) non-functional and incomplete. Though if you spot any spelling errors or syntax errors, PLEASE let me know.


Code: [Select]
'Communication
def txpos 0
def typos 0
'Identification Friend Foe or Food
def IFFF 0
def notarget 0
def friend 1
def food 2
def foe 3
'For later use
def veggie 20
'What am I doing right now?
def situation 0
def nothing 0
def eating 1
def fighting 2
'Condition
def health 0
def fine 1
def injured 2
def dying 3
def intox 4

'Can't see shit, captian
cond
*.eye1 0 =
*.eye2 0 = and
*.eye3 0 = and
*.eye4 0 = and
*.eye5 0 = and
*.eye6 0 = and
*.eye7 0 = and
*.eye8 0 = and
*.eye9 0 = and
start
*.nothing .situation store
0 .IFFF store
stop

'Friendly Bot
cond
*.refshoot 0 >
*.refeye *.myeye =
start
*.nothing .situation store
*.friend .IFFF store
stop

'Food
cond
*.refkills 0 =
*.refshoot 0 = and
*.refeye *.myeye != and
start
*.eating .situation store
*.food .IFFF store
*.refxpos .txpos store
*.refypos .typos store
stop

'Foe
cond
*.refshoot 0 >
*.refkills 0 > or
*.refeye *.myeye != and
*.IFFF *.friend != and
start
*.fighting .situation store
*.foe .IFFF store
*.refxpos .txpos store
*.refypos .typos store
stop

cond
*.IFFF *.food =
*.IFFF *.foe = or
start
*.IFFF .out1 store
*.txpos .out2 store
*.typos .out3 store
stop

cond
*.IFFF *.notarget =
*.IFFF *.friend = or
start
*.IFFF .out1 store
0 .out2 store
0 .out3 store
stop



'Listen for signs of food, turn towards it if not doing anything more important
cond
*.in1 *.food =
*.situation *.nothing= and
start
*.in2 *.in3 angle .setaim store
10 .up store
*.eating .situation store
stop


'Listen for signs of trouble. Go fight if there is any.
cond
*.situation *.nothing =
*.situation *.eating = or
*.in1 *.foe = and
start
*.in2 *.in3 angle .setaim store
10 .up store
*.fighting .situation store
stop
« Last Edit: March 31, 2009, 01:23:26 PM by Ta-183 »

Offline ikke

  • Bot Destroyer
  • ***
  • Posts: 300
    • View Profile
Slam Funk 1.0
« Reply #9 on: April 01, 2009, 02:27:19 AM »
looks promising..

Offline Ta-183

  • Bot Destroyer
  • ***
  • Posts: 105
    • View Profile
Slam Funk 1.0
« Reply #10 on: April 01, 2009, 10:30:56 AM »
It sure does. That code is for Slam Funk 2, which will be released in a few days once I finish the code for it and get a new vision system built. I'll also be releasing Slam Funk 1.1 soon, an improvement on the original Slam Funk DNA where SF2 is based on new decision making, maintinence and IFFF code. Both will have improved vision, which will likely be borrowed and modified from an existing bot. Even with the current vision system hampering its potential, SF2 ought to be able to fight past most of the F3 league. It shares a shooting function with gimmick and a similar IFFF concept but my IFFF is entirely my own code.

Offline Ta-183

  • Bot Destroyer
  • ***
  • Posts: 105
    • View Profile
Slam Funk 1.0
« Reply #11 on: April 01, 2009, 01:14:10 PM »
Quick boolean stack question. Would the following code work?

Code: [Select]
cond
*condition*
*condition* and
*condition* and
*.health *.injured = not
*.situation *.eating = not and
start
ect.

I want it so that the gene will only work if both of the last two conds are both false, along with the other stuff. Is this right?

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Slam Funk 1.0
« Reply #12 on: April 01, 2009, 02:34:21 PM »
It would work as written.  But for "correctness" sake you want another "and" in there.  start normally "and"s all the bools on the bool stack together anyway, but if you try to expand it with another condition in the future you can confuse yourself.

Offline Shasta

  • Administrator
  • Bot Destroyer
  • *****
  • Posts: 231
    • View Profile
Slam Funk 1.0
« Reply #13 on: April 01, 2009, 11:23:23 PM »
You also may just want to replace the "= not"s with != it does the exact same thing.

Offline Ta-183

  • Bot Destroyer
  • ***
  • Posts: 105
    • View Profile
Slam Funk 1.0
« Reply #14 on: April 01, 2009, 11:25:19 PM »
I got a chance to run a version of Slam Funk 2 a few minutes ago. It didn't work nearly at all. Only the genes retained from Slam funk 1.X seemed to work. I think I narrowed the problem down to my use of custom constants. Now, in the code above, I tried to define constants using 'def constant 2' for example. Now what I thought I was doing was setting .constant to 2. But I think what it really did was set .constant to MEMORY LOCATION 2. Is this accurate?