Author Topic: Ties help  (Read 7962 times)

Offline HazD

  • Bot Neophyte
  • *
  • Posts: 17
    • View Profile
Ties help
« on: April 16, 2006, 02:29:41 PM »
Hi guys, I read the wiki on ties and it went straight over my head    
so I was wondering if you could give me a more in-depth explainations of them please.
Especailly anti-birth ties that was added in one of my bots by elite.

Code: [Select]
' Birthtie begone!

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

because rather than just using it, I would like to understand it as well.

thanks
Being an EPOD is fun!  
(Eccentric Person Of Doom)  

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Ties help
« Reply #1 on: April 16, 2006, 02:49:42 PM »
Maybe you could tell me what you do understand and we can go from there.

Offline HazD

  • Bot Neophyte
  • *
  • Posts: 17
    • View Profile
Ties help
« Reply #2 on: April 16, 2006, 02:59:59 PM »
I understand .tienum and some of .deltie, thats about it  I think
Being an EPOD is fun!  
(Eccentric Person Of Doom)  

Offline Elite

  • Bot Overlord
  • ****
  • Posts: 532
    • View Profile
Ties help
« Reply #3 on: April 16, 2006, 03:16:38 PM »
OK, firstly: Birth ties

When a bot is born, a special tie links it to it's parent. This tie will dissapear eventually. However, a combat bot is more efficient if it doesn't spend it's first few cycles connected to it's parent.

An anti-birth-tie gene deletes the birth-tie so that the bot can go do more important things

You cannot delete the birth tie directly using .deltie, so instead, you fire a new tie at your parent that replaces the birth-tie, and delete that.

The gene I gave you is kinda SGified so I'll give you a simpler one:

Code: [Select]
cond
*.robage 0 =
start
.tie inc
stop

cond
*.robage 1 =
start
.deltie inc
stop

There you go - it does the same as the old gene but is easier to understand

Here is an annotated version of the genes:

(You can use ' to comment out code so the program doesn't try to read it, but you probably already know that  )

Code: [Select]
cond
*.robage 0 =
' When you are born (when your age = 0)
start
.tie inc
' Tie to your parent, using inc to store 1 in .tie (inc costs less) by increasing .tie by 1
' This replaces the birth tie with a new tie that has the ID of 1
stop

cond
*.robage 1 =
' When you are 1 cycle old
start
.deltie inc
' Delete the tie
' Stores 1 in deltie to delete the tie with an ID of 1
stop

The gene I gave you is these genes compactified into one gene using 'conditionless coding'. I recomend using these new ones in place of the one I originally gave you.

Following me so far?
« Last Edit: April 16, 2006, 03:17:18 PM by Elite »

Offline HazD

  • Bot Neophyte
  • *
  • Posts: 17
    • View Profile
Ties help
« Reply #4 on: April 17, 2006, 05:01:16 AM »
Ah... I understand that now but what about feeding ties How do they work?
Being an EPOD is fun!  
(Eccentric Person Of Doom)  

Offline Henk

  • Bot Destroyer
  • ***
  • Posts: 110
    • View Profile
Ties help
« Reply #5 on: April 17, 2006, 05:58:25 AM »
OK, here goes:


1. The beginning of ties: friendly cooperation


You see, when ties were first introduced they were given the ability to transfer energy in a multibot (=one organism that consists of multiple bots working together). This was done through tieloc -1.
For example, this is a gene used to transfer energy to another bot that is linked to a tie with a tiephase of 5:
Code: [Select]
cond
*.nrg 5000 >
start
5 .tienum store ' the tie I'm adressing (in this example '5')
-1 .tieloc store  ' the energy transfer tieloc
100 .tieval store ' the amount of energy to transfer
stop

2. Friendly energy method turned into lethal weapon


Then, in october 2003, PY engineered a way to use this energy-transfer system as a weapon/feeding method.

What the tiebot (=bot that feeds through ties) could do in it's DNA is:
Code: [Select]
' this first gene fires a tie with a phase of 5 at any bot
cond
*.eye5 30 >
start
5 .tie store
stop

' this gene feeds through the tie with a phase of 5
cond
*.numties 0 >
' when I have more the zero ties connected to me
start
5 .tienum store
' I adress ties with a phase of 5
-1 .tieloc store
' I adress tie energytransfer memory location
-1000 .tieval store
' I give "negatively", thus: I receive energy
stop

3. involved sysvars


.tie       => store a number in this to fire a tie with that phase
.tienum => sets the tie you are adressing
.tieloc   => sets the memory location you are adressing
            -> -1=energy transfer location
.tieval   => sets the amount to store in that memory location
            -> positive values  => give energy
            -> negative values => receive energy


I hope that has cleared up things a little.
Any questions, please ask. If I can't answer them I'm sure one of the real diehard DNA-programmers can

Henk
cond
*.DBbugs 0 =
start
.rejoice inc
stop

Offline HazD

  • Bot Neophyte
  • *
  • Posts: 17
    • View Profile
Ties help
« Reply #6 on: April 17, 2006, 06:42:05 AM »
Thanks for an explanation that I understand henk.  

Using the code given to me be henk and elite I have created this bot (unanotated) that should tie feed off it's enemies and get rid of it's birth tie.

Code: [Select]
'This is HazD's version of a tiebot.
'This uses code given to me by henk and elite
'Now I understand this code hopefully.

cond
*.robage 0 =
start
.tie inc
stop

cond
*.robage 1 =
start
.deltie inc
stop

'Gene find food
cond
*.eye5 0 >
*.eye5 50 <
*.myeye *.refeye !=
start
*.refveldx .dx store
*.refvelup 50 add .up store
stop

