Darwinbots Forum

Bots and Simulations => Bestiary => Untagged bots => Topic started by: Ta-183 on March 26, 2009, 10:41:34 PM

Title: Slam Funk 1.0
Post by: Ta-183 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
Title: Slam Funk 1.0
Post by: ikke 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.
Title: Slam Funk 1.0
Post by: Ta-183 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.
Title: Slam Funk 1.0
Post by: Ta-183 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.
Title: Slam Funk 1.0
Post by: ikke 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.
Title: Slam Funk 1.0
Post by: Ta-183 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.
Title: Slam Funk 1.0
Post by: Moonfisher 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).
Title: Slam Funk 1.0
Post by: Ta-183 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).
Title: Slam Funk 1.0
Post by: Ta-183 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
Title: Slam Funk 1.0
Post by: ikke on April 01, 2009, 02:27:19 AM
looks promising..
Title: Slam Funk 1.0
Post by: Ta-183 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.
Title: Slam Funk 1.0
Post by: Ta-183 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?
Title: Slam Funk 1.0
Post by: Numsgil 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.
Title: Slam Funk 1.0
Post by: Shasta 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.
Title: Slam Funk 1.0
Post by: Ta-183 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?
Title: Slam Funk 1.0
Post by: Shasta on April 01, 2009, 11:30:46 PM
Quote from: Ta-183
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?
Yes it is, if you want a memory value to always be the same, what you could do is place a gene/block at the very end and set them all there. But if you are trying to use them for math, find and replace is your friend.
Title: Slam Funk 1.0
Post by: Ta-183 on April 02, 2009, 12:00:37 AM
Im using them as constants so I can do logical checks. like for example seeing if *.health is equal to *.dying. This way it's easy to put interrupts into my genes so it can decide whether or not to do something. This is going to take a major modification of my current code, but only so far as to add a few dozen lines for constant initialization. The system isn't half bad if I do say so myself. It's just the constants than need work.

EDIT: Arrg, now it's deleting it's genes whenever it reproduces!!
Okay. I'm posting the code now, somebody PLEASE tell me what's going wrong here!


Code: [Select]
'Slam Funk 2.0 (Release Candidate 2)
'Second Generation of Slam Funk
'Vastly improved communication and decision making.
'Can now differentiate between enemy and food
'And effectively relay information.
'Has improved diagnostics routines and retreat capability.


'CHANGELOG
'Ver 2.00
'    Initial Build
'


'Communication
def txpos 50
def typos 51
'Identification Friend Foe or Food
def IFFF 52
def notarget 53
def friend 54
def food 55
def foe 56
'Secure Conspec Constants
def algaminimalis 57
'Situational Awareness
def situation 58
def nothing 59
def eating 60
def fighting 61
'Condition
def health 62
def fine 63
def injured 64
def dying 65
def intox 66

'-------- CONSTANT INITIALIZATION --------

cond
*.robotage 0 =
start
'Communication
0 .txpos store
0 .typos store
'Identification Friend Foe or Food
0 .IFFF store
0 .notarget store
1 .friend store
2 .food store
3 .foe store
'Secure Conspec Constants
1 .algaminimalis store
'Situational Awareness
0 .situation store
0 .nothing store
1 .eating store
2 .fighting store
'Condition
0 .health store
1 .fine store
2 .injured store
3 .dying store
4 .intox store
stop


'-------- MAINTINENCE: Health --------

'Health Indication -Fine
cond
*.nrg 2000 >
*.body 1000 > and
*.pain 300 < and
*.poisoned 0 = and
*.paralyzed 0 = and
start
*.fine .health store
stop

'Health Indication -Injured
cond
*.pain 300 >
*.nrg 1000 > and
*.nrg 2000 < and
*.body 1000 < and
*.poisoned 0 = and
*.paralyzed 0 = and
start
*.injured .health store
stop

'Health Indication -Dying
cond
*.nrg 1000 <
*.body 1000 < and
start
*.dying .health store
stop

