Discussion about math, puzzles, games and fun. Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ π -¹ ² ³ °

You are not logged in.

- Topics: Active | Unanswered

Pages: **1**

**sam.f****Member**- Registered: 2006-03-19
- Posts: 5

Hi,

I have a problem I am keen to get some advice on.

Basically I'm tweaking the handling parameters for some cars in a computer game (Grand Theft Auto: San Andreas) in an attempt to make them as true to real life as possible. (See, maths IS fun!!)

I've got some 'real world' data based on my manual tests of different settings and their affect on the vehicles in the game, and I'm trying to derive a formula to help me calculate the expected results rather than manually testing every possible setting (of which there are thousands)

The sample data I have collected is listed below. Note that 'EA' is the game parameter that I am working with at the moment. It stands for Engine Acceleration and the higher the setting, the higher the car's acceleration rate is. I have done slightly more tests to 200km/hr than to 400, because it's hard to find enough straight road in the game world to get to 400 with an EA less than 30. I might be able to do it if anyone needs the figures, but it's a hard ask

EA Seconds to 200km/hr

10 12.5

20 6.25

30 4.25

40 3.50

50 2.75

60 2.50

70 2.25

80 2.00

90 2.00

100 2.00

EA Seconds to 400km/hr

30 14.00

40 10.75

50 8.50

60 7.50

70 6.50

80 6.00

90 5.50

100 5.25

Unfortunately, the only method of timing that I have at my disposal is a manual stopwatch, which isn't very accurate, but I've generally done a number of runs and compensated for my reaction times etc. In any case, the times I list below need to be viewed with a certain amount of flexibility and I would say that you could adjust them by at least 0.25 seconds either way if you see that they would fit a pattern / formula by doing so.

I have spent a number of days using Excel to work with these numbers and while I have been sucessful in determining a pattern and deriving formulas for other game parameters, I have been unable to do so with EA. The best I've been able to do so far is to graph the numbers, the result being that and they show up as a relatively smooth, non-linear curve. This confirms in my mind that there must be some pattern or formula somewhere in the bowels of the game engine, however working with the numbers, I can't determine what this could be. I have tried variations on simple ratios, differences and combinations of, but when it comes down to it, I don't really have any idea on how to approach this problem

I can use the graph to (approximately) predict an outcome, for example, looking at the results on the 400km/hr graph and using them to estimate what the time would be for an EA of 55 showed up as 8 seconds on the graph, and was confirmed as being accurate after in game testing.

If anyone can give me some idea of how best to approach this problem I would be MOST appreciative! And of course if you just happen to be a GTA:SA player, then you are more than welcome to a copy of my realistic car setups once they are completed

And in case you're wondering, yes, I MUST be a nerd as I seem to spend more time working on a spreadsheet with game data than I do actually playing the game (at least for the moment anyway)

Teach me oh wizened ones!

Thanks in advance,

Sam.

Offline

**George,Y****Member**- Registered: 2006-03-12
- Posts: 1,306

v= k log(1+t) <v velocity t time elapsed> , ideally.

**X'(y-Xβ)=0**

Offline

**George,Y****Member**- Registered: 2006-03-12
- Posts: 1,306

EA Seconds to 200km/hr

10 12.5

v=200 t=10

**X'(y-Xβ)=0**

Offline

**MathsIsFun****Administrator**- Registered: 2005-01-21
- Posts: 7,535

I managed to get a good fit with the 200km/hr figure using (160/EA)[sup]0.9[/sup] but it doesn't work well for 400 km/hr.

I think we may need a formula that includes air friction and possibly some limiting factor to do with engines (ie the engine does not have unlimited RPM), so as the speed increases the acceleratioin decreases.

Anyone?

"The physicists defer only to mathematicians, and the mathematicians defer only to God ..." - Leon M. Lederman

Offline

**mathsyperson****Moderator**- Registered: 2005-06-22
- Posts: 4,900

Well, from my mechanics course, I know that power = force x velocity.

So that means that if an engine has a constant power then it has less driving force as its speed increases.

If we factor in the resistive forces or air resistance, friction, etc., then there will eventually be a point where even at full power, the resultant force only manages to break even and so that would be the car's maximum speed.

So, to put that into one equation, it would be something like a = (P/v - RF)/m.

a = acceleration, P = power of engine, v = velocity of car, RF = resistive force, m = mass of car.

I'm not sure how helpful that is or how you can exchange one of these variables for EA though.

Why did the vector cross the road?

It wanted to be normal.

Offline

**sam.f****Member**- Registered: 2006-03-19
- Posts: 5

George,Y wrote:

v= k log(1+t) <v velocity t time elapsed> , ideally.

Thanks for your reply.

