Author Topic: Physics investigations on Stunts  (Read 13996 times)

Overdrijf

  • Joe's Friend
  • **
  • Posts: 416
  • Professional idiot
    • View Profile
Re: Physics investigations on Stunts
« Reply #30 on: April 23, 2009, 08:21:03 PM »
Cool, you really found it!

So the halflength-value for a car should be about 2x the halflength in the car0 3D model, and therefor arround 40x as large as the halflength in car1.

Lol. I tried playing around with those 24 bites a bit, trying to keep the original symmetry and just making the values lower. The car started flying, completely out of itself. It crashed on the roof of the world, I didn't even know something like that existed. Now this was with my already screwed up car, but I haven't seen it do this before...
« Last Edit: April 23, 2009, 09:31:23 PM by Overdrijf »

Duplode

  • Considering trying out spam
  • *******
  • Posts: 3428
  • Through the astral door - to soar
    • View Profile
    • The Southern Cross Stunts Trophy
Re: Physics investigations on Stunts
« Reply #31 on: April 23, 2009, 10:00:13 PM »
So the halflength-value for a car should be about 2x the halflength in the car0 3D model, and therefor arround 40x as large as the halflength in car1.

Now that you mentioned it, I compared shapes for different cars with the half-lengths and half-widths, and the results are not very conclusive. If you look at the length/width proportions for Lancia, for instance, it appears the length is actually the front-wheel-to-wheel distance instead of the full length (and indeed - if you throw it against a slalom block it will only crash when the front wheels reach the block). For other cars, however, that does not hold - often the half-length is intermediate between the full length and the wheel-to-wheel distance. So the best practice is probably to set an intermediate value between the two and then fine tune according to your aesthetic preferences as well as handling effects. Anyway, if you assume Lancia's half-length is half of its wheel-to-wheel distance, the conversion factor would be exactly 64. Since this is a ridiculously convenient number, I guess it is exact... the conversion factor is actually 184/7 32, I messed up the divisions  :)

Lol. I tried playing around with those 24 bites a bit, trying to keep the original symmetry and just making the values lower. The car started flying, completely out of itself. It crashed on the roof of the world, I didn't even know something like that existed. Now this was with my already screwed up car, but I haven't seen it do this before...

1. Roof of the world!!  :o Please attach the test *.RES you were using so we can load the replay, it's a must see!  :o

2. Oops, I glossed over a proper explanation of what "symmetric" means in this context, I will add it to this post in a short while... no, better, I'll just reply again.
« Last Edit: April 26, 2009, 01:56:36 AM by Duplode »

Overdrijf

  • Joe's Friend
  • **
  • Posts: 416
  • Professional idiot
    • View Profile
Re: Physics investigations on Stunts
« Reply #32 on: April 23, 2009, 10:09:03 PM »
So the halflength-value for a car should be about 2x the halflength in the car0 3D model, and therefor arround 40x as large as the halflength in car1.

Now that you mentioned it, I compared shapes for different cars with the half-lengths and half-widths, and the results are not very conclusive. If you look at the length/width proportions for Lancia, for instance, it appears the length is actually the front-wheel-to-wheel distance instead of the full length (and indeed - if you throw it against a slalom block it will only crash when the front wheels reach the block). For other cars, however, that does not hold - often the half-length is intermediate between the full length and the wheel-to-wheel distance. So the best practice is probably to set an intermediate value between the two and then fine tune according to your aesthetic preferences as well as handling effects. Anyway, if you assume Lancia's half-length is half of its wheel-to-wheel distance, the conversion factor would be exactly 64. Since this is a ridiculously convenient number, I guess it is exact...

Lol. I tried playing around with those 24 bites a bit, trying to keep the original symmetry and just making the values lower. The car started flying, completely out of itself. It crashed on the roof of the world, I didn't even know something like that existed. Now this was with my already screwed up car, but I haven't seen it do this before...

1. Roof of the world!!  :o Please attach the test *.RES you were using so we can load the replay, it's a must see!  :o

2. Oops, I glossed over a proper explanation of what "symmetric" means in this context, I will add it to this post in a short while...

Here it is. And it's more symmetric, even in this context, then my only slightly corkscrewing car.
I might have met the fence, but that usually doesn't crash a car, so I think it was the roof...
« Last Edit: April 23, 2009, 10:10:49 PM by Overdrijf »

