Author Topic: Hive coding  (Read 9578 times)

Offline Elite

  • Bot Overlord
  • ****
  • Posts: 532
    • View Profile
Hive coding
« on: January 28, 2006, 10:40:42 AM »
This thread is to discuss hivebot's hive coding (be that hive location, hibernating etc.)

The Hive is a location chosen by the Queen at the start of the sim as far away from the Pray communities as possible. It is a place that the species can come back to periodically to get orders from the Queen/Keepers.

When the species goes into hibernation it does so at the hive. Henk suggested a brilliant hibernation strategy:
All the hibernating bots tie together at the hive, then the 'wake up call' can be transmitted via chain reaction very quickly. Also, the hibernating bots could share nrg and include a few veggies in the 'hibernation web' to sustain the hibernating hivebots. Discuss the code for this here.

More importantly, we need some form of hive-selection code and basic hibernation code first.


Let the discussion begin  :)
« Last Edit: January 28, 2006, 02:47:05 PM by Elite »

Offline Ulciscor

  • Bot Destroyer
  • ***
  • Posts: 401
    • View Profile
Hive coding
« Reply #1 on: January 29, 2006, 12:46:39 PM »
Wow this could easily get horribly complicated. Was there a specific pattern in mind or would the hibernating bots just congregate and tie together any old how? Who is it that gives the wake up call? Forgive me if I'm asking questions with answers elsewhere. :P
:D Ulciscor :D

I used to be indecisive, but now I'm not so sure.

Offline Elite

  • Bot Overlord
  • ****
  • Posts: 532
    • View Profile
Hive coding
« Reply #2 on: January 29, 2006, 12:58:39 PM »
Ask all the questions you like  :D

1) Is there a specific pattern in mind?
- No, the bots just 'latch on' to the mass of hibernating bots

2) Who gives the wake-up call?
- A special caste called the Keepers does not hibernate. At birth each wraith has the (5% I think) chance of becoming a Keeper. Keeper's are sterile and do not go into hibernation with the others. When the Keepers determine that there is enough prey to feed on again, it is they who wake the other wraith up. It is also the Keepers' job to send the species into hibernation when their prey's numbers become too low.
The Keepers wake the other bots up by shooting an info shot at one of the hibernating bots. Then the 'wake-up call' is transmitted through the hive via chain reaction through the ties.
While hibernating, the wraith share nrg with each other and there are a few veggies in the tied up mass as well to sustain the wraith through the hibernation period.

Any more questions?  :D
« Last Edit: January 29, 2006, 12:59:56 PM by Elite »

Offline Ulciscor

  • Bot Destroyer
  • ***
  • Posts: 401
    • View Profile
Hive coding
« Reply #3 on: January 29, 2006, 04:01:54 PM »
From your description of the Keepers and the other Wraiths, it seems that the Keepers are the weak point in the chain... if anything malfunctions with them, or they are killed off, the whole system pretty much shuts down.

Also, chain reaction messages through networks is cool, but having tried this (somewhat naively) before, I ended up with the same info being passed between the same bots repeatedly. I think [Num] likened it to harmonic motion without a dampening force or similar.

My only idea to solve that was to have the bot send the info to other bots and then immediately sever its own ties and move away.
:D Ulciscor :D

I used to be indecisive, but now I'm not so sure.

Offline Elite

  • Bot Overlord
  • ****
  • Posts: 532
    • View Profile
Hive coding
« Reply #4 on: January 29, 2006, 04:48:17 PM »
The Keepers are sterile, and therefore very strong. Rather than hibernating, they 'pick off' one or two Praybots when they need a snack.
When a new wraith is born, it 'decides' wether or not to become a Keeper (5-10% chance) so new ones are being created during reproduction.
Weak link in the chain? I don't think so - there will be fail-safes in place:

1) If the keepers haven't woken the hive up after so many cycles then they will wake up anyway
2) If any one of the hibernating wraith are attacked then all of them will wake up
3) If a Keeper is threatened then they will wake the hive
4) If the pray become too much of a threat then they will wake the hive
5) Once the hive have woken, they will produce new keepers when they reproduce anyway
6) I doubt Preybot is that much of a threat  :D but we've always got to be open to new possibilities

As for the chain-reaction idea we'll probably try your idea (send message and then sever immediately), but we might have to play around with that one.
My idea was to use in/out signals to wake the hive
An alternative is that once one bot is woken they will try to wake others using info shots until they are all awake.

Thanks for your input Ulciscor  :)
Do you have any ideas as to how to do the hibernation?

Personally I think ties are rather complicated and messy anyway. I would like to avoid using them with Preybot, but I just liked the hibernation tieing idea  :)
I hope we can find a way to implement it.
« Last Edit: January 29, 2006, 04:53:48 PM by Elite »

