Author Topic: Major shot and energy bug  (Read 5061 times)

Offline Elite

  • Bot Overlord
  • ****
  • Posts: 532
    • View Profile
Major shot and energy bug
« on: May 09, 2006, 11:12:15 AM »
Here you can see a fixed bot shot feeding

  • It seems to have a non-integer amount of energy, body and waste. This is weird in itself
  • Even though it just sits there feeding it isn't actually gaining any energy at all
There seems to be a strange violation of conservation of energy here
Some other strange things also happen, like a bot dying suddenly

I belive PY noticed that bots were not gaining energy from feeding and were dying suddenly
« Last Edit: May 09, 2006, 11:12:36 AM by Elite »

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
Major shot and energy bug
« Reply #1 on: May 09, 2006, 11:22:16 AM »
The non integer amounts of waste, etc. are correct.  The way it works is that the engine maintains internal decimal quantities for all these things and rounds them to integers for the bot when they are put into the bot's memory.  But it is these internal values whcih are actually used by the engine for most calculations.  Most small bots will have mass < 1 for example, which will round to 0 often as far as the bot knows, but that bot still has mass, enertia, etc. as far as the engine is concerned.  What I did in this release was simply to remove the rounding for these values as displayed in the robot properties dialog.  In the next release, I'll cut off all but perhaps two places past the decimal point to make them more readable.

The energy thing may very well be a bug.  I have not had a chance to investigate this since PY noticed it.  One thing I have noticed which may be to blame is that since bots in 2.4 change size and an energy return shot has to actually hit the bot for the energy to be received, small/young bots can be at a huge disadvantage and exhibit what you see I.e. shooting, but loosing energy every shot cause the return shots miss them.

Anyway, it's probably still a real bug.  I'll investigate for sure, but probably not until this weekend.  Need a few days away from the code.
« Last Edit: May 09, 2006, 11:46:15 AM by EricL »
Many beers....

Offline Henk

  • Bot Destroyer
  • ***
  • Posts: 110
    • View Profile
Major shot and energy bug
« Reply #2 on: May 09, 2006, 12:55:36 PM »
I get this one, too.

Bot fire shots at vegs (and receive white shots), but their energylevels don't rise.

and sometimes -1 shots hit vegs but no energy comes back at all. (see screenshot)

[a href=\"http://img297.imageshack.us/my.php?image=dbbug8uh.jpg\" target=\"_blank\"]
« Last Edit: May 09, 2006, 12:56:37 PM by Henk »
cond
*.DBbugs 0 =
start
.rejoice inc
stop

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
Major shot and energy bug
« Reply #3 on: May 09, 2006, 01:01:09 PM »
I'd be interested in knowing whether you can see the white energy shots coming back and actually hitting the bot or whether they miss and whether you can tell whether this has any impact on whether the bot receives energy or not....
Many beers....

Offline Elite

  • Bot Overlord
  • ****
  • Posts: 532
    • View Profile
Major shot and energy bug
« Reply #4 on: May 09, 2006, 01:16:28 PM »
Quote from: EricL
I'd be interested in knowing whether you can see the white energy shots coming back and actually hitting the bot or whether they miss and whether you can tell whether this has any impact on whether the bot receives energy or not....

AHA! Got it!
The -2 shots that come back have a limited range! So they just dissapear before they hit the bot!

However, there might be an entirely seperate bug that's causing the shots not to appear at all.
(ie. in Henk's screenshot)
« Last Edit: May 09, 2006, 01:40:58 PM by Elite »

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
Major shot and energy bug
« Reply #5 on: May 09, 2006, 01:31:02 PM »
I notice that in Henk's screenshot, the -1 shots are hitting the very edge of a fat veggie. I think there might be an upper limit to the diameter of the bot which will send back -2 shots. At least that was what I found when I first introduced variable robot size in 2.36. maybe this is more of the same but more pronounced since robot size is so much more variable.

Personally I think there is too mauch size variation but that is just an opinion and not a technical issue.  
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D

Offline Elite

  • Bot Overlord
  • ****
  • Posts: 532
    • View Profile
Major shot and energy bug
« Reply #6 on: May 09, 2006, 01:36:01 PM »
This seems to be is a combination of three issues:

1) -2 shots don't have a great enough range to hit the bots they're supposed to be feeding
2) There might be an upper limit to the diameter of the bot which will send back -2 shots, so you might not get back energy if you shoot a fat veg with a glancing hit
3) With my combat bots, sometimes energy shots are missing because the bots are too small and by the time the shot reaches them they have moved

