News:

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

Main Menu

4D Sports Driving Amiga formats + converting Stunts DOS cars to Amiga

Started by earok, March 13, 2023, 01:39:22 AM

Previous topic - Next topic

earok

Thought this may be of some interest here - I did some experiments converting some of the DOS custom cars to Amiga, details are at English Amiga Board.

I don't know if I'll do any more on the project, I got stuck on the dashboard graphics (which seem to be crunched in a custom format, and presumably are VERY different to the DOS format anyway). But in brief, I discovered:

- The resource files are identical to the DOS format, excepting that the byte order of words and longwords is flipped for the Motorola M68K processor.

- 3D shapes are almost identical (word/longword flipping not withstanding) except that the "reserved" part of the structure can have a value, and vertices are four words instead of three.
 
Having said that - I think they are just junk values, and the additional word of data on vertices is probably just to keep data aligned at multiples of 8.

KyLiE

Even though the Amiga version of the game is considered inferior, any investigation into it is indeed very interesting.  Great work! :)

Overdrijf

Quote from: KyLiE on March 13, 2023, 06:34:23 AMEven though the Amiga version of the game is considered inferior, any investigation into it is indeed very interesting.  Great work! :)

"Hi, welcome, I see this is your first post here, your game is inferior."  ;)


Hi earok, (welcome, I see this is your first post here!) This is really cool. I don't know the first thing about the Amiga file formats, but your solution to the dashboard problem, substituting an original dashboard, is pretty clever, and will serve well at least until a conversion method is found, if ever.

Note that there are two problems with this:
1 The coordinates for the meter needles are in the car____.res file so in many cases your meters are now nonsense. Even when the dashboard was adapted from an original car and the meters are the same size and in the same place the speed and rpm scales may still have been altered. This can be fixed if tou have a way to edit the .res files. Does Carblaster or Carworks work on Amiga files?
2 The same story goes for the gear shifting coordinates. But if you change those to match the new dashboard you're also very subtly altering the behavior of the car, the time it takes to shift.

I wish you a lot of luck with the endeavor. Sounds like fun!

Daniel3D

Hey earok, and welcome here.

Thank you for your research, you have answered a question posted recently.
See This topic on the question if custom cars can be ported to the Amiga version.

Edit (after reading the Amiga forum post and realising that you were way ahead if where I thought you'd be)
If we know how they dashboars are different I think we could automate it and make a full converter.
Edison once said,
"I have not failed 10,000 times,
I've successfully found 10,000 ways that will not work."
---------
Currently running over 20 separate instances of Stunts
---------
Check out the STUNTS resources on my Mega (globe icon)

KyLiE

Quote from: Overdrijf on March 13, 2023, 07:40:12 AM
Quote from: KyLiE on March 13, 2023, 06:34:23 AMEven though the Amiga version of the game is considered inferior, any investigation into it is indeed very interesting.  Great work! :)

"Hi, welcome, I see this is your first post here, your game is inferior."  ;)

That certainly isn't what I was insinuating.  I was actually referring to a few comments on his original thread on the English Amiga Board.  I'm sorry if that was the impression I gave. :(

Daniel3D

Ok. As far as I understand now you made a converter for the 3D shape. There is no conversion yet for dashboard.
What I don't see clearly is what you do with the res file.
The res file contains information that is used in the dashboard and the performance values.
 If you use a dashboard of another car you need a matching res file.. (same number of gears, same type of speedometer.)

So you made something amazing, but I don't think we are there yet. But I believe now that I can be done.
Edison once said,
"I have not failed 10,000 times,
I've successfully found 10,000 ways that will not work."
---------
Currently running over 20 separate instances of Stunts
---------
Check out the STUNTS resources on my Mega (globe icon)

Cas

Very good work!  I would like to take a look at the Amiga dashboard format to see if I can understand it and maybe help. Is it a compressed format?
Earth is my country. Science is my religion.

Duplode

Hello and welcome, @earok ! This is a very interesting project. In particular, it can be very useful for the mods planned by Striker :)

Quote from: Daniel3D on March 13, 2023, 11:26:21 AMWhat I don't see clearly is what you do with the res file.
The res file contains information that is used in the dashboard and the performance values.
 If you use a dashboard of another car you need a matching res file.. (same number of gears, same type of speedometer.)

earok's progam also converts the CAR*.RES files to the Amiga format. That being so, this can be dealt with by adjusting the speedometer coordinates and other such things to match the new dashboard, as it used to be done in the days before Stressed, in the DOS file, and then running the converter. (Just remember to keep the spacing between the positions of the gear knob the same, as that actually affects car behaviour by changing the time it takes to shift gears.)

earok

I'm so sorry I missed all of these messages! I thought I had notifications set on this thread.

