Code center > Bug reports

body and mass

<< < (4/7) > >>

Elite:
... 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

Numsgil:

--- 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
--- End quote ---

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.

Elite:

--- 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.
--- End quote ---

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 ...

Numsgil:
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.

Numsgil:
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
--- End quote ---

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
--- End quote ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version