'Health Indication - Intoxicated
cond
*.poisoned 1 =
*.paralyzed 1 = or
start
*.intox .health store
stop

'-------- MAINTINENCE: Energy Birthties And Other Constants --------

' Get rid of birth tie

cond
start
 .tie *.robage 1 add mult inc
 .deltie inc
stop

cond
start
339 .memloc store
stop

'Body storage
cond
*.nrg *.body >
start
100 .strbody
stop

'Body feeding
cond
*.nrg *.body <
start
100 .fdbody
stop


'-------- IDENTIFICATION FRIEND FOE OR FOOD --------

'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
*.notarget .IFFF store
stop

'Friendly Bot
cond
*.eyef 0 >
*.refshoot 0 > and
*.refeye *.myeye = and
*.health *.intox != and
start
*.nothing .situation store
*.friend .IFFF store
stop

'Food
cond
*.memval *.algaminimalis =
*.refeye *.myeye != and
*.IFFF *.friend != and
*.health *.intox != and
start
*.food .IFFF store
*.refxpos .txpos store
*.refypos .typos store
stop

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

'-------- VISION --------
'NOTE: Current vision system taken from Slam Funk1.01c.
'To be replaced with better functioning system in future builds.

'Targeting genes. If it spots food, it turns to it. -From Slam Funk1.01c

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

'-------- MOVEMENT --------

'Follow friends
cond
*.eye5 0 >
*.IFFF *.friend = and
*.situation *.nothing = and
*.health *.intox != and
start
*.refveldx .dx store
*.refvelUp .up store
30 .aimdx store
stop

'Doing nothing
cond
*.situation *.nothing =
*.IFFF *.notarget = and
start
10 .up store
stop

'-------- COMMUNICATION --------

cond
*.IFFF *.food =
*.IFFF *.foe = or
*.health *.intox != and
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
*.health *.intox != and
start
*.in2 *.in3 angle .setaim store
30 .up store
*.eating .situation store
stop

'Listen for signs of trouble. Go fight if there is any and you're not hurt and busy eating.
cond
*.situation *.nothing =
*.situation *.eating = or
*.in1 *.foe = and
*.health *.intox != and
*.health *.dying != and
*.health *.injured = not
*.situation *.eating = not and and
start
*.in2 *.in3 angle .setaim store
30 .up store
*.fighting .situation store
stop

'-------- COMBAT --------

'Retreating gene
cond
*.health *.injured =
*.refnrg 1500 > and
*.health *.dying = or
*.IFFF *.foe = and
start
628 .aimdx store
20 .up store
stop

'Retaliate to shot outside vision
cond
*.shflav 0 !=
*.shflav -2 !=
start
1256 *.shang sub .setaim store
0 .shflav store
stop

'Shooting gene. Accurately targets food/foe and decides what type of shot to use.
cond
*.situation *.eating =
*.situation *.fighting = or
*.eye5 40 > and
*.refeye *.myeye != and
*.IFFF *.friend != 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
32 .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

'-------- REPRODUCTION --------

cond
*.health *.fine =
*.nrg 2000 > and
start
40 .repro store
314 .aimdx store
stop

'-------- OTHER --------




end




