Page 1 of 1

Paintjobs 11+ in MM2

Posted: Tue Apr 24, 2018 9:06 am
by aaro4130
So, we've always had the sailboat/tugboat/somekindofboat in our car issue with paintjobs over 10.

Today I dug into this issue, and dear god is the cause amusing.

When the game initializes your car, it starts initializing level geometry. The game goes through each item in the car (hardcoded list, basically), and adds body, shadow, tlight, etc. Finally, it adds the variantPAINTJOB items, which I recently posted a topic about.

Here's the catch. It only adds 10 of these.

This wouldn't be a big deal, but later on in the initialization, it adds a breakable to your car. It tries to use the banger "carname_variantPAINTJOB", but it also passes in a model ID. The model ID = paintjob + car items.

The memory layout of models is
[CAR STUFF][VARIANT STUFF (ONLY 10)][OTHER GEOMETRY]

So, to sum up
This bug is caused by an unused feature in the base game, because they don't check if your paintjob is less than 11, and then it overflows into other geometry. :lol:

I did some tests and was able to fix this by initializing 64 objects instead of 10.

Posted: Tue Apr 24, 2018 11:34 am
by Jeremiahjobling
Interesting find :o

(To be honest, if MM2 was released as an "unfinished" game, that feature you just discovered really wouldn't be surprising since MM2 has a number of unused features)

Posted: Tue Apr 24, 2018 6:19 pm
by cody
Being an unfinished game actually WOULD explain all the known problems with MM2:

1. The game crashing when running into props at high speed (MMClone doesn't have this problem);
2. Speed limited to roughly 1118.468146... mph (500 m/s, 1800 kph; could be caused by the speed being stored as a floating-point number, whose limit is set to 1800 kph; might be adjustable, but it might not be; probably fixed in MMClone);
3. Cops chasing you initially limited to 3 (already fixed);
4. Falling through the ground under the highway (near the Bay Bridge end; a problem with the INST object being over 2 PSDL blocks), and other places in SF, London, and other tracks;
5. Heap size initially set to 32 MB (this could just be due to the game being from the early 2000's, can be adjusted using Heap Patcher);
6. The high elasticity/unusual behavior of the cops (even though this can be changed in vpcop.vehcarsim and vpcop_cop.vehcarsim);
7. The way MM2 interprets corners in PSDL roads on hills (i.e. the corner on the 4-lane beside the Pacific Ocean, just north of Golden Gate Park).

And, of course, there's the paintjob issue you're discussing. I bet all of these problems could be fixed (at least partially) through some hex editing, mods/addons, or trainer usage. It may take us a while, but we'll eventually be able to complete it. It's a trial-and-error process, though, because we don't have the original source code to use as a reference.

Posted: Tue Apr 24, 2018 6:32 pm
by aaro4130
Being an unfinished game actually WOULD explain all the known problems with MM2:

1. The game crashing when running into props at high speed (MMClone doesn't have this problem);
2. Speed limited to roughly 1118.468146... mph (500 m/s, 1800 kph; could be caused by the speed being stored as a floating-point number, whose limit is set to 1800 kph; might be adjustable, but it might not be; probably fixed in MMClone);
3. Cops chasing you initially limited to 3 (already fixed);
4. Falling through the ground under the highway (near the Bay Bridge end; a problem with the INST object being over 2 PSDL blocks), and other places in SF, London, and other tracks;
5. Heap size initially set to 32 MB (this could just be due to the game being from the early 2000's, can be adjusted using Heap Patcher);
6. The high elasticity/unusual behavior of the cops (even though this can be changed in vpcop.vehcarsim and vpcop_cop.vehcarsim);
7. The way MM2 interprets corners in PSDL roads on hills (i.e. the corner on the 4-lane beside the Pacific Ocean, just north of Golden Gate Park).

And, of course, there's the paintjob issue you're discussing. I bet all of these problems could be fixed (at least partially) through some hex editing, mods/addons, or trainer usage. It may take us a while, but we'll eventually be able to complete it. It's a trial-and-error process, though, because we don't have the original source code to use as a reference.
1. dunno about this
2. this is caused by some weird math issues on the hud
3. this is done for optimization, all the cops have to pathfind in realtime
4. could also be due to invalid perimeter vertices in the PSDL
5. yup, from 2000s
6. vpcop_cop vehcarsim is never used, and actually _opp is never used either. They "launch" when in the air due to intentional behaviour. Idk why that was added in the first place though.
7. what do you mean by this one?
Interesting find :o

(To be honest, if MM2 was released as an "unfinished" game, that really wouldn't be surprising)
It was "finished" but very rushed

Posted: Tue Apr 24, 2018 8:15 pm
by Franch88
Very nice discover Aaro, and it's great that you've increased that limit a lot. :) It's probably a wanted limit, since the only default game vehicle with more paintjobs is the VW New Beetle Cup, with 7 of them.
A limit of 10 working paintjobs isn't so strict in most of the cases, but, what's more strict is the characters limit for their names in the .info file; now that's something needed to be increased, together with the characters of basenames in the vehtypes.csv file.

Cody, those are such non-problems, or wanted limits, made also because of the games technology back in late 1990s and year 2000... The game crashing into props at high speed is a non-problem, since the game isn't designed for insane speeds. Cops chasing is limited to 3 on purpose surely because the game had to lag with much more cops active, considering the power of computers in late 1990s and year 2000; and yes, the cops use the paths of the traffic to control themselves. Those parts under the ground aren't meant to be driven in the original game. Heap size is natively so limited for the same reason of the power of computers in late 1990s and year 2000, and with the low polygons models that the game has, it's more than enough.

Comparing MM2 with Aaro's MMClone is useless, because he's making it with the purpose of having a lot of MM2 limits removed and an overall better quality. The game engine is totally different, then.
MM2 is certainly a rushed game, and it has some unfinished unused feature like the replays one.

Posted: Tue Apr 24, 2018 8:52 pm
by sajmon14
7. what do you mean by this one?
I bet he meant this place ;) Car is getting stuck in air.

Image

Posted: Tue Apr 24, 2018 8:58 pm
by cody
Yep. That's the corner I'm talking about. It also happens on the U-shaped road on the south end of the rainbow area.

Posted: Tue Apr 24, 2018 9:19 pm
by aaro4130
Ah that. That's due to non co-planar road faces.