English Amiga Board

Go Back   English Amiga Board > Other Projects > project.CARE

Thread Tools
Old 03 March 2023, 01:09   #1
Registered User

Join Date: Dec 2013
Location: Auckland
Posts: 3,284
Custom cars for 4D Sports Driving (aka Stunts)

I've started investigating how to bring some of the numerous custom cars made for the DOS version of Stunts across to Amiga.

A car has a four character ID and there are four files that represent a car:

CAR####.RES - Contains a text description of the car as well as all of the performance/physics settings.

Getting these to work on Amiga basically just involves reversing the order of the longwords and words of data to cater for the M68K processor.

STDA####.PSH and STDB####.PSH. Visuals for the dashboard. The format on the DOS version is either VSH (raw) or PVS (compressed). I'm assuming PSH is an Amiga specific compression format. I haven't looked into these and I've assumed they're quite different between DOS and Amiga, given the difference between VGA and OCS.

ST####.p3s is the 3D shape file. This aligns with the format of the compressed DOS file (uncompressed is 3SH). Though compression varies between formats - so far as I can tell the DOS compression is custom, and the Amiga compression is RPck and can be decrunched with XFDDecrunch.

Where I got stuck is this: the actual 3D formats appear to be different between the Amiga and DOS versions.

According to https://wiki.stunts.hu/index.php/Res...rmat#3d_shapes the format is:

Main strcture

uint8     numVertices
uint8     numPrimitives
uint8     numPaintJobs
uint8     reserved // Always == 0

VERTEX    vertices[numVertices]
uint32    cullFront[numPrimitives]
uint32    cullBack[numPrimitives]
PRIMITIVE primitives[numPrimitives]

uint8     terminate[...] // 1-3 NULL-bytes for data alignment
Additional structures