I don't want to spend a week debugging this. It won't shoot, it deletes it's genes, it won't act properly (likely due to it not feeding) and I need to know why. parents are getting pushy, I have to go.
Title: Slam Funk 1.0
Post by: Ta-183 on April 02, 2009, 09:27:40 AM
Alright, I got back to school this morning and go straight to work. One of the things I suspected was to blame was the situational variables not being set at the proper times. I also assumed that I should simplyfy the requirements for the shooting gene to activate. And though not a fatal flaw, I found a problem with the shooting function I took from gimmick in that I had not copied over a custom variable it uses. It worked fine in all the 1.x builds it was used in, but I am still going to put it in for completeness' sake. Plus, it might even improve the performance of SF1.1 a bit. Once I get back to my computers at home I will be able to test the changes. 1.1 is working fine at the moment and I am fine tuning it for release. Once 2.0 has had the kinks worked out I am going to start coding the F1 version! It should be very deadly with tie feeding and virii/venom.
Title: Slam Funk 1.0
Post by: ikke on April 02, 2009, 10:37:26 AM
Quote from: Ta-183
One of the things I suspected was to blame was the situational variables not being set at the proper times.
This is a likely candidate. I have glanced over your code, and it uses them a lot. Setting /resetting them, interactions between them and the order in which they are executed are not trivial. You made a very big step at once and I salute you for it, but this makes debugging hard.
I also noticed you use the number of genes for conspec (at least partly). Expanding on this might help you against current mimicking bots
Quote from: Ta-183
Once 2.0 has had the kinks worked out I am going to start coding the F1 version! It should be very deadly with tie feeding and virii/venom.
A capable F2 bot and F3 bot can use the same base. In F1 the logic is different. Some examples:
In F1 you rape veggies, not eat them.
Shot strenght is based on your body tie feeding is not. In F3 the reduction in shot effectiveness serves as a lower bound for body size. This bound is absent in F1. The effect: look at numbers of bots generated in F3 and F1 combat. They are not comparable.
In F2&3 search and destroy tactics work, the top bots in F1 is much more passive

In effect you are programming an entirely different bot with a new strategy for F1 as opposed to F2&3
Title: Slam Funk 1.0
Post by: Moonfisher on April 02, 2009, 10:51:35 AM
Ok disregard this post. Was explaining about the defines needing propper memmory locations, but hadn't seen there was a page 2 and the second code posted had no issues there so
Title: Slam Funk 1.0
Post by: Ta-183 on April 02, 2009, 12:01:56 PM
Thanks for the pointers. Yeah it uses a gene based counter to differentiate veggies from other bots. I won't be able to test my fixes till tonigh but most problems should be fixed.


The only thing I'm still worried about was an odd behavior where it would lose a gene every time it reproduced. I don't know if this will fix it or not. Debugging is so much easier on a TI-84... Just go into the code and have it display the variables. Would make nested conditions so much easier to make in DNA.
Title: Slam Funk 1.0
Post by: Moonfisher on April 02, 2009, 12:37:17 PM
Ok found some stuff that could help :
*.robotage 0 =
should be *.robage

So all your initial values are never set.

