Author Topic: .shootval not working as advertised  (Read 3681 times)

Offline abyaly

  • Bot Destroyer
  • ***
  • Posts: 363
    • View Profile
.shootval not working as advertised
« on: March 20, 2008, 11:08:43 AM »
The following was found using a bot with 1000 body.
Code: [Select]
.shootval   log2 |shootval|    shot cost      lifetime(cycles)     multiplier
     0            -                2             12                    1
    -1            0                2             12                    1
    -2            1                2             12                    1
    -4            2                2             12                    1
    -8            3                16            22                    2
    -16           4                32            33                    3
    -32           5                64            44                    4
Two problems:
The additional cost of the shot should be equal to the value stored in .shootval
The distance multiplier should be equal to log2 |shootval| (when >= 1)

For sufficiently great values, the cost is treating shootval as if it was twice as large and the multiplier is treating shootval as if it was half as large.
« Last Edit: March 20, 2008, 11:13:55 AM by abyaly »
Lancre operated on the feudal system, which was to say, everyone feuded all
the time and handed on the fight to their descendants.
        -- (Terry Pratchett, Carpe Jugulum)

Offline abyaly

  • Bot Destroyer
  • ***
  • Posts: 363
    • View Profile
.shootval not working as advertised
« Reply #1 on: March 20, 2008, 11:33:14 AM »
Here's how the table should look based on what the wiki says about .shootval.
Code: [Select]
.shootval   log2 |shootval|    shot cost       multiplier
     0            -                x               1
    -1            0                x               1
    -2            1                x               1
    -4            2                x+4             2
    -8            3                x+8             3
    -16           4                x+16            4
    -32           5                x+32            5


I haven't tested with shot power but I wouldn't be surprised if there is similar trouble.
« Last Edit: March 20, 2008, 11:34:28 AM by abyaly »
Lancre operated on the feudal system, which was to say, everyone feuded all
the time and handed on the fight to their descendants.
        -- (Terry Pratchett, Carpe Jugulum)

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
.shootval not working as advertised
« Reply #2 on: March 20, 2008, 01:42:20 PM »
If I'm going to get into this area of the code, I'm going to end up re-writing it or at least tweaking to the point that extensive testing will be required.  As such I'd really prefer to address several things all at once, in particular allowing for bots to set both shot range and shot power independently and in a consistant manner.

I propose something like the following:

Create new .shotrange and .shotpower sysvars
Largely relagate .shootval to info shots (I'd take a shot at preserving backward compatability by setting .shotrange or .shotpower under the covers when .shootval is set for non info shots)  
Agree on some formula for costs and scaling of shots of all types (if possible, the same one for all shots).

In particular, I'd like to fully utilize the entire value range for .shotrange and .shotpower in such a manner that mutations have a good chance of hitting on useful values.  I'd also to compact the spectrum of adjacent values instead of having a high probability of equivalent effect for values right next to each other as today.
Many beers....

Offline abyaly

  • Bot Destroyer
  • ***
  • Posts: 363
    • View Profile
.shootval not working as advertised
« Reply #3 on: March 20, 2008, 03:21:44 PM »
Let me make sure I understand your criterea for the formula.
1. It should cover the whole interval [-32000,32000]
2. There should be a pretty good chance a random number chosen here is useful (say 50-50?)
3. Adjacent values should not have nearly identical effects (this throws out anything log related)


My proposal:
If x is positive a value in the interval, the multiplier
m = x / 100
For negatives,
m = -100 / x
And the range (or power) is multiplied by that value. That way the number is a pretty straightforward percentage increase (or decrease) in the attribute.

The multiplier for the cost of the shot should be greater than the multiplier for the other parameter, since twice as far or twice as strong is more than twice as good. We also want some diminishing marginal utility, but logs may be a bit much.
We could make the cost multiplier m squared. That's simple enough. Although it does turn the very large values into suicide shots, as they are now. Anything more than 8944 would make the cost multiplier more than 8000, which would put shot cost over 16k, which is death.
Lancre operated on the feudal system, which was to say, everyone feuded all
the time and handed on the fight to their descendants.
        -- (Terry Pratchett, Carpe Jugulum)

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
.shootval not working as advertised
« Reply #4 on: March 20, 2008, 04:06:21 PM »
Close.  A little philosophy:

I like to see the functionality behind sysvars be such that the probability of a mutation hitting upon a value that does something is high and in cases where it is not, then when there are large ranges of values that do nothing, that this is intentional.  In many cases, this means that the domain of values that "do something" should be the entire -32000 to 32000 range (often with the exception of a 0 value).   For example, values for .shoot are MODed appropriatly such that any non-zero value results in a shot (except for negative multiples of 5 and 7).  Positive values are essentially MOD 1000, negative values are essentially MOD 8.  Before this was the case, the probabiltiy of a mutation hitting a value that fired a shot was small.  Most values did nothing.  But for some sysvars, we may want to intentionally make some potentially large percetage of the space of possible values do nothing.  This is the case with .repro for example.  Negative values do nothing.  Postive vales are MOD 100.  Thus there is a slightly greater than 50% probabiltiy that a point mutation will hit upon a value that does not result in reproduction.  This is intentional.  

So, I am not arguing that every value from -32000 to 32000 must do something unique and or that the sensitivity of every sysvar need be spread accorss the entire range.  I'm happy to only have 100 unique shot power values for example.  Or only two for toggles such as .fixpos.  But I would like to MOD 100 (or MOD 2) the location in the simulator so that the probabiltiy of a mutation hitting a value that does something meets our expectations for that sysvar (essentially 100% for .shotpower, 50% for .fixpos).  Note that .fixpos does not work this way today.  Any non-zero value fixes a bot currently I beleive.

The smoothness of the distribution of values in relation to their effect is an interesting topic.  If the probability of a point mutation is based in part on the prior value of that base pair, then I do think we want small changes in a value to in most cases result in small changes in functionality.  This argues for largly continious functions.






Many beers....

Offline Endy

  • Bot Overlord
  • ****
  • Posts: 852
    • View Profile
.shootval not working as advertised
« Reply #5 on: March 20, 2008, 11:12:18 PM »
We could just pass the buck directly to the dna in terms of finding useful values. I've been thinking for awhile that we could use a basic Right command for string manipulations. Basically something like:

50 3101 1 right store

would result in 50 being stored in up.

Preferably the number in front of right would itself be abs, moded to just the last digit and have 4 subtracted from it if greater than 5, making it more useful in terms of mutations.


Offline abyaly

  • Bot Destroyer
  • ***
  • Posts: 363
    • View Profile
.shootval not working as advertised
« Reply #6 on: March 21, 2008, 04:01:38 AM »
So you want to avoid a setup where a large percentage of values in the range are fatal, I take it.
Lancre operated on the feudal system, which was to say, everyone feuded all
the time and handed on the fight to their descendants.
        -- (Terry Pratchett, Carpe Jugulum)

Offline Endy

  • Bot Overlord
  • ****
  • Posts: 852
    • View Profile
.shootval not working as advertised
« Reply #7 on: March 21, 2008, 10:31:13 PM »
My main concern is more towards pointless mutations that don't have any action. Why waste the processing power if we don't have to? Also I'm concerned about the number of artificial caps in the dna, like 99 for the sharing commands. We could easily make them more open to mutations and impossible to get pegged at the highest value.