News:

Herr Otto Partz says you're all nothing but pipsqueaks!

Main Menu

Physics investigations on Stunts

Started by Duplode, December 09, 2008, 01:05:09 AM

Previous topic - Next topic

Overdrijf

#30
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...

Duplode

#31
Quote from: Overdrijf on April 23, 2009, 08:21: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... the conversion factor is actually 184/7 32, I messed up the divisions  :)

Quote from: Overdrijf on April 23, 2009, 08:21:03 PM
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.

Overdrijf

#32
Quote from: Duplode on April 23, 2009, 10:00:13 PM
Quote from: Overdrijf on April 23, 2009, 08:21: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...

Quote from: Overdrijf on April 23, 2009, 08:21:03 PM
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...

Duplode

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...


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

Well, it did already have a minimum speed. But why it went upwards...

Duplode

#35
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...

zaqrack

wow  ;D ;D ;D a Stunts rocket. like the window braking graphics too :)

CTG

Quote from: zaqrack on April 24, 2009, 08:37:40 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

Car modding: it's about fast cars and breaking things.

BonzaiJoe

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

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

#41
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...  ;)

Duplode

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

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

I can not imagine you did not find this out in a dream. :)