Also noticed some of those values are constants... for that you can just define the constant value you need and refer to the var without the *
(You don't actualy need to create a location to save the value in, however if you plan on extracting the code again from inside DB and you defined an existing sysvar then it may have replaced the comand with the name you defined. The code would execute the same way, but may be harder to read, anyway it's only an issue if you're running an evo sim or something.)

This line :
.tie *.robage 1 add mult inc
isn't working as intended I think.
You could write .tie *.robage sgn 1 sub abs mult inc
Or something like that, but right now you will be incrementing a new memmory location each time your age rises (As in every cycle)
At age 1 you will store in location 2, at age 2 you'll increment location 3... asf...
Also all you realy need is the second line (.deltie inc) to get rid of the birth tie, since newborn robots birties have ID 1 in the child. This should also help against tie attacks in F1 and F2 (But it's not foolproof... cheap though, 0.004 nrg per cycle I think)

This line :
339 .memloc store
could be put in your *.robage 0 gene (The value will not be reset at each cycle)
(Just to save 0.04 nrg per cycle )
EDIT: Also you can just write .genes .memloc store, to make the code more readable (*.genes refers to the value stored in location 339, .genes refers to the value 339 itself)
And if you want to be sure it's alga minimalis, then try checking .dnalen instead of .genes, it's dna length is 13.
The reason is that many top bots only have one gene, and you also risk meeting bots with the same amount of genes as your own bot. So the exact length of the dna is much safer to use.


The gene for checking if all eyes are empty could also be done by adding all the eye values together (Use abs on them if you want to be a 100% sure the result is valid, not sure if eyes can have negative values).
Then check if the result is 0 in the end. This would also save 0.004 nrg per cycle times 8
Although optimizing these areas usualy don't make a big difference unless youre dealing with a small bot running on low nrg.


And last but not least :
You can not change eyefocus mid cycle. If you want to know why read the first post I wrote or read the section on code execution and stacks on the wiki. The explanation on the wiki is probably better, but the post is probably more oriented towards what you need to know. Either way I think it would help you understand how the code works (It's not exactly like regular high level languages like C++ and java and such)
Anyway your eyefocus will always be 0... it will never have any other value because this is the last value you push into it in your code.
All the other actions on eyefocus are irelevant, the last one counts... you can not execute several actions on sysvars in the same cycle... again you need to read that post or the wiki to truly understand why.

But to try and put it in a short and simple way:
The actions you bot takes (moving, shooting, changing eye focus, asf) are not executed at the time where you enter the value, the are executed once every cycle after completing ALL your code.
So for instance .shoot is location 7, so if you write -1 .shoot store, the only thing you did was store the value -1 in location 7, and you spendt 0.04 nrg doing it. (Nothing else happened whatsoever, you did not shoot). Then once you reach the end of your code, if nothing happened to change this value then you will shoot in that cycle and the value in the location will be reset to 0 and your code is then run once more in the next cycle.

Understanding how this works will be very important when designing your virus or viral defences when entering F1.
Title: Slam Funk 1.0
Post by: Ta-183 on April 02, 2009, 12:48:46 PM
Thanks for that. I already know the eye genes don't work as they should. But, they still work a little. The eyes are going to be replaced before I release the bots, but that's the last thing on my list.


And especially thank you for the .robage correction, that might even fix nearly all of it's problems. Only time will tell. (About five hours, give or take.)
Title: Slam Funk 1.0
Post by: Moonfisher on April 02, 2009, 01:23:49 PM
The
.tie *.robage 1 add mult inc
line will also cause some problems... for instance when your bot reaches an age of 339 it will store 1 in location 340 (.delgene) and delete gene 1. So it's offspring will miss this gene and in their turn delete the next gene in position 1 when they reach age 339. Appart from that it'll generaly mess with memmory locations alle the way up, changing your var values and doing all sorts of anoying things

And the using genes for conspec will also become a problem sooner or later by seing 1G bots as alge, or if you meet a bot with the same amount of genes as yours.

But it definately seemed like the robotage thing was causing the most  problems.


If you need a good eye system you're very welcome to steal the one from EyeBot (I find myself pushin code on people, I feel like I'm trying to sell stolen shooes in a park or something).
I tried to comment it well to make it easy for others to use. It has 2 modes available, either switching the focus eye to the next eye in line that isn't empty or turning to the nearest eye that isn't empty. (It always turns in the same direction to make sure it doesn't get stuck turning back and forth)

Otherwise for a good and simpler system look at Excalibur maybe... and I think theres also a topic on another strong eye system, can't remember where though.
Title: Slam Funk 1.0
Post by: Ta-183 on April 02, 2009, 02:15:36 PM
That's it! That's what was causing the gene deletions! I would have never realized that. Thank you so much. I took out that line from all versions, and now that you said that, next to every problem will be gone. Including the eyes. Like some of the other concepts I used, I took the eye routine from gimmick. Hope I don't offend.
Title: Slam Funk 1.0
Post by: Moonfisher on April 02, 2009, 05:13:58 PM
Not at all, took a look at it, it looks a lot like the one in Excalibur which is where I stole the eyes for my first bot
EDIT: Actualy noticed what I wrote wasn't quite right... the robage gets multiplied by .tie which is 330, so I guess the memmory location wraps or something and hits .delgene at times.
Title: Slam Funk 1.0
Post by: ikke on April 03, 2009, 02:37:18 AM
Quote from: Ta-183
Like some of the other concepts I used, I took the eye routine from gimmick. Hope I don't offend.
Gimmick started out by stealing the unique features (gimmicks) of bots it couldn't defeat. I'm not offended, steal with pride
Title: Slam Funk 1.0
Post by: Ta-183 on April 03, 2009, 09:08:50 AM
It worked! The issues I was having are gone. Now there are only a few things left to work out before I can do some final tweaking of some of the values and let this baby rip. The only bug left to work out is this odd behavior it has where it will sometimes hover a ways a way from a bot. I tried to fix this by adding an approaching routine, but now they will sometimes orbit veggies. I need to take a deeper look at this. But other than that, the IFFF and situational conditions work like a charm. It still doesn't get past beholder (which is where the current build of 1.1 is stuck) but I'm really thinking about stealing it's eyes. SF2 can fight off beholder pretty good, but it gets swarmed very quickly. How did you get past it, ikke?


Version 1.1 is running stable and effectively. Even though it fails to beat beholder, I finally put in Gimmick's eye system for testing. I'll see how good it does when I get back, and after that all that is left is final tweaking and optimization. SF1.1 will be released for the F3 league in earnest by tuesday at the latest. Version 2.00 will take a while longer, scince I plan on testing out eyebot's system as a replacement. And if I can figure it out, I might try beholder's system, too. Though beholder really only beats me by swarming to death...
Title: Slam Funk 1.0
Post by: ikke on April 03, 2009, 12:08:09 PM
Quote from: Ta-183
How did you get past it, ikke?
I based Gimmick on Defence, so I had a headstart. In general when advancing I did one of three things (more or less in this order)
1) I stole the code that caused the opponent to be superior.
2) I countered the code that made it superior by inventing my own
3) I stole code of the next bot in the competition.

