Darwinbots Forum

Code center => Bugs and fixes => Bug reports => Topic started by: Griz on July 27, 2006, 09:01:12 AM

Title: body and mass
Post by: Griz on July 27, 2006, 09:01:12 AM
I don't know if this is a bug or some setting
I don't have set correctly.
my bots always end up having only a tiny mass
and body ...
each time a bot reproduces, the body and mass
are shared, 50% in most cases ...
and neither the parent or offspring ever gains
any mass or body ...
resulting in a population of bots with very small
masses/bodies ... hardly even visible.
at some point they also seem to no longer be
able to feed.
this occurs even with mutations disabled.
what's up with this?
what am I missing?
this happens with any bots I use.
I see I can adjust the nrg/body ratio for veggies ...
but what determines this with the other bots?
Title: body and mass
Post by: PurpleYouko on July 27, 2006, 09:21:01 AM
It depends a lot on which bots you are using.

Many bots (especially the older ones) have no ability to control their body size.
Some though (notably carnatus orbis) actually use body size as a condition for reproduction. I'm betting you won't see this if you do a test with him.

Another point is that in the options panel you now have the slider that allows you to select how much energy goes to body and how much just goes to the robot's own energy stores. (or is this just for veggie feeding? I don't remember off hand)

Just use a rob that has a .storebody command and/or a *.body condition in its repro gene.
Title: body and mass
Post by: Griz on July 27, 2006, 09:51:41 AM
aha!
yes ...
I'm still trying to find which 'old' bots work in 2.4x ...
indeed Canatus_Orbis works fine.

so this gene:
cond
*.nrg 800 >
start
100 .strbody store
stop

if nrg is greater than 800 begins to store it as body, yes?

and by body condition you mean:

cond
*.nrg *60 >
*.body *61 >
*.eye5 0 =
start
20 .repro store
2 50 store
150 .aimdx store
stop

so both nrg and body must be greater than something ...
could you explain just what value they are being compared to?
just > 60 and >61 ???

should  the .strbody be a standard gene for bots in 2.4?

thanks PY ...
my bots were becoming so small in body I don't think they
had enough body/strength to shoot anymore.

question to any/all ...
what bots actually work in 2.4x?
and which one's need to be tweeked/upgraded?

thanks
Title: body and mass
Post by: Numsgil on July 27, 2006, 10:43:10 AM
Quote from: PurpleYouko
Another point is that in the options panel you now have the slider that allows you to select how much energy goes to body and how much just goes to the robot's own energy stores. (or is this just for veggie feeding? I don't remember off hand)

Just for veggies, but now that you mention it it might be a good idea to extend this to -1 shots as well, or set up a new slider for that.
Title: body and mass
Post by: EricL on July 27, 2006, 01:59:31 PM
Quote from: Griz
question to any/all ...
what bots actually work in 2.4x?
and which one's need to be tweeked/upgraded?

Here's my view on this.

With very few execptions, they should all work without tweaks or changes.  I'm not saying they all actually do work today.  I'm saying they all *should* work and I am committed to spending time on 2.4X fixing issues until they do.

The few execptions have to do with bots that are highly dependent upon previous version physics or default settings which would entail dispensing with some of the new physics "features" in 2.4 in order to make them work.  Generally, these are multi-bots such as Helios or Inchworm whose tie formations or movements were coded to assume specific prior version tie springyness, etc.  Inchworm works in 2.4x for example, after a fashion, but it slews from side to side.  This is because of the differences in tie physics between versions.  In 2.4, the tie Hooke forces are being translated to torque forces without any rotational element which results in oscilations.  Same thing happens when two bots of very different mass are tied.  Harmonics occur, the small guy vibrates.  I'm happy to tweak defaults, change settings, add damping forces, etc but to fix the vibrations properly requires the addition of rotational torque, not just moving due to tie forces but rotating as well.  I probably won;t do that.  And even if I did, there would still be differences preventing some sensitive bots from working correctly.

That said though, all sysvars should work, all behaviours should be as similar as possible.  Anywhere they arn't is a bug.

The best thing people can do to help me is to point out cases *with as much detail as possible* where a bot does X in 2.3X but does Y (or does not do X) in 2.4X.  

