2

I'm currently trying to reverse engineer a few equations used in a game, and have collected what seems to be all the relevant data.

In the example below, result speed is definitely based solely on the variables of thrust and weight. note that the game does use variables, but rounds the number

thrust | weight | speed
       |        |
   428 | 13575  | 188
   617 | 13575  | 209
   536 | 23850  | 152
   995 | 35750  | 175
   698 | 17475  | 202
  1373 |  8575  | 278

Is it possible for me to use this data to find the equation through any means except brute force? I've looked around but only found things which used a single variable.There also seems to be diminishing returns on thrust, apart from the increase in weight which comes with it.

Not sure how to tag this

I originally asked this here (https://math.stackexchange.com/questions/2727993/find-equation-based-on-multiple-sets-of-2-variables-and-results), and one of the responses suggested I bring the question here.

  • 1
    I was not entirely convinced your question fits on this site (and – hah – I might even have referred you to Mathematics), but on the other hand, as we already have coffee pads and license plates, this one should fit as well :) First thought: have you considered reverse-engineering the executable? If not, can you put up a download link so someone else might have a go at it? It could be easier than finding out the relationship between these numbers. – usr2564301 Apr 8 '18 at 19:47
  • mathematically speaking you can always fit a curve with another. The results get better when you have a large set of values. In your case, the best way would be to track down the function doing the arithmetic. – sudhackar Apr 9 '18 at 10:54
  • Can you tell us more about the physics of the game. Is it vertical motion (e.g. a rocket against gravity) or horizontal motion (e.g. a car against friction and air resistance)? – Ian Cook Apr 10 '18 at 8:04
  • Just understand that depending on how realistic the game is, there are other (hidden) parts of the calculation. For example, there is opposing aerodynamic drag in real life, which IIRC increases with the square of the velocity (e.g. 4x as much drag at 10 mph compared to 20 mph). Aero drag would be part of the speed calculation, counteracting the thrust force, but it's not linear (obviously). RE'ing the binary (as others have said) is the best. If not, try accounting for the aero drag, and you might get close. – Dan Apr 13 '18 at 1:37
2

While it may be possible to come up with some equation and find out the coefficients from the sample values, they may also be connected in some non-obvious way, so the best solution would be to track down the code which calculates the speed and see how exactly it uses thrust and weight.

1

The best approach would be to actually RE the binary but since we don't have I'll propose an alternative approach.

We could use sat solver like z3 to find out the solution for us.

Having script like this:

from collections import namedtuple
DataPoint = namedtuple('DataPoint', 'thrust weight speed')

data = [DataPoint(428, 13575, 188),
    DataPoint(617, 13575, 209),
    DataPoint(636, 23850, 152),
    DataPoint(995, 35750, 175),
    DataPoint(698, 17474, 202),
    DataPoint(1373, 8575, 278)]

from z3 import *

a = Int('a')
b = Int('b')

s = Solver()
for e in data:
  s.add(a*e.thrust+b*e.weight==e.speed)

print(s.check())

unfortunately for us, when running the above we get:

➜ 17928 python sol.py
unsat

There's is no solution the equation that is linear - but you have an model you can work on if you might have an idea what type of equation it should be. The first problem with those data is that we do not know the unit. Speed equal to 188, but what? Is it km/h or knots? Or something else a bit more imaginary for the purpose of the game?

It the game touches a bit of the reality we might want to refer to the physics. There's a thrust-to-weight ratio in aviation that might help you to deduce something from it (maybe there's some correlation between thrust, weight and speed) but to know that maybe we need to ask on Aviation?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.