Duplode

  • Considering trying out spam
  • *******
  • Posts: 3428
  • Through the astral door - to soar
    • View Profile
    • The Southern Cross Stunts Trophy
Re: Physics investigations on Stunts
« Reply #33 on: April 23, 2009, 10:49:23 PM »
Here is the proper explanation about "symmetry". The first thing you should do is to make CarBlaster display byte values in hexadecimal (press Shift+H), it makes everything much more convenient. Now, if you go to the 24-byte section of (random example) Acura, you'll see the relevant values are arranged as pairs of bytes. The first of these, the x coordinate for the front/left corner, has values 40 and FC (in hex, which I'll indicate by appending them with 'h'). The pair, however, is supposed to be read as a single number; and to do so you invert the order of the bytes. Thus, 40 and FC become FC40h =  64576 after converting to decimal. This is the first subtlety. Of course, 64576 is a ridiculously high value - and then comes the second subtlety: very large values (above 8000h) are in fact negative numbers stored in a convenient way. To recover the original number, subtract the value you got from CarBlaster from 10000h and invert the sign. In our case, 10000h - FC40h = 3C0h --> -3C0h = -960, which is the value we expected to find. Now, if you jump six bytes forward, you'll see the values for the x coordinate of the second (front/right) corner are C0h and 03h, thus the coordinate value is +3C0h = +960 - symmetrical to the front/left coordinate, as it should. Applying the same principle everywhere, once you settle for values of half-length and half-width for a sane rectangular car, the pairs of bytes should be set like this...

Code: [Select]
1st (front/left) 2nd (front/right) 3rd (rear/right) 4th (front/right)
x-coordinate -halfwidth +halfwidth +halfwidth -halfwidth
z-coordinate +halflength +halflength -halflenght -halflength

...with the negative values being stored as (10000h - (your absolute value in hex)). If you are just messing around with values/doing quick tests, the easiest way to keep track of the changes is to, every time you add to a x-coordinate byte, add the same amount to all other corresponding x bytes (that is, the ones 6, 12 and/or 18 bytes before or after) with the same sign and subtract the same amount from the ones with opposite sign, and vice-versa for subtraction, and the same goes for the z coordinates.

---

And about your replay: zOMG  :o :o It seems your car did reach the outer space, and when it happened the world flipped over and you hit the ground - from below  :o And what's more, I had seen crazy stuff while testing the parameters but levitation from a standstill is a new one for me too - it's a must check...

Overdrijf

  • Joe's Friend
  • **
  • Posts: 416
  • Professional idiot
    • View Profile
Re: Physics investigations on Stunts
« Reply #34 on: April 23, 2009, 10:54:59 PM »
Well, it did already have a minimum speed. But why it went upwards...

Duplode

  • Considering trying out spam
  • *******
  • Posts: 3428
  • Through the astral door - to soar
    • View Profile
    • The Southern Cross Stunts Trophy
Re: Physics investigations on Stunts
« Reply #35 on: April 23, 2009, 11:18:32 PM »
For one of the most spectacular screenshots you'll ever see: get the CARSUKA.RES above into Stunts (for the non-Overdrijf folks reading this, just fit it with graphics from some other car), pick it, press Enter in the main menu to go racing and, immediately afterwards (while it's still showing "Please Wait")  start holding the up and left arrows. You won't regret spending two minutes with this...
« Last Edit: April 23, 2009, 11:20:25 PM by Duplode »

zaqrack

  • Administrator
  • Addicted to spam
  • *****
  • Posts: 4527
    • View Profile
    • ZakStunts
Re: Physics investigations on Stunts
« Reply #36 on: April 24, 2009, 08:37:40 AM »
wow  ;D ;D ;D a Stunts rocket. like the window braking graphics too :)

CTG

  • Spam, egg, spam, spam, bacon and spam
  • *
  • Posts: 20046
  • Psycho
    • View Profile
    • UnskilledStunts Championship
Re: Physics investigations on Stunts
« Reply #37 on: April 24, 2009, 09:48:19 AM »
wow  ;D ;D ;D a Stunts rocket. like the window braking graphics too :)

Weird things happen when people try to mess up the .RES files. I have a car for some years which accelerates only in the first 4 gears - if you switch up to fifth, it slows down and can't switch back (maybe invalid value for the position of 5th gear)... ;D

Overdrijf

  • Joe's Friend
  • **
  • Posts: 416
  • Professional idiot
    • View Profile