I need details.  Ideally, such bug reports have some analysis and a sim or bot DNA fragement behind them, pointing out the gene or sysvar that is or is not behaving correctly and showing some bot code that illustrates this.  It takes me a long time to walk through the DNA of a large bot I am unfamiliar with and compare the state between the different versions and try and pinpoint not only where the bug is but what the bot is supposed to do in the first place.  Help me!

Bot authors, you are in a great position to help me here.  You know what your bot should do and how it does it.  Help me improve the code by helping me debug the problem by pinpointing exactly where and what in your bot unexpected things occur in 2.4.  Thanks.
Title: body and mass
Post by: Griz on July 27, 2006, 02:10:33 PM
ALL of my bots ...
even those that worked in earier versions of 2.4 ...
have this problem of dividing body/mass upon reproduction
ending up with tiny, tiny body/mass.
the exceptins will be those like PY spoke of ...
Canatus_Orbis and others with a .repro store.
even adding that to most of them still results in
them losing ground over time and ending up being
tiny specks.
this is the main reason I haven't been using 2.4 [later versions] ...
I can't get any sims that give any other results.
so if I want something that is semi-interesting ...
I go back to 2.37

what bots do people use that DO work?
maybe looking at them I can get an idea of why/how ...
what they have that the old ones don't.
I'd like a sim that I can actually see.
Title: body and mass
Post by: EricL on July 27, 2006, 02:16:37 PM
Quote from: Griz
I'd like a sim that I can actually see.
Turn off variable bot radii if you don't like it.

Your bots are probably acting exactly the same in the two versions.   You only see the effect in 2.4.  Turn off variable radii if you don't want the radius to change as a function of mass.
Title: body and mass
Post by: Numsgil on July 27, 2006, 02:17:40 PM
How are your bots feeding?  -1 shots and -6 shots should push some returned nrg into body.  Tie feeding wouldn't, and would require a bot conciously storing some body.

I believe that all 2.37 is doing is masking the issue, since it doesn't really change the bots' sizes as they reduce in mass (it does a little, but not as much as 2.4+).

Are your bots actually dying in 2.4 when they lose mass?  Try running a sim with the dynamic sizes disabled. (or static sizes enabled, I forget what the widget is called): if you can't tell a difference between 2.4 and 2.37 we know it's just a cosmetic instead of core problem.
Title: body and mass
Post by: EricL on July 27, 2006, 02:28:57 PM
Great minds think alike....  

Quote from: Numsgil
if you can't tell a difference between 2.4 and 2.37 we know it's just a cosmetic instead of core problem.

FYI, I really do fix the actual underlying radius when "Fix Bot Raii" is checked on the General tab, so it's not just a display artifact.  Any function that relies on a bot's physical size such as collisions, the ability to fit between shapes, visability, how easy they are to hit with a shot, etc. will be impacted.