Offline Ulciscor

  • Bot Destroyer
  • ***
  • Posts: 401
    • View Profile
Hive coding
« Reply #5 on: January 29, 2006, 05:22:29 PM »
I guess if we were to emulate nature and be really thorough, we could give the bots a pre-hibernative behaviour. Like squirrels gather food, maybe the bots could store up on shell and body before they hibernate. They could feed on this occasionally during hibernation and it would protect them from predators. When they woke up they could convert it back to energy to use to hunt.

I found ties a complete nightmare, but that's probably because I didn't have a clear plan about how to use them and what I wanted to do. It looks like that is being seen to properly this time.
:D Ulciscor :D

I used to be indecisive, but now I'm not so sure.

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Hive coding
« Reply #6 on: January 29, 2006, 06:03:53 PM »
No, ties really are a complete nightmare ;)

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
Hive coding
« Reply #7 on: January 29, 2006, 07:06:56 PM »
I kind of like them.  :D
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
Hive coding
« Reply #8 on: January 29, 2006, 08:28:22 PM »
Quote
I kind of like them.  :D
so ... you enjoy waking up screaming ...
takes all kinds. ;) lol
« Last Edit: January 29, 2006, 08:35:20 PM by Griz »
不知
~griz~
[/color]
   "The selection of Random Numbers is too important to be left to Chance"
The Mooj  a friend to all humanity
[/color]

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Hive coding
« Reply #9 on: January 29, 2006, 09:08:29 PM »
it is a great cardio vascular workout regime.
« Last Edit: January 29, 2006, 09:08:38 PM by Numsgil »

Offline Endy

  • Bot Overlord
  • ****
  • Posts: 852
    • View Profile
Hive coding
« Reply #10 on: January 30, 2006, 02:18:51 AM »
What about a tmemval, tmemloc combo? A keeper could transmit the wake-up call via them. Would have to first send the message to all ties, then delete them.

Keeper Sense if bot has wake up tmemval,
If not change it via tieloc/tieval
If so delete that tie

Something like that anyways. I don't think in/out could work since all the bots are sleeping. They'd be unlikly to see the message.

An alternative would be to use shots. A keeper could info shoot the message to all bots in the area that are sleeping. Who would in turn wake up all the bots they see.
« Last Edit: January 30, 2006, 02:22:11 AM by Endy »

Offline Old Henk

  • Bot Destroyer
  • ***
  • Posts: 229
    • View Profile
Hive coding
« Reply #11 on: January 30, 2006, 10:32:03 AM »
Don't forget that an untied hive will live shorter, because it doesn't get the cost reduction given by ties.

Offline Light

  • Bot Destroyer
  • ***
  • Posts: 245
    • View Profile
Hive coding
« Reply #12 on: January 30, 2006, 11:03:40 AM »
you can make them share slime and shell for better protection

Offline Elite

  • Bot Overlord
  • ****
  • Posts: 532
    • View Profile
Hive coding
« Reply #13 on: January 30, 2006, 12:21:57 PM »
Here:

Code: [Select]
' I am hibernating ...

' NB - '.ties', '.hibernate' and '.wakeup' are custom variables

' How many ties do I have?

cond
*.numties *.ties >
*.hibernate 1 =
start
*.numties .ties store
stop

' If the number of ties is decreasing then delete all ties

cond
*.numties *.ties <
*.hibernate 1 =
start
*.tiepres .deltie store
stop

' Once I have no ties come out of hibernation

cond
*.numties 0 =
*.hibernate 1 =
start
0 .hibernate store
stop

Code: [Select]
' Wake if attacked

cond
*.pain 100 >
start
*.tiepres .deltie store
stop

Code: [Select]
' Time to get up

cond
*.wakeup 1 =
start
*.tiepres .deltie store
stop

SGified:

Code: [Select]
cond
start
*.numties .ties *.hibernate mult *.numties *.ties sub sgn mult store
*.tiepres .deltie *.hibernate mult *.ties *.numties sub sgn mult store
0 .hibernate *.hibernate mult *.numties 1 sub sgn mult store
*.tiepres .deltie *.hibernate mult *.pain 99 sub sgn mult store
*.tiepres .deltie *.hibernate mult *.wakeup mult store
stop

 :)

How's this?
« Last Edit: January 30, 2006, 12:56:20 PM by Elite »

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
Hive coding
« Reply #14 on: January 30, 2006, 12:47:11 PM »
Quote
cond
*.numties *.ties >
*.hibernate 1 =
start
*.numties *.ties store
stop

' If the number of ties is decreasing then delete all ties

cond
*.numties *.ties <
*.hibernate 1 =
start
*.tiepres .deltie store
stop

This won't work. At least not in 2.36 or earlier.
You CANNOT perform calculations of any type in the condition step of the gene.

Num may have incorporated this ability into 2.4. Not sure though.
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D