By stealing I got understanding of genes and the associated sysvars and how they had to be used. I often pitted variants of gimmick (differing in code or parameters) against each other to see which code was superior.
Title: Slam Funk 1.0
Post by: Ta-183 on April 03, 2009, 01:36:39 PM
Well, it looks like I'm going to have plenty of time to do that now. I f*@^ing got suspended from school because of my computer usage (nothing to due with DB, it's my budding career as a military historian that bought me this little... delight....    ) I have been taking a different route, instead of trying to change it's behavior, I've been trying to improve it's general performance. This mainly has to do with aiming, targeting, reproduction, and other factors. I could beat beholder if I could just get these bots to reproduce faster and better.
Title: Slam Funk 1.0
Post by: Moonfisher on April 03, 2009, 06:46:50 PM
Heh for fast reproduction you can look at fruitflies  Or quickdraw, which actualy has soem conditionless reproduction genes and deletes one each cycle, in order to reproduce faster during the first few cycles (Giving it a head start to increase it's odds of raping the alge before it's oponent (Although Saber and Lovebot are the only other 2 rape bots I've seen)).

Other than that spinner is good at producing offspring while feeding on an alge (Could be better though).
And excalibur also has a good simple way of reproducing effectively. Generaly excalibur is a very good bot to look at, it's an F2 bot capable of competing in F1 and it's been in the leagues for a long time. Swarm is also a good bot to look at, it qualifies for F3 but holds a good position in F2 aswell (And it's also a very old bot).

And my first bot was also a big messy ball of stolen code fragments, put together to see how things worked, along with a mean virus that I made myself along with a system for feeding off the alge infected by the virus, which barely worked at all  But once you start to understand how things work theres far more to be gained by trimming your bot than by adding to it. Simpler behaviors are usualy more stable than complex ones, atleast in the leagues with no fluid resistance and a very small field.
Title: Slam Funk 1.0
Post by: Moonfisher on April 04, 2009, 02:55:39 PM
Heh I tried taking out the reproduction and body gene from fruitflies to see what it could do on it's own.
It actualy beats Gimmick 2.0, but it can't beat blind bots like Shoot.
It's just fun to see how a bot that never feeds or attacks can beat a strong league bot just by wearing them out.
Could be a good base for a virus or something.

[div class=\'codetop\']CODE[div class=\'codemain\' style=\'height:200px;white-space:pre;overflow:auto\']cond
*.nrg 80 >
*.body 1 != or
start
.deltie inc

*.body 4 >
*.maxvel .dn store
50 .repro store

*.nrg 80 >
50 *.body 10 mult sub 0 floor .strbody store
not
*.body 1 > and
*.body 10 mult 10 sub 0 floor .fdbody store
stop
Title: Slam Funk 1.0
Post by: Ta-183 on April 06, 2009, 05:19:14 PM
Funny you should mention 'virus base'..... I have been working in my head around an idea for a supervirus. One that can override movement and targeting, in/out, conspec, eyes, repro, and other functions. One  of the main features I am trying to work out is the ability to, with multiple insertions of the virus, determine the location of an antiviral gene if one so exists, and once the antiviral system is dealt with, delete the rest of the pre-existing DNA until one copy of the virus remains. Basically, the virus bot's entire genome. This goes without saying that it would have to be a single-gene bot. But once the bot has been reduced to a single gene, all I'd have to add is the virus controls and systems themselves. Basically it would be near impossible to combat without HUGE antiviral systems. But that's a bit off. I still have to perfect inline conditions. I'll probably do that by modifying SF2's genes to use inline conditions as a way to make sure it's more complicated bits work (as well to solve a few existing problems, right now I have to write an entirely separate shooting gene for eating veggies).
Title: Slam Funk 1.0
Post by: Moonfisher on April 07, 2009, 03:23:13 AM
A few good tips for making a virus :
Anti viral genes are always at the end, since they have no effect on genes that land at a later position. So if can delete the last gene you probably removed your worst problem.
But some anti viral genes are clever. One thing you might see is :
*.delgene 0 !=
0 .delgene store
Preventing you from ever deleting genes, this may be one of the simplest defence but IMO it's also the most anoying one.
If a bot does this there's also a chance it uses this at a later position :
*.mkvirus 0 !=
*.mkvirus .delgene store
This is to delete viruses that try to spread themselves, but it opens up weakness fixed by the first defence. Now you can write :
*.genes 1 !=
*.thisgene 1 add .mkvirus store
And you will cause the bot to delete the genes itself.

Now this is just the tip of the iceberg, obviously since you can manipulate anything you want.
Some use *.genes to detect viruses, some counter it by having .genes dec in the virus. Then again if you want to delete genes you'll have decrement .genes with one more for each cycle.
This is the assimilation part of the bot bellow :
*.genes 1 !=
.genes dec
*.thisgene *.genes sgn add .mkvirus store
*.genes 777 *777 1 sub -1 mult sqr dup div mult store
*777 .genes store
*.thisgene 1 sub *.thisgene 1 sub sgn mult *.thisgene 1 add *.thisgene 1 sub sgn 1 sub -1 mult mult add .delgene store

If you want it to spread the virus aswell you should never start channeling the virus before you're at 1 gene and you know for sure the viral defences are gone.

And for a good example, this is the viral version of Fruitflies that was put into FlyFruit and it does what you where describing. Except it doesn't spread itself, it's spread by an alge.
The full version of Flyfruit is kind of big with about 50 viruses in it and all that, but is has what I like to think is a perfect virus defence allowing it to assimilate new viruses and use them as a weapon against others. The trick is simply that alge have plenty of energy to spare, so storing 0 in all the dangerous memmory locations in the last genes simply overides anything done by viruses earlier on. Only way for a virus to kill it, is by landing as the last gene.

This is mostly well suited for internet mode though... since an alge will have plenty of time to charge this virus, and if it hits something an manages to take over then fruitflies finish the job.
For a league virus the rule of thumb is usuay the shorter you can make it the better it will be. I know Pacifist uses a virus much shorter than this to take over the alge and cause them to feed it. But it can get much shorter than that.
Occura amplificis (Or something like that) holds a very good position in F1 and is probably the shortest bot in F1 (Shorter than fruitflies).
It's also not actualy a bot, but a virus... not a bot spreading a virus, it's a virus in itself from what I can tell. (I personaly find that kind of cool, no base bot just pure virus)

Anyway here's the virus version of fruitflies (This one was made to work together with an alge, so the conspec part may at times be a litle confusing, if you find something odd you can always look at the original Fruitflies 0.21 (Should be in the starting gate, but probably easier to get it by downloading the F1 league)
[div class=\'codetop\']CODE[div class=\'codemain\' style=\'height:200px;white-space:pre;overflow:auto\']
cond
*.key .lock !=
start
.fixpos dec

'-- Birth
300 .eye5width store
.dnalen .memloc store
.dnalen .tmemloc store
31999 rnd .out10 store
31999 rnd .tout10 store

*.memval *.dnalen !=
*.in9 .alge !=
*.in10 .out10 = or and
1 .conspec store

not
2 .conspec store

*.eye5 0 =
0 .conspec store

*.tmemval *.dnalen !=
*.tin9 .alge !=
*.tin10 .tout10 = or and
*.robage 1 > and
1 .tconspec store

not
2 .tconspec store

*.numties 0 =
0 .tconspec store

*.robage 0 =
5 rnd .rand store

*.rand 4 < and
*.rand .type store

*.type 0 =
*.type 3 >= or
3 rnd .type store


'-- Reproduction
*.body 5 >
*.nrg 80 > and
*.maxvel .dn store
50 .repro store

'*.totalmyspecies .maxpop <
*.nrg 200 > 'and
60 *.body 10 mult sub .strbody store


'-- Shrinking
not
*.body 1 > and
*.body 10 mult 10 sub 0 floor .fdbody store


'-- Tie feeding
*.tconspec 2 =
*.numties 1 > or
*.numties .deltie store

*.tconspec 1 =
*.tiepres .tienum store
40 .stifftie store
99 .sharenrg store
10 .fixlen store

dupbool
*.type 1 = and
.tieval .tieloc store
1000 .tieval store

dropbool
dupbool
*.type 2 = and
.tieloc .tieloc store
-1 .tieval store

dropbool
*.type 2 > and
.shootval .tieloc store
-31999 .tieval store

'-- Hunting
*.numties 0 =
*.body 1 = and
dupbool
*.eye5 0 =
*.conspec 2 = or and
350 .aimright store

dropbool
*.conspec 1 = and
*.refxpos *.refypos angle .setaim store
.tie inc

clearbool
*.genes 1 !=
.genes dec
*.thisgene *.genes sgn add .mkvirus store
*.genes 777 *777 1 sub -1 mult sqr dup div mult store
*777 .genes store
*.thisgene 1 sub *.thisgene 1 sub sgn mult *.thisgene 1 add *.thisgene 1 sub sgn 1 sub -1 mult mult add .delgene store
stop
Title: Slam Funk 1.0
Post by: Ta-183 on April 15, 2009, 05:34:23 PM
Since my access to computers is now next to nothing, the release of SF1.1 and SF2 has been delayed indefinitely. Still on the to-do list is optimizing the values (1.1), add a purpose-built eating gene to replace fighting gene for feeding off of veggies (2.0), and fixing any other behavioral issues that remain (2.0). I have noticed also (if I remember correctly) that the latest rendition of SF2 would still turn too often. I am also debating whether or not to extend eye1 and eye9 to provide full rear-quarter detection, but I am unsure whether this would simply cause it to turn TOO much (SF2 can only utilize it's IFFF in the focuseye, may chop the code up to use eye5 for everything that has to do with straight ahead stuff and spin the focuseye around to check other eyes. Although this could hurt it's ability to spot an enemy if it is in a group).
Title: Re: Slam Funk 1.0
Post by: Botsareus on April 30, 2014, 02:20:50 PM
I have no idea what league this belongs in. Moving to untagged.