Another FYI, in my evo sims, being tiny is a common and very effective adaptation cause it basically makes it so hard to hit you that shots are ineffective against you.  Networks of very rapidly reproducing, highly connected tiny tie feeder bots are common and deadly.  See Helios Evolved (http://www.darwinbots.com/Forum/index.php?showtopic=1449).    I bet he kicks the crap out of just about any hand coded bot in a 2.4 sim...
Title: body and mass
Post by: Numsgil on July 27, 2006, 02:31:58 PM
Now if only we could evolve something besides carpets of pond scum
Title: body and mass
Post by: EricL on July 27, 2006, 02:38:31 PM
When your environment is bascially a pond, being pond scum makes you king of the jungle...

Adding moving shapes actually discourages the pond scum adaptation.  Finding food is harder, mobility is favorred, and large masses get chopped up and/or can't fit into narrow passages....
Title: body and mass
Post by: Griz on July 27, 2006, 06:16:39 PM
Quote
Are your bots actually dying in 2.4 when they lose mass?
they were ... as they seemed not to be able to feed/fire effective shots with
too small a body/mass at some point.
I cannow feed the body a bit as PY suggested and that helps them hang
around but they still have small bodies/mass and no longer affect other
bots/veggies much in collisions.
and I can only store small amounts per cycle or it diminishes their energy
more quickly than they can gather it and they do die.
I haven't got that worked out very well yet ...
how much to store as body and at what energy level to begin.
perhaps I'll have to use a body condition as well to ensure they
don't reproduce unless they have sufficient body.
still tweaking/experimenting with all of that.


Quote
Try running a sim with the dynamic sizes disabled. (or static sizes enabled, I forget what the widget is called): if you can't tell a difference between 2.4 and 2.37 we know it's just a cosmetic instead of core problem.
right. did that.
but as eric says ...
it's not just a display artifact and any function that relies
on a bot's physical size will be impacted ...
and there are differences in the physics between 2.3/2.4.
I liked the early versions of 2.4 for that reason ...
the physics ... the collisions and ties to veggies and the
resulting acclerations seemed pretty realistic.
now, with a mass of .25, they have little effect in moving
veggies around.

what I'm trying to do is run things the way most folks are
going to be running their sims/bots ...
so the bots designed and/or mutated can compete on the
same playing field in leagues, etc ...
so we all get on the same page and can exchange and
share our bots and have some consistant results.

so let me ask others again ...
do YOUR bots end up looking like specks of dust with small
body/mass?
(seems like there is a lower limit of .25 for mass regardless
of how small the body gets. I'm talking about < 1 for body)
I even use the smallest field possible and still
can hardly tell the color of a bot or distinguish between any
two species by appearence.
are people using bots that store body as PY's C_Orbis does?
Title: body and mass
Post by: PurpleYouko on July 28, 2006, 08:51:45 AM
Quote
so both nrg and body must be greater than something ...
could you explain just what value they are being compared to?
just > 60 and >61 ???
*60 and *61 are both memory locations that store values used as a threshold for reproduction.
As the bot gets older they are incremented so that a young bot reproduces quite quickly but as they age they get bigger and stronger.

I think Eric is missing the point when he says that ALL older bots will work in 2.4.
Some of the old ones that don't use body controls barely work in pre-2.4 when compared to the ones that manage their own body successfully.
IMO all modern bots need to use some sort of *.body conditional if they want to compete.
Title: body and mass
Post by: EricL on July 28, 2006, 11:20:28 AM
Quote from: PurpleYouko
I think Eric is missing the point when he says that ALL older bots will work in 2.4.
Some of the old ones that don't use body controls barely work in pre-2.4 when compared to the ones that manage their own body successfully.

Of course I meant it as a general principle, a criteria by which someone who sees a difference between 2.3X and 2.4X can use to determine whether they should expect me to spend time and energy reducing or illiminating that difference.

As a general principle, if a bot works poorly in 2.3X, I am committed to making it work equally poorly in 2.4X.  

Quote from: Griz
do YOUR bots end up looking like specks of dust with small
body/mass?
I see this often in my evo sims, depending upon the conditions.  All else being equal, organisms with shorter generation times win.  If you can reproduce more/sooner, selection will favor you.  If you spend cycles and energy on your own growth and mass, instead of reproducing, you will loose, all else being equal.  In an asexually reproducing population (no sexual selection) with no prediation (no reason to defend or compete) there are few or no reasons to be large and this is what a lot of evo sims are like.  In fact, being large actually works against you in such cases.  The vast majority of biological organisms on this planet are single celled, their niches don't favor larger size.  It is only our own marco, multi-cellular predejuce that views smallness as less evolved.

You can set up your sim to favor larger size to a certain extent.  Making veggies scarce or hard to find encourages energy storage.  Using a small number of very high energy veggies encourages competition for access space to the energy supply, encouraging larger size.  Using a simple maze makes finding food more difficult and favors longevity over immediate fucundity.

I have been considering adding some costs that would in themselves, favor larger size such as a thermal loss cost which would be function of the ratio of surface area to mass.  But until then, in most evo sims, I suggest using the zoom button.
Title: body and mass
Post by: Elite on August 01, 2006, 06:04:22 AM
I was running an evosim with A Minimalis and the bots never gained any aditional body, so they just halved their body with every repro until they couldn't reproduce anymore.

In 2.37.6, If a bot was killed, say if all it's energy dropped to zero, then all it's remaining body was transfered to the killing bot. If a bot's body dropped to zero, the bot died, but transfered all it's remaining energy to the attacking bot

So, for 2.4, we need to have any body or energy remaining upon death transfered, rather than being lost to the vaccum.
Title: body and mass
Post by: Elite on August 01, 2006, 08:52:10 AM
... either that or any remaining body is converted to energy on death

I've got a workaround solution. Just have your bots dump energy into body on reproduction, like this:

cond
*.nrg 10000 >
start
50 .repro store
1000 .strbody store
stop
Title: body and mass
Post by: Numsgil on August 01, 2006, 09:42:50 AM
Quote from: Elite
In 2.37.6, If a bot was killed, say if all it's energy dropped to zero, then all it's remaining body was transfered to the killing bot. If a bot's body dropped to zero, the bot died, but transfered all it's remaining energy to the attacking bot

I don't think that's true.  I didn't really play with this when I made 2.4, so in this respect things should be the same between 2.37 and 2.4.   I think Eric's played in this area a little, so 2.4 now might be a little different, but I don't remember for sure.

Also, returned energy shots add a little to your body as well as your energy, so a tiny, unreproducing bot will eventually grow large enough to reproduce without managing its body.  It will just take a while.
Title: body and mass
Post by: Elite on August 01, 2006, 10:03:39 AM
Quote from: Numsgil
Also, returned energy shots add a little to your body as well as your energy, so a tiny, unreproducing bot will eventually grow large enough to reproduce without managing its body. It will just take a while.

They don't. Not in 2.42.7a

If you're only using -1 shots, then you can't get body directly from other bots

Ah, that's interesting ...

-6 shots don't add to your body either. They convert body to energy and then transfer it to you, adding to your energy

Hmm ...
Title: body and mass
Post by: Numsgil on August 01, 2006, 10:14:09 AM
Eric might have changed that, or there might be some hicup.

When PY added the concept of Body ages ago, he made it so that -1 shots etc. would add to your body too, in order to specifically prevent the problems we're having now.

Let me look at the current source and see if I can see the problem.
Title: body and mass
Post by: Numsgil on August 01, 2006, 10:21:41 AM
Eric did indeed change it, perhaps on accident (probably on accident since the comments aren't changed).

new code:
Quote
' robot n takes the energy carried by shot t
Private Sub takenrg(n As Integer, t As Integer)
  Dim partial As Single
   
  If rob(n).Corpse Or rob(n).wall Then Exit Sub
 
  If Shots(t).Range < 0.00001 Then
   partial = 0
  Else
   partial = CSng(Shots(t).nrg / CSng(Shots(t).Range * (RobSize / 3)) * Shots(t).value)
  End If

  If (rob(n).nrg + partial * 0.8) > 32000 Then
   ' EnergyAddedPerCycle = EnergyAddedPerCycle + (32000 - rob(n).nrg)
   rob(n).nrg = 32000
  Else
   rob(n).nrg = rob(n).nrg + partial * 0.8      'most of energy goes to nrg
 '   EnergyAddedPerCycle = EnergyAddedPerCycle + partial * 0.8
  End If
 
   If (rob(n).body + partial * 0.019) > 32000 Then
   ' EnergyAddedPerCycle = EnergyAddedPerCycle + (32000 - rob(n).body) * 10
   rob(n).nrg = 32000
  Else
   rob(n).nrg = rob(n).nrg + partial * 0.019      'a bit goes to body
  '  EnergyAddedPerCycle = EnergyAddedPerCycle + partial * 0.19 '(0.019 * 10)
  End If
 
  rob(n).Waste = rob(n).Waste + partial * 0.01  'tiny amount goes to waste
 
  'Shots(t).Exist = False
  rob(n).radius = FindRadius(rob(n).body)
End Sub

and here's the old one.

Quote
' robot n takes the energy carried by shot t
Private Sub takenrg(n As Integer, t As Integer)
  Dim partial As Long
 
  If rob(n).Corpse Then Exit Sub
 
  partial = Shots(t).nrg / (Shots(t).range * (RobSize / 3)) * Shots(t).value
   
  rob(n).nrg = rob(n).nrg + partial * 0.8      'most of energy goes to nrg
  rob(n).BODY = rob(n).BODY + (partial * 0.019) 'a bit goes to body
  rob(n).Waste = rob(n).Waste + partial * 0.01  'tiny amount goes to waste
  If rob(n).nrg > 32000 Then rob(n).nrg = 32000
  If rob(n).BODY > 32000 Then rob(n).BODY = 32000
  Shots(t).Exist = False
  rob(n).radius = FindRadius(rob(n).BODY)
End Sub
'  robot takes a venomous shot and becomes seriously messed up
Private Sub takeven(n As Integer, t As Integer)
  Dim power As Long
 
  power = Shots(t).nrg / (Shots(t).range * (RobSize / 3)) * Shots(t).value
 
  If Shots(t).Memloc = 340 Or power < 1 Then Exit Sub 'protection from delgene attacks
 
  If Shots(t).FromSpecie = rob(n).fname Then   'Robot is imune to venom from his own species
   rob(n).venom = rob(n).venom + power   'Robot absorbs venom fired by conspec
   rob(n).mem(825) = rob(n).venom
  Else
   If power < rob(n).Shell * ShellEffectiveness Then
     rob(n).Shell = rob(n).Shell - power / ShellEffectiveness
   Else
     Dim temp As Long
     temp = power
     power = power - rob(n).Shell * ShellEffectiveness
     rob(n).Shell = rob(n).Shell - temp / ShellEffectiveness
     If rob(n).Shell < 0 Then rob(n).Shell = 0
   End If
   
   If power < 0 Then Exit Sub
   
   rob(n).Paralyzed = True
   rob(n).Paracount = rob(n).Paracount + power
   
   If Shots(t).Memloc > 0 Then
     If Shots(t).Memloc > 1000 Then Shots(t).Memloc = (Shots(t).Memloc - 1) Mod 1000 + 1
     rob(n).Vloc = Shots(t).Memloc
   Else
     rob(n).Vloc = fRnd(1, 1000)
   End If
   
   rob(n).Vval = Shots(t).Memval
  End If
  Shots(t).Exist = False
End Sub
Title: body and mass
Post by: Elite on August 01, 2006, 10:26:28 AM
Ah. That would explain it then
Title: body and mass
Post by: EricL on August 05, 2006, 01:21:09 PM
Quote from: Numsgil
Eric did indeed change it, perhaps on accident (probably on accident since the comments aren't changed).
Unintentional on my part.  My apologies.  Will be changed back in 2.42.8.
Title: body and mass
Post by: Testlund on August 06, 2006, 04:18:24 AM
Ok, that was weird. I never thought it was a bug. I just thought it was the way the bots decided to evolve. I'm thinking the genes are just set to send very little energy to offspring when they reproduce, and I'm running with 'per kilobody point' setting so tiny bots wont get any energy, or at least very little. I've been waiting for some bot to evolve to give 50% of it's energy to offspring, like the '50 .repro store' gene, but I haven't seen it yet in my sim. Instead I have a bot with these genes that reproduce tiny bots:

 =
 dup and
 14 >
 rnd sqr xor
 *.dn and
 rnd *.sx << or
 inc
 0 mult * *.dx 2 or
 rnd and
 mult pyth not
 rnd *.dn - and
 or
 =
 store
 | dist and
 rnd *.sx | and
 >
 else
 << ++ dist angle rnd *.sx | 1 2 cond
 xor
 dist xor
 sqr *.sx ~ and
 inc
 start
 else
 cond
 xor
 1 and
 rnd *.sx | and
 inc
 cond
 mult else
 cond
 ~ dist pyth rnd *.sx mult 1 >
 cond
 xor
 dist and
 rnd *-1 | <
 inc
 3 else
 cond
 or
 dist and
 rnd *.sx | and
 store
 else
 else
 cond
 xor
 dist not
 rnd *.sx and
 dec
 inc
 else
 start
 cond
 xor
 dist and
 div *.sx | and
 inc
 else
 cond
 xor
 start
 .up inc
 *.sx | 9 *.dn cond
 xor
 dist and
 cond
 *.sx -- and
 inc
 else
 else
 cond
 or
 dist and
 5 *.sx and
 not
 inc
 else
 cond
 stop

''''''''''''''''''''''''Gene  13: Last 'stop' at position  158''''''''''''''''''''''',

 xor


And evolved genes look like a mess and I have now idea why this one multiplies on occasion. But of course all of you may not be running evosims so if you have a bot with a '50 .repro store' gene that produces tiny bots it must be a bug I guess. So I'm looking forward to see how the next drop will look like.
Title: body and mass
Post by: Testlund on September 20, 2006, 01:24:54 PM
Quote from: Numsgil
Eric did indeed change it, perhaps on accident (probably on accident since the comments aren't changed).

new code:

SNIP...
If (rob(n).body + partial * 0.019) > 32000 Then
' EnergyAddedPerCycle = EnergyAddedPerCycle + (32000 - rob(n).body) * 10
rob(n).nrg = 32000
Else
rob(n).nrg = rob(n).nrg + partial * 0.019 'a bit goes to body
' EnergyAddedPerCycle = EnergyAddedPerCycle + partial * 0.19 '(0.019 * 10)
End If
...snip

and here's the old one.

SNIP...
 rob(n).nrg = rob(n).nrg + partial * 0.8 'most of energy goes to nrg
rob(n).BODY = rob(n).BODY + (partial * 0.019) 'a bit goes to body
rob(n).Waste = rob(n).Waste + partial * 0.01 'tiny amount goes to waste
If rob(n).nrg > 32000 Then rob(n).nrg = 32000
If rob(n).BODY > 32000 Then rob(n).BODY = 32000
Shots(t).Exist = False
rob(n).radius = FindRadius(rob(n).BODY)
End Sub
' robot takes a venomous shot and becomes seriously messed up
Private Sub takeven(n As Integer, t As Integer)
Dim power As Long
...SNIP

Could someone please fix this little line of code so I can start running DB again? I whould do it myself but as I've explained in earlier posts I had troubles installing VB and can't get inside the source code.  
Title: body and mass
Post by: Numsgil on September 20, 2006, 05:06:48 PM
I'll see if I can get around to it.  Remind me in a day or so if I forget.
Title: body and mass
Post by: Testlund on September 22, 2006, 07:53:52 PM
It's been 2 days now, hasn't it? Sorry, but I feel a little desperate here. I just bought a new computer and I was thinking it whould be great to run a non-stop sim on my old one and as it is now DB is a mess. There are two main problems right now: The mutations and bots that are getting born are too tiny to survive. The problems with the mutations seems to have something to do with the saving of a sim. It get reset when you load it. But the most important is this line of code that causes all new bots to stay tiny and prevents the sim from going any furter. As I understand it's just that line of code that needs to be change. Wish I could do it.  
Title: body and mass
Post by: Numsgil on September 22, 2006, 11:05:31 PM
Sorry, I did forget

I'm on it.  I'll try to upload a version later tonight.
Title: body and mass
Post by: Numsgil on September 23, 2006, 02:59:39 AM
I've fixed the incoming nrg shot bug so bots should gain body again.

I'm not releasing an actual new version for it because I'm lazy   But it's named as a new version.
Title: body and mass
Post by: Testlund on September 23, 2006, 12:40:08 PM
Great! I'll check it out!
Title: body and mass
Post by: Griz on September 23, 2006, 02:25:51 PM
Quote from: Numsgil
I've fixed the incoming nrg shot bug so bots should gain body again.

I'm not releasing an actual new version for it because I'm lazy   But it's named as a new version.

source?  or is it just the new/old code changes outlined above?
Title: body and mass
Post by: Numsgil on September 24, 2006, 01:34:44 PM
Exactly the code changes above.  My VB version is acting weird, so it's difficult to do any long term development in it.
Title: body and mass
Post by: Griz on September 26, 2006, 03:05:22 AM
ok.
great.
tanks.
I see eric has done an .8 as well ...
not sure if this is in it yet ...
but can add it if it isn't.

haven't had much time to play with DB the last couple of months ...
new job requiring too many hours.
there should be a law!!!!

DB RULES!
Title: body and mass
Post by: Numsgil on September 26, 2006, 09:42:15 AM
His version has this fix, so you should use it instead of this one.