I did notice the needles etc didn't line up between the custom dashboard and the Amiga original, but I hadn't even thought of the idea of fixing the dashboard by copying the original Amiga dashboard settings into the RES file. I probably should add that to the utility if we can't solve the dashboard conversion issue.

I'll try to take another look at dashboards in the next few days. From memory, they were compressed in a way that I couldn't immediately recognise, it didn't have a header etc. But I'm assuming that the Amiga version will accept uncompressed dashboards so long as they're in the right format.

What I *might* be able to do is run the game, find the uncompressed dashboard in memory, and then dump that to give some clues as to what format is expected.

Cas

Quote from: earokWhat I *might* be able to do is run the game, find the uncompressed dashboard in memory, and then dump that to give some clues as to what format is expected.
I think this is a very good idea. If it got too complicated, taking a look at the compressed file may give a hint on what is expected if uncompressed. Especially, knowing the DOS uncompressed format to compare with.
Earth is my country. Science is my religion.

earok

Did a little bit further investigation:

In memory, once the dashboard files are unpacked, STDA (Acura) seems to contain these chunks.

dash
gbox
inm1
inm3
ins1
ins2
ins3
roof
whl1
whl2
whl3

(Notably there's no !CGA and !EGA chunks or anything similar, which makes sense - the Amiga version only supports a single graphics mode of 4 bitplanes / 16 colors)


STDB for the Acura is a little more curious:

!pal
dot
dot1
dot2
dota
gnab
gnob

All of those are present in the DOS version, except for the !PAL chunk.

This is where things start to get interesting. As I mentioned, the Amiga version is only running in 16 color mode, but when I took a screenshot it counted at least 22 colors.

What they appear to have done is implemented a unique 16 color palette for every dashboard, so even though it is running in 16 color mode it can display up to 32 colors at once, with a universal 16 color palette for the main game display and a custom set of 16 for every dashboard.

The Amiga "copper" co-processor allows you to change colors on the palette on a line, so the programming of the copper in 4D Sports Driving looks something like this:

- Set the colors to the top dashboard
- Wait for the scanline that starts rendering the main game display
- Set the colors to the main game palette
- Wait for the scanline that starts rendering the bottom dashboard
- Set the colors to the bottom dashboard


I think I'm not really going to have time to dig any deeper into it.

---

Another weird thing is - in the place in memory where the file size is supposed to be, instead we've got the ASCII characters "PPkc". When I did a search to find the significance, one of the first results was about Test Drive 2 on Amiga - https://eab.abime.net/showthread.php?p=1379496. I believe this suggests that the files are packed with "rpck" (like the 3D files are) but without the header that the 3D files have.

Daniel3D

QuoteAll of those are present in the DOS version, except for the !PAL chunk.
The dos version has that chunk as well. It's where the Custom pallet is stored.
That now I think about it might allow us to create dashboards with a different pallet than the base set..
Edison once said,
"I have not failed 10,000 times,
I've successfully found 10,000 ways that will not work."
---------
Currently running over 20 separate instances of Stunts
---------
Check out the STUNTS resources on my Mega (globe icon)

KyLiE

Quote from: earok on March 24, 2023, 10:42:50 PMAll of those are present in the DOS version, except for the !PAL chunk.

@Daniel3D, I think you'll find this is correct.  The DOS version includes both !cg0 and !eg0 resources in the dashboard files, but not a !pal resource.

Quote from: earok on March 24, 2023, 10:42:50 PMI think I'm not really going to have time to dig any deeper into it.

What you have uncovered so far is still impressive.  I've always been interested in how developers of that era overcame palette limitations.

Daniel3D

Quote from: KyLiE on March 30, 2023, 03:38:21 AM
Quote from: earok on March 24, 2023, 10:42:50 PMAll of those are present in the DOS version, except for the !PAL chunk.

@Daniel3D, I think you'll find this is correct.  The DOS version includes both !cg0 and !eg0 resources in the dashboard files, but not a !pal resource.
They are not in the car resources I since noticed, so you are right about that.
But I have seen the !Pal pallet with the base stunts colours in an other resource.
Edit:  the stunts Wiki knew what I couldn't clearly remember.
The VGA palette itself is encoded as the !pal bitmap resource of SDMAIN.PVS
Edison once said,
"I have not failed 10,000 times,
I've successfully found 10,000 ways that will not work."
---------
Currently running over 20 separate instances of Stunts
---------
Check out the STUNTS resources on my Mega (globe icon)

Daniel3D

So, I don't know how the compare to each other. But I suspect that there is a relationship to the order of the colour.

Also. If the !pal in stunts is the colour palette used. What happens if we change colours there?
Maybe something worth checking out..
Edison once said,
"I have not failed 10,000 times,
I've successfully found 10,000 ways that will not work."
---------
Currently running over 20 separate instances of Stunts
---------
Check out the STUNTS resources on my Mega (globe icon)