Could you please explain this formula a little more? Is 'k' the Engine Acceleration (EA)? Also how can I calculate the log value? (sorry, I'm not used to these kinds of maths functions)

Another thing, I want to be able to calculate the time it takes to get to a given speed based on the EA. Will your formula allow me to do this? If so, how can I re-arrange it so that it does?

Thanks,

Sam.

Offline

**sam.f****Member**- Registered: 2006-03-19
- Posts: 5

MathsIsFun wrote:

I managed to get a good fit with the 200km/hr figure using (160/EA)[sup]0.9[/sup] but it doesn't work well for 400 km/hr.

I think we may need a formula that includes air friction and possibly some limiting factor to do with engines (ie the engine does not have unlimited RPM), so as the speed increases the acceleratioin decreases.

Anyone?

Well, I will tell you a little more about the game engine and the other parameters that I can adjust.

Basically there are 4 parameters which you can adjust in the game engine per car:

Weight

Engine Acceleration (Which is apparently in meters/sec^2 btw)

Inertia

Drag

Each of these can be adjusted independently and the game engine allows you to have 0 Drag and 0 Inertia (I have used 0 settings for Drag and Inertia to get cleaner results for EA). Weight has no bearing on acceleration.

So we don't really have a real-world situation here. It's a virtual world with it's own physics rules

I was expecting EA to be completely linear as you can use Drag and Inertia to modify the acceleration curve, however it obviously isn't, hence my issue

I realised last night that I probably need to do more tests using the same EA and record times to different speeds, not just 2 (200 & 400) like doing 25/50km/hr steps, as looking at the graphs I have now, it seems that there is also a curve when using the same EA to accelerate to different speeds.

So, I'm not sure if that helps the situation or not, but hey

Offline

**sam.f****Member**- Registered: 2006-03-19
- Posts: 5

mathsyperson wrote:

Well, from my mechanics course, I know that power = force x velocity.

So that means that if an engine has a constant power then it has less driving force as its speed increases.

If we factor in the resistive forces or air resistance, friction, etc., then there will eventually be a point where even at full power, the resultant force only manages to break even and so that would be the car's maximum speed.

<snip>

See my other notes above. With no 0 values for Inertia & Drag there doesn't seem to be any top speed. I got a car to 1000km/hr last night before I ran out of road (& that was a short bit!) It was so funny because I then hit something and launched the car half way across the map (and if you know San Andreas, the map is LARGE!).

Offline

**George,Y****Member**- Registered: 2006-03-12
- Posts: 1,306

mathsyperson wrote:

Well, from my mechanics course, I know that power = force x velocity.

So that means that if an engine has a constant power then it has less driving force as its speed increases.

If we factor in the resistive forces or air resistance, friction, etc., then there will eventually be a point where even at full power, the resultant force only manages to break even and so that would be the car's maximum speed.

So, to put that into one equation, it would be something like a = (P/v - RF)/m.

a = acceleration, P = power of engine, v = velocity of car, RF = resistive force, m = mass of car.

I'm not sure how helpful that is or how you can exchange one of these variables for EA though.

well i should honestly say that my formula was derived by the same theory, and inadequate

No air resistance, RFcomes only from in between four wheels and road.

adding air resistance would make RF more complicated. air resistance would be proportional to the speed when low, to square of it when high.

i haven't got that kind of facts, if you like, you can check out papers, published experiment results, etc

ignoring direction, consider velocity as speed (presented as v).

Net a= dv/dt=v' Newton's Law,

Net a= P/(vm) - RF/m -mathsyperson's equation

define P/m=k k is a constant to v

in a friction process, friction force RF= u (Pressing Force) = u m g, where u is determined by the friction surface, m is the car mass, g is acceleration due to gravity

thus RF/m = u g , regardless of mass or speed. define u g= p

v'=dv/dt=k/v-p (former formula doesn't conclude -p here cuz i was not thinking clearly then )

v'-k/v=-p

for simple linear air resistance

v'= k/v -p - av ( backward acceleration due to air)

Who can solve that?

to make more real, net acceleration is fixed at first for some time when v is too low.

Perhaps we can use a software to solve it, i think you are good at it, sam

*Last edited by George,Y (2006-03-21 02:36:28)*

**X'(y-Xβ)=0**

Offline

**sam.f****Member**- Registered: 2006-03-19
- Posts: 5

George, Y wrote:

<snip>

for simple linear air resistance

v'= k/v -p - av ( backward acceleration due to air)

Who can solve that?

<snip>

Perhaps we can use a software to solve it, i think you are good at it, sam

Um, well I might be good at Excel, but I'm not quite sure how to apply this formula to the data that I have... any suggestions?

[Edited so I'm not credited. ]

Offline

**George,Y****Member**- Registered: 2006-03-12
- Posts: 1,306

A Computer Algebra System (CAS) software will do.

Mathsisfun's function is very good for a lot of cases. why don't you try that one (160/EA)0.9 ?

**X'(y-Xβ)=0**

Offline

**George,Y****Member**- Registered: 2006-03-12
- Posts: 1,306

i used a CAS, but the solution is tedious... and too long to put it here.

Extremely recommand Mathsisfun's empirical formula.

Another reason i recommand it is that there hardly is a global solution due to the failure to express air resistance subject to different speeds.

**X'(y-Xβ)=0**

Offline

Pages: **1**