Author Topic: Tieports and multiple ties RESOLVED 2.43r  (Read 3064 times)

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
Tieports and multiple ties RESOLVED 2.43r
« on: November 13, 2007, 12:06:07 PM »
I'm no tie expert, but I'm in the code now and there are some fuzzy areas I'm trying to address.  Here's what I'm doing for tieports and multiple ties.  Please comment if you like.

So, two or more ties can have the same tie port.

Lets say my code does:

.tie inc

and creates three ties to three different bots over the course of several cycles.

I will have three ties each with a tieport of 1.

.tiepres will be 1.

.numties will be 3.  .numties will always reflect the number of ties I have, whether I created them or not.

.tielen and .tieang will reflect the length and angle of the last tie created or connected.  If the last tie of the three gets deleted, .tielen and .tieang will change to reflect the length and angle of the second tie created.  Same with trefvars.  Same with .tieloc and .tieval and any tie related sysvar that only operates on a single bot on the end of a specific tie.

On the otherhand, sysvars which act on ties themselves such as .fixlen and .fixang will be applied to all ties with the tieport specified in .tienum (or .tiepres if .tienum is 0).  Thus, I can set the length and angle of all three ties I created in one cycle (once they harden) if I so choose without using .tieang1, .tielen1, .tieang2, .tielen2, etc.
 
When a bot ties to me, the tieport of that tie from my point of view will be whatever .numties is at the end of the cycle in which the tie was created.  That is, if I have 3 ties that I created, all with a tieport of 1 and a bot comes along and ties to me, then my .tiepres will become 4 and .tielen and .tieang will change to reflect the properties of that tie unless the bot explicitly sets .tienum to 1 in which case they will shift back to the last tie created with that tieport, but only for that cycle unless the bot continues to store 1 in .tienum each cycle.

Note that if one of the three ties I created gets deleted in the same cycle as another bot ties to me, the .tiepres of that tie will be 3, not 4.  But once the tieport of that tie is set, it will not change even if all the other ties go away.  It will remain 3 even if I delete all ties with tieport 1 and .numties drops to 1.  I better catch it (using .tiepres) before another tie to me happens (and changes .tiepres) if I ever want to address that tie.

Chime in if I have things wrong...
« Last Edit: November 14, 2007, 02:03:39 PM by EricL »
Many beers....

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Tieports and multiple ties RESOLVED 2.43r
« Reply #1 on: November 14, 2007, 05:00:53 AM »
Quote from: EricL
So, two or more ties can have the same tie port.

Right.  Tie ports are like radio frequencies.  A bot can control multiple ties simoltaneously(sp?) using the same tie port.

Quote
.tielen and .tieang will reflect the length and angle of the last tie created or connected.  If the last tie of the three gets deleted, .tielen and .tieang will change to reflect the length and angle of the second tie created.  Same with trefvars.  Same with .tieloc and .tieval and any tie related sysvar that only operates on a single bot on the end of a specific tie.

Almost, I think.  Anything like that references whatever tie(s) is(are) pointed to by .tienum, I'm pretty sure, and tienum gets set when a tie is formed...  But that would seem to lead to problems, wouldn't it?  Hmm...

Quote
When a bot ties to me, the tieport of that tie from my point of view will be whatever .numties is at the end of the cycle in which the tie was created.

I think the tie ports are supposed to be the same for both bots.  But again, I'm not entirely sure.

There's a thread here, split from another topic, where PY and I discuss ties.  Honestly, it sort of seemed to me like a complicated mess, so I started exploring different ideas of unifying the ideas in a more elegant framework, I just never got far enough into it to implement.

The whole tie scheme needs to be reworked; at the moment it's extremely ad hoc.

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
Tieports and multiple ties RESOLVED 2.43r
« Reply #2 on: November 14, 2007, 12:50:40 PM »
Quote from: Numsgil
Almost, I think.  Anything like that references whatever tie(s) is(are) pointed to by .tienum, I'm pretty sure, and tienum gets set when a tie is formed...  But that would seem to lead to problems, wouldn't it?  Hmm...

My understanding is that .tiepres is read-only and gets set when ties get formed, but never .tienum.  .tienum is write only, always explicitly set by the bot itself and is not sticky.  It gets reset to 0 every cycle and bots must set it again each cycle if they wish to direct the tie sysvars to something other than than the tie indicated by the value of .tiepres.

I've got it working right now such that if .tienum is 0, everything defaults to the tie with the port indicated by .tiepres.  Everything, all tie operations, even those which use to only work if .tienum was set.  This seems to work fairly well and has the nice side effect of lowering the bar to evolving sucessful tie behaviour.  Tie operations which used to do nothing (because .tienum was 0) now default to operating on the last tie created or connected.

Quote from: Numsgil
I think the tie ports are supposed to be the same for both bots.  But again, I'm not entirely sure.
That is indeed is the way it has been in the code since I came along I.e. same port number at both ends.  This is nice for multibots as they can contian genes which address specific tie ports without regard to when and if and in what order ties are created and avoid having to capture the tie connection event for ties they did not initiate.

But here is my problem with this.   Multiple ties can happen in a single cycle, either multiple other bots tying to you in the same cycle or a bot tying to you in the same cycle you initiate a tie to another bot.   There is only one .tiepres, so in situations where the two bots are not part of a multibot, it's quite possible a bot could initiate a tie to you and you would have no way to know the tie port and no way to address the specific tie.  By making the tieports different at each end, the tied bot can be certain that the tieports of any new ties which connected to it in the last cycle lie in a narrow range between the value of .numties last cycle and .numties this cycle, allowing it to address the tie, find out about who conencted to it, etc.

Multibots have other means of corrdinating during morphogenisis.  The cell which initated the tie can obviously address it and poke something into the memory of the other cell and so on.  I think it makes senss to help the tie victim address the tie feeding off it...

Quote from: Numsgil
There's a thread here, split from another topic, where PY and I discuss ties.  Honestly, it sort of seemed to me like a complicated mess, so I started exploring different ideas of unifying the ideas in a more elegant framework, I just never got far enough into it to implement.

The whole tie scheme needs to be reworked; at the moment it's extremely ad hoc.
Agreed There are indeed a whole bunch of problems, some large some small.  One small one for example is that there's no way to determine how stiff a tie is.  I should probably add .tiestiffness ASAP to go alnong with .tielen and .tieang.

More broadly, as has been widly dicussed, we need a paradym for addressing multiple ties with different tieports in the same cycle.  I may spend some time in this area in coming weeks.  I think I may expand ties to encompass spikes (ties to nowhere which are part of the bot morph which allow you for exampel, to fend off a rival and keep them out of shot or tie range - will require bot/tie collision detection) and ties to shapes as means for bots to manipulate them...
« Last Edit: November 14, 2007, 12:52:51 PM by EricL »
Many beers....