struct VERTEX {
int16 x
int16 y
int16 z
struct PRIMITIVE {
  uint8 type
  uint8 flags
  uint8 materials[numPaintJobs]
  uint8 indices[...] // Size depends on type.
Comparing the Amiga and DOS version of the Corvett, the first four bytes are a little different:

DOS: E4 C3 07 00
Amiga: E4 BC 07 06

While the number of vertices and paint jobs appear to be the same, the number of primitives is slightly different, also the last byte is "06" whereas according to the DOS specification, this is meant to be zero.

What gets weirder is the vertex values that immediately follow it. It appears that the Amiga version has an extra word of data per vertex. If we have a look at the first two vertexes on the Corvett:

DOS (words flipped to match M68K data)
X    Y    Z         X    Y    Z
FE5C 003C 03FC ---- 01A4 003C 03FC ----

X    Y    Z         X    Y    Z
FE5C 003C FBF0 0101 01A4 003C FBF0 0100
As we can see, X/Y correlate exactly, but at a glance there's no correlation between the Z values. I can't work out what exactly Z means on Amiga - I'm assuming they used a different kind of data for Z in order to pad the size of a vertex from 6 bytes to 8 bytes, but I can't make any sense of it. Maybe they used a floating point format? In any case I'm not sure how to convert the DOS value of 03FC to match the Amiga value of FBF00101.

That's where I got stuck.


Even if we don't work out how to convert 3D models across, there might still be some value with modifying the files anyway:

- Zapper's car pack is the original car pack, with the physics/performance settings tuned to more closely match "real world" performance. I could look at bringing those resource files across.

- It should be relatively easy to edit the Amiga 3D files so the low detail models match the high detail model (basically making it so that the car in-game is always the same level of detail as the car in the car selection screen, this might be cool to see on a high end Amiga or emulator settings).
earok is offline  
Old 03 March 2023, 11:07   #2
Registered User

Join Date: Dec 2013
Location: Auckland
Posts: 3,284
I got it working!

It turns out that I was wrong about Z having a different format - what confused me was that (for whatever reason) the actual order of vertices is different between DOS and Amiga cars but otherwise they seem to be almost identical. The additional word of data after Z seems to be junk, presumably just there to keep Vectors aligned with multiples of 4.

Next step is to look at the dashboards - this may be "too hard" to take care of if the formats are just too different between Amiga and DOS (and they're not strictly needed since there's a variety of dashboards from the original Amiga cars that could be substituted), but it's worth a look.

Edit: I'll skip the dashboards, at a glance the Amiga dashboards appear to be crunched in a bespoke format, it's well beyond my ability to decipher.

Last edited by earok; 03 March 2023 at 11:15.
earok is offline  
Old 03 March 2023, 11:15   #3
Alien Breeder
Reynolds's Avatar
Join Date: Dec 2007
Location: Szigetszentmiklos / Hungary
Age: 45
Posts: 893
How can be custom car built for the game? What (designer) program is required?
Reynolds is offline  
Old 03 March 2023, 11:18   #4
Registered User

Join Date: Dec 2013
Location: Auckland
Posts: 3,284
Originally Posted by Reynolds View Post
How can be custom car built for the game? What (designer) program is required?
I don't really know anything about actually making cars, but there's a whole wiki dedicated to Stunts modifications. This page here might be a good starting point - https://wiki.stunts.hu/wiki/CarWorks
earok is offline  
Old 03 March 2023, 14:00   #5
cheeky scoundrel

gimbal's Avatar
Join Date: Nov 2004
Location: Spijkenisse/Netherlands
Age: 41
Posts: 6,131
Cool. But do you really want to play the Amiga version of this game?
gimbal is offline  
Old 03 March 2023, 16:06   #6
This cat is no more

jotd's Avatar
Join Date: Dec 2004
Location: FRANCE
Age: 51
Posts: 7,104
that's great work!
jotd is offline  
Old 04 March 2023, 01:34   #7
Registered User

Join Date: Dec 2013
Location: Auckland
Posts: 3,284
@gimbal The Amiga version of the game isn't too bad, admittedly it does feel a bit sluggish.

@jotd cheers!


I've posted a rough alpha version of the tool here. I'm not sure I'll do any more on it but the source is there, it's fairly trivial so it could probably be converted from Windows to Amiga or Mac or Linux easily enough.

Note that I've had some crashes running custom cars that have been converted (particularly when giving the car to an opponent - not so much when just driving the car myself). It's possible my conversion process is buggy, or the cars themselves are buggy, or they're just too heavy for Amiga 4D Sports Driving (presumably they're all designed to run on Stunts on at least a 486), or some combination.

Tutorial for installing a the Bus to 4D Sports Driving (Windows required to do the conversion, after that you should be able to run on WinUAE or copy to a real Amiga):
  • Make a backup of your 4D Sports Driving install.
  • Download the conversion tool into the 4D Sports Driving folder (under "data" if using WHDLoad)
  • Download the Ikarus 260 from Mark Ceccato's site into the same folder and unzip there.
  • Run the EXE, you should get the following prompt.

Make sure to have a backup of everything before starting!
Car ID i260 appears to be a DOS Stunts custom car. Do you want to convert to Amiga format? y/n
  • Press y. You should now get the following prompt to copy an existing dashboard.

We need an Amiga formatted dashboard to add to our custom car. Enter the dashboard to use
1: Acura NSX
2: Audi Quattro
3: Corvett ZR1
4: Ferrari GTO
5: Jaguar XJR9
6: Lamborghini Countach
7: Lamborghini LM-002
8: Lancia Delta
9: Porsche 962
10: Porsche Carrera 4
11: Porsche March Indy
  • We'll choose the Lamborghini LM-002 Dashboard.
  • You should get this message.

Converted i260 to Amiga format
Success! 1 cars converted
That's it! Close the window and enjoy your new car.

earok is offline  
Old 04 March 2023, 02:02   #8
cheeky scoundrel

gimbal's Avatar
Join Date: Nov 2004
Location: Spijkenisse/Netherlands
Age: 41
Posts: 6,131
Ha ha Under a bus the tires look even more like cardboard cutouts.
gimbal is offline  

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Crazy Cars 2 (C64),...IT'S CRAZY CARS 1 FFS! WTF?? ZEUSDAZ Retrogaming General Discussion 6 25 September 2022 18:13
Amiga CD Football AKA TV Sports Football 2 DamienD support.Games 13 20 September 2020 15:52
[Found: 4D Sports Driving] Game ID junky Looking for a game name ? 6 04 November 2009 12:59
my 4D Sports Driving tracks! Bamiga2002 Retrogaming General Discussion 10 14 September 2009 15:47
Homemade circuits for 4D Sports Driving frikilokooo request.Other 3 15 November 2008 20:47

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +2. The time now is 18:38.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Page generated in 0.07647 seconds with 15 queries