Re: Physics investigations on Stunts
« Reply #38 on: April 24, 2009, 09:52:14 AM »
Car modding: it's about fast cars and breaking things.

BonzaiJoe

  • Spam, egg, spam, spam, bacon and spam
  • *
  • Posts: 5081
    • View Profile
    • Purple
Re: Physics investigations on Stunts
« Reply #39 on: April 24, 2009, 10:34:07 AM »
FĂșcking incredible car. In 2009, 18,5 years after the game was released, the roof of the world has been found! Looking a bit like a wooden board and sometimes a bit like a fence.
Another funny thing: if you let the car "roll" out of the truck, it also begins to fly backwards, but then if you press a key, you teleport back to the start/finish line (you won't stay there for long though ;))
But we can't be quite sure.


Overdrijf

  • Joe's Friend
  • **
  • Posts: 416
  • Professional idiot
    • View Profile
Re: Physics investigations on Stunts
« Reply #40 on: April 24, 2009, 11:17:09 AM »
We're just really lucky that stunts does not keep track of what date it is, that roof is basically the same thing as the milennium bug, starting from zero because you've run out of numbers.

Duplode

  • Considering trying out spam
  • *******
  • Posts: 3428
  • Through the astral door - to soar
    • View Profile
    • The Southern Cross Stunts Trophy
Re: Physics investigations on Stunts
« Reply #41 on: April 26, 2009, 01:55:28 AM »
1. The replay suggests the "roof" is at 7fffh =  32767 stressed coordinates (the largest positive position value that can be stored in two bytes), which is 72,8 times the height of a bridge or approximately 2km  :)

2. Overdrijf, here is a possible explanation for what happened to your car: You set all z-coordinates of the car bounding box to the same, negative value. Thus, your car has zero length, and that's why the physics went nuts. The zero length makes it spin on its own so it gets pointing down - but since all corners are set to a negative z value, the car is off-centre and tends to go backwards as well (like before). But if the nose is pointing down, backwards becomes upwards, and so... :)

3. The conversion factor between stressed coordinates and the CAR*.RES internal coordinates appears to be 32 (I managed to write it wrong twice on my post early on this page...)

4. With some additional findings, now there are only 29 bytes in CarBlaster whose function is still unknown, and most of these seem to be effectless for most useful purposes. Expect to see a lot of corrections and additions at the Car Parameters page on the Wiki soon...  ;)
« Last Edit: April 26, 2009, 02:04:54 AM by Duplode »

Duplode

  • Considering trying out spam
  • *******
  • Posts: 3428
  • Through the astral door - to soar
    • View Profile
    • The Southern Cross Stunts Trophy
The Magic Formula (TM)
« Reply #42 on: April 28, 2009, 11:25:36 PM »
If you have access to CarBlaster I strongly suggest you to perform the following demonstration.

1. Open the Ferrari GTO (other cars which can reach 245mph would work just as fine).

2. Change the mass of the GTO to some other value, it can be anything you want.

3. Calculate the quotient 65536/<your chosen mass> and look at the part of the number after the decimal point. If it is:
  • between zero and 0.1666... : the car will have NSX-like powergear.
  • between 0.1666... and 0.5 : the car will have Corvette-like powergear.
  • between 0.5 and 0.8333... : the car will be a "normal" one.
  • between 0.8333... and 1 : the car will have Countach-like anti-powergear.
  • exactly zero (the quotient is integer) : the car will be "bug-free", in the sense it will have neither PG nor anti-PG *and* will be correctly slowed down by aero drag if you get faster than the flat-track top speed.

5. Load the modified car in Stunts and test your chosen value.

6. Rejoice.

7.  8) 8) 8) 8) 8)

BonzaiJoe

  • Spam, egg, spam, spam, bacon and spam
  • *
  • Posts: 5081
    • View Profile
    • Purple
Re: Physics investigations on Stunts
« Reply #43 on: April 28, 2009, 11:44:43 PM »
Wow!!  :o The secret of power gear! That's a landslide, congratulations Duplode  8)

Only one distinction missing: speed difference between ACURA power gear and Indy power gear.
But we can't be quite sure.


zaqrack

  • Administrator
  • Addicted to spam
  • *****
  • Posts: 4527
    • View Profile
    • ZakStunts
Re: Physics investigations on Stunts
« Reply #44 on: April 28, 2009, 11:48:36 PM »
I can not imagine you did not find this out in a dream. :)