On the topic of sizes:

Hey, you couldn't include the option to turn dynamic sizes on and off could you?
« Last Edit: May 09, 2006, 01:40:34 PM by Elite »

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
Major shot and energy bug
« Reply #7 on: May 09, 2006, 02:01:49 PM »
Hey, I bet shot ranges don't take into consideration a bot's radius!  I bet they are calculated from the bots center, so the bigger the bot, the more shots exists soley inside the bot where other bots can't get at them.  Making collision detection work probably exberated this issue in 2.4 since now bots can't get inside other bots where the energy shots mostly are!!!!  This is why this is becoming more apparent now.  Energy shots also decay over time so even when they do get outside the bog bot, they have less energy!

I'll take a look at size restrictions and I'll make shot range take bot radius into consideration for sure.  I think it's probably pretty easy to expose setting limits on maximum and minimum bot radius though I will have to take a look.
Many beers....

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Major shot and energy bug
« Reply #8 on: May 09, 2006, 03:03:51 PM »
There is some vector fun with shots to bots collision detection that has screwed me up so many times in the past.  It's basically a line to circle collision detection.  That could be suspect.

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
Major shot and energy bug
« Reply #9 on: May 10, 2006, 09:49:49 AM »
Quote
Hey, I bet shot ranges don't take into consideration a bot's radius! I bet they are calculated from the bots center, so the bigger the bot, the more shots exists soley inside the bot where other bots can't get at them.

I bet you are right.
We had this problem to a lesser degree in 2.36.
I think shots are generated at 'bot center' but collisions are detected at 'bot perimeter'
Returned shots should be set to the same range as incoming shots but with a small bot shooting a big bot that might not be enough.
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D

Offline Elite

  • Bot Overlord
  • ****
  • Posts: 532
    • View Profile
Major shot and energy bug
« Reply #10 on: May 10, 2006, 11:00:15 AM »
Quote from: PurpleYouko
I bet you are right.
We had this problem to a lesser degree in 2.36.
I think shots are generated at 'bot center' but collisions are detected at 'bot perimeter'
Returned shots should be set to the same range as incoming shots but with a small bot shooting a big bot that might not be enough.

So you can't feed on a bot that's bigger than you? No wonder so many bots were dying

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
Major shot and energy bug
« Reply #11 on: May 10, 2006, 11:14:32 AM »
I was looking at this code last night and I think it may be more complex then my initial guess.  From a quick look at the code, it does appear that shots do infact take bot radius into consideration to some extent.  Whether it does so correctly however, will require a few hours of analysis.  There is a bunch of vector math in this area and I will need to step through things line by line to get my head around it.

One thing I did notice is that a surprising amount of waste can be generated when bots consume high energy shots which can lead to altzheimers which can lead to them suddenly and seemingly inexplicitly going poof as PY and others have reported.  This may or may not be the explanation for what people have seen.  One of the several things that governs the energy in a return shot is the mass of the bots involved and for higher mass bots, the result of consuming a single energy shot can generate waste of 50 or more from a single shot!

I'll be offline for the next few days (going to camp with my son and 120 other 5th graders.  Oh joy.)   But digging into this area is top O the list for the next drop.
Many beers....

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
Major shot and energy bug
« Reply #12 on: May 11, 2006, 04:18:12 PM »
Quote
So you can't feed on a bot that's bigger than you? No wonder so many bots were dying
Well you can but possibly not if the difference is really big.

Remember that the strength and range of a bot's shots are somewhat dependent on his body points.
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Major shot and energy bug
« Reply #13 on: May 11, 2006, 04:26:25 PM »
power is linearally based on body, range is logarithmically based on body.