Marvelous Carmageddon 1

Here's a short post about some C1 stuff.

Everybody playing C1 knows about the annoying effect in the windows being kinda messed up. I had a look at the reason why it happens like that. First thing is that it isn't linked to the car at all. You can define a material on your car that the game will later replace with a sky material or area material if you are in a SFX volume. Actually these materials that the game is substituing are the "problem". Most of these materials are using the env map (loc) effect, like we use in C2 for chrome etc. and these materials are also rolling by default (controlled by the car's movement). As the env map in C1 is kinda ugly (pixelated) and not working the same way as in C2, Stainless decided to multiply both horizontal and vertical repeatition by 5! This was an unknown feature of the MAT files. And apparently it doesn't go well with the env map effect. Getting rid of the repeatition also get rid of the problem but then the material in the windows are very pixelated, enabling dithering on said material doesn't help. No idea what to do to solve this so far. And fixing this would be a lot of work as C1 uses a lot of these materials all around and they don't all beheave the same way.

At least this made me discover the UV repeatition! Not really sure how useful this could actually be (besides increasing the env map material) but I understood how it works. Hexediting a MAT file you can notice for each material entry a pair of 3F80h. The C1 materials using UV repeatition had 40A0h instead. So to put it simply, 3F80h = 1 and 40A0h = 5. However the scale value isn't a constant. It's decreasing at every power of two. Let me explain: 1 is 3BF0h, to get the texture to repeat to times you must add 80h and thus write 4000h, to go from 2 to 3 however as we passed by 2 power 1 we mustn't add 80h but 40h and write 4040h, it's the same to go to 4 (and write 4080h). Again as we leave 4 which is 2 power 2 the difference must be divided by two again and we must add 20h instead. From 8, the difference will be 10h. And at 16, 8h. To put it simply, here's a table:

I talked about dithering in C1 materials. I don't think it was ever used in both C1 and C2 (must not have much incidence in C2 but for its software mode) but it actually works (I know that for a long time, just forgot to talk about it). Dithering might seldom be suitable for C1 texturing as it diffuses pixels to loosen the texels and (imo) it doesn't fit in C1 which is more about pixelart. Also dithering soften details in textures. However there are some cases where it is useful. Textures where random noises is welcome or which are supposed to offer a lot of matter detail at different distances. For example I used it on the log of recently released Mighty Fist. You can see in the shot here how it diffuses pixels from a texel to another:

Speaking of diffusing pixels I'm now sure you can't do that with transparent pixels for the cockpit images. It either makes the game crash or then messes up the cockpit image itself. You might want to diffuse transparent pixels if for example you wanted blurry edges or subtle shading on the borders of the transparent areas. Well forget it, the game doesn't like that. I guess it keeps track of the amount of transparent areas in the cockpit image and if it encounters too much of them or a 1x1pixel one it goes pop-fizzle.

Another thing that apparently might crash C1 when working on an addon car is the amount of shrapnel colors. Keep it low. 3 maximum. The car here above with log had 4 shrapnel colors and it made the game crash every time shrapnels had to be generated. It's either 3 maximum or they are SimpMat colors that make the game crash.

And finaly a word about the C1 palette. All of sudden it came to my mind that if the C1 palette was that customized in comparison to the standard 256 palette then it should be possible to modify it given the fact it wasn't integrated into the executable itself,(and thus relying on both palettes located in REG\PALETTES. Well it does use these palettes and you can modify these easily. The PAL file format is the same as the Microsoft PAL but for the header. Also it isn't needed to modify DRRENDER.PAL directly as the game will load anything in the PALETTES folder and give priority to the last one loaded. So just create a new palette keeping the same name as DRRENDER.PAL in the header but write the filename so that it is loaded after DRRENDER.PAL it will then overwrite it.I proceeded to mod said palette and created a SinCity look alike one.