dog

Only here to post about CD-ROMs

I want!!
⬅️ this mark
🍷white
and Taste 🦆11
require

 

 

(Avatar by @texture, CD-ROM Journal button by @candiedreptile)


CD-ROM Journal
cdrom.ca/

Hey math knowers: I could use your help.

I’m patching the table of encounter rates in a game. I have the original values, which form a curve. I’d love to be able to calculate what that curve is, so I can recreate it; and come up with a new curve to replace it with. But I don’t know much about this kind of thing. What should I be looking into?

EDIT: I had a few questions, so a couple more details: there are 105 values in the original set, and I've added a line graph.


EDIT 2: Here's the actual values!

[
  0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, 0x00D0,
  0x00D1, 0x00D2, 0x00D4, 0x00D6, 0x00D8, 0x00DA, 0x00DC, 0x00DE, 0x00E0,
  0x00E2, 0x00E4, 0x00E6, 0x00E8, 0x00EA, 0x00EC, 0x00EE, 0x00F0, 0x00F3,
  0x00F6, 0x00F9, 0x00FC, 0x00FF, 0x0102, 0x0105, 0x0108, 0x010B, 0x010E,
  0x0112, 0x0116, 0x011A, 0x011E, 0x0122, 0x0127, 0x012C, 0x0131, 0x0136,
  0x013B, 0x0140, 0x0145, 0x014A, 0x014F, 0x0154, 0x0159, 0x015E, 0x0168,
  0x0172, 0x017C, 0x0190, 0x01A4, 0x01B8, 0x01CC, 0x01E0, 0x0208, 0x0230,
  0x0258, 0x0280, 0x02D0, 0x0320, 0x0384, 0x03E8, 0x044C, 0x04E2, 0x0578,
  0x060E, 0x06A4, 0x076C, 0x0834, 0x08FC, 0x09C4, 0x0AF0, 0x0C1C, 0x0D48,
  0x0E74, 0x0FA0, 0x10CC, 0x11F8, 0x1388, 0x1482, 0x157C, 0x1676, 0x1770,
  0x186A, 0x1964, 0x1A5E, 0x1B58, 0x1C52, 0x1D4C, 0x1E46, 0x1F40, 0x203A,
  0x2134, 0x2260, 0x238C, 0x24B8, 0x25E4, 0x2710
]

You must log in to comment.

in reply to @dog's post:

I'd Google for "Quadratic fitting" and see if there is a free app for this. There is https://www.desmos.com/calculator/qsdscncgi6

(There is general software that can fit any of the many rules of curve, and you can just punch in various curve types/orders and see which one provides the best fit. Quadratic assumes it's an order 2 polynomial, ie it has only powers of one variable and no terms bigger than a square)

It's worth noting that the question really depends on how many data points you have, and what sort of shape the curve takes. You could fit a quadratic curve to an exponential one if there's only four points.

Other terms for this are "interpolation", and yes, if you really wanted to, you could use a spline and reticulate them.

Aside: One option I haven't seen mentioned here is to simulate a difference engine.

You take your numbers x0, x1, x2, x3
You write down the differences, x1-x0, x2-x1, x3-x2
You write down the differences between them ...
Eventually the difference between values is constant or you run out of numbers
This allows you to fill in the gaps, but you can do something similar to reconstruct a polynomial, too.

https://www.dcode.fr/neville-interpolating-polynomial

Thanks! That makes sense. The original set has 105 values, which is enough to get a pretty good sense of the curve. I've added an image of a line graph to the original post.

oooh! that's an interesting curve

you could probably get away with fitting an exponential function, or even sigmoid function to it (just cutting off the later values and only looking at the first half of the curve)

i'd just draw it on the same graph in a f(x) = a*exp(b*x+c)+d way, and wobble a,b,c,d to get it to overlap, where c,d are moving it laterally, and a,b scaling it. then wobble those params again to get the function you want.

you could also break it up into three curves (slow ramp up, curve, fast ramp up), then move the two way points and reinterpolate the values.

that graph looks like a multi-part curve (most things in games are, curves that are simply expressible are not always the most fun)

looks like it's exponential-or-so until it hits 5k (it may be a different curve before it starts going vertical), then linear to 8.5k, then a slightly steeper linear to 10k

it's much easier to figure out with the raw numbers to plot in excel, where you can exactly figure out what the derivative, exponential increase, etc. is between each pair of adjacent values

I looked closer at the graph. I pretended I was a difference engine.

Here's the same values, but with the difference to the previous value annotated in a comment

[
  0x00C8,                                 // start

  0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, // + 1
  0x00CE, 0x00CF, 0x00D0, 0x00D1, 0x00D2, // + 1

  0x00D4, 0x00D6, 0x00D8, 0x00DA, 0x00DC, // + 2
  0x00DE, 0x00E0, 0x00E2, 0x00E4, 0x00E6, // + 2
  0x00E8, 0x00EA, 0x00EC, 0x00EE, 0x00F0, // + 2

  0x00F3, 0x00F6, 0x00F9, 0x00FC, 0x00FF, // + 3
  0x0102, 0x0105, 0x0108, 0x010B, 0x010E, // + 3

  0x0112, 0x0116, 0x011A, 0x011E, 0x0122, // + 4

  0x0127, 0x012C, 0x0131, 0x0136, 0x013B, // + 5
  0x0140, 0x0145, 0x014A, 0x014F, 0x0154, // + 5
  0x0159, 0x015E,                         // +5

  0x0168, 0x0172, 0x017C,                 // + 10

  0x0190, 0x01A4, 0x01B8, 0x01CC, 0x01E0, // + 20

  0x0208, 0x0230, 0x0258, 0x0280,         // + 40

  0x02D0, 0x0320,                         // + 80

  0x0384, 0x03E8, 0x044C,                 // + 100

  0x04E2, 0x0578, 0x060E, 0x06A4,         // + 150

  0x076C, 0x0834, 0x08FC, 0x09C4,         // + 200

  0x0AF0, 0x0C1C, 0x0D48, 0x0E74, 0x0FA0, // + 300
  0x10CC, 0x11F8,                         // + 300

  0x1388,                                 // + 400
  
  0x1482, 0x157C, 0x1676, 0x1770, 0x186A, // + 250
  0x1964, 0x1A5E, 0x1B58, 0x1C52, 0x1D4C, // + 250
  0x1E46, 0x1F40, 0x203A, 0x2134,         // + 250
  
  0x2260, 0x238C, 0x24B8, 0x25E4, 0x2710  // + 300
] 

It looks like it was not drawn as a curve to begin with, but 16 line segments in total. Each one is a simple straight line!