'Gene create tie with ID of 5
cond
*.myeye *.refeye !=
*.eye5 30 >
start
5 .tie store
stop

'Gene tie feed
cond
*.numties 0 >
start
5 .tienum store
-1 .tieloc store
-1000 .tieval store
stop

'Gene Avoid own kind
cond
*.eye5 0 =
*.refeye *.myeye = or
start
314 rnd .aimdx store
stop

'Gene reproduce
cond
*.nrg 4000 >
start
40 .repro store
stop
end
« Last Edit: April 17, 2006, 09:34:10 AM by HazD »
Being an EPOD is fun!  
(Eccentric Person Of Doom)  

Offline Elite

  • Bot Overlord
  • ****
  • Posts: 532
    • View Profile
Ties help
« Reply #7 on: April 17, 2006, 09:50:30 AM »
It seems to get tied to it's conspecs a lot.
I had the same problem when I tried to make a tiefeeder.

For some reason it seems to recognize it's babies as a non-conspec for a cycle or so - enough to tie to them.

I worked round the problem by not tieing to the parent on cycle 0, and deleting the tie (that was inevitably fired at you) on cycle 1, but that solution seems rather messy.

This is the reason I hate ties. They work fine in theory but there's a big difference between their theoretical behavior and how they act in practice  

You'll probably need a gene to detect whether it's tied to a conspec and delete the tie if it is. Something like:

cond
*.numties 0 >
*.trefeye *.myeye !=
start
5 .deltie store
stop

But for this gene to work you'll need to store 5 in *.readtie somewhere, so that you can read trefvars, so add this code to your first gene (*.robage 0 =):

5 .readtie store

Did anyone else making tiefeeders come across this problem? If so how did you fix it?

Offline Welwordion

  • Bot Destroyer
  • ***
  • Posts: 325
    • View Profile
Ties help
« Reply #8 on: April 17, 2006, 09:53:31 AM »
Does any of the commands work in 2.4 that changes the angle or length of a tie?
I wanted to use them but nothing happened

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Ties help
« Reply #9 on: April 17, 2006, 01:12:03 PM »
When I worked on 2.4 I didn't touch ties.  That means that the code may not work because it relied on something that was broken elsewhere.

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
Ties help
« Reply #10 on: April 17, 2006, 01:53:50 PM »
If you can get me a clean repro that shows a problem in 2.4, I'll be happy to fix it...
Many beers....

Offline Welwordion

  • Bot Destroyer
  • ***
  • Posts: 325
    • View Profile
Ties help
« Reply #11 on: April 17, 2006, 04:06:08 PM »
Even sharenrg does not seem to work for me :/

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
Ties help
« Reply #12 on: April 17, 2006, 07:21:21 PM »
Build the simpliest bot you can that demonstrates the problem.
Put it in the simpliest sim you can.
Zip it up and post it in the bug report forum with instructions as to how to reproduce the problem.  Be as specific as you can as to what you expect and what is actually happeneing and how to see that in the sim.
I will take it from there and fix the code off the 2.4X code base.
Many beers....

Offline abyaly

  • Bot Destroyer
  • ***
  • Posts: 363
    • View Profile
Ties help
« Reply #13 on: May 03, 2006, 11:57:45 PM »
Quote from: Elite
Did anyone else making tiefeeders come across this problem? If so how did you fix it?

*.eye5 > 70 or so
if *.tiepres != (value for ties this bot creates)
*tiepres .deltie store

But I never managed to get the bots to properly feed through ties ^^
Lancre operated on the feudal system, which was to say, everyone feuded all
the time and handed on the fight to their descendants.
        -- (Terry Pratchett, Carpe Jugulum)

Offline Endy

  • Bot Overlord
  • ****
  • Posts: 852
    • View Profile
Ties help
« Reply #14 on: May 04, 2006, 02:24:51 AM »
Quote
Did anyone else making tiefeeders come across this problem? If so how did you fix it?

The main problem you're having is that the parent and child share the same tie number. This can make it tricky to distinguish between the two, resulting in the need to use readtie. It's normally best to randomize your tie number at birth that way you can auto delete any other ties that are not yours. It also helps to prevent an enemy from figuring out your species' tie number and using it to rapidly delete your ties.

Code: [Select]
cond
*.robage 0 =
start
31999 rnd 1 add 50 store
' stores a random number from 1-32000
stop

cond
*.refeye *.myeye !=
*.eye5 45 >
start
-6 .shoot *.robage sgn mult *.refage sgn mult store
*50 .tie *.robage sgn mult *.refage sgn mult store
stop
 
'These genes above decrease the likelihood of child-parent or parent-child tieing

cond
*.tiepres *50 !=
*.tiepres 0 >
start
'deletes the tie if it's not mine
*.tiepres .deltie store
stop

cond
*.tienum 1 =
start
' tie and feed
*.50 .tienum store
-1000 .tieval store
*.tieval sgn .tieloc store
' above normally results in -1 .tieloc store, if another bot tries to reverse tie feed however
' it will auto-shift to storing thousands of nrg units in their up location :)
stop

Since the chances of robage or refage being zero are relativly slim normally, it's best to SG'ize the code. The odds of two conspecs having the exact same tie number is extremly unlikely, making it easy for a bot to realize another bot has accidentally(or not  ) tie to you. You can also delete a tie in case of extreme pain, helping to avoid the possibility of reverse-tiefeeding.

Hope all this helps, there should be some tutorials on the wiki. I'll take a look and see whats there again.

http://www.darwinbots.com/WikiManual/index...7s_Tie_Tutorial

Here's the link. I added some info on tie feeding, leaching, and sharing.
« Last Edit: May 04, 2006, 03:19:25 AM by Endy »