News:

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

Main Menu

Crash explosion sprite issue

Started by Daniel3D, March 28, 2022, 04:11:28 PM

Previous topic - Next topic

Daniel3D

Quote from: KyLiE on March 23, 2022, 07:05:12 PM
This is a great car! :) You've done an excellent job on the visuals and performance parameters.  However, I noticed an issue with the crash sprite.  The further the car is from the camera, the more incorrectly the crash sprite appears.  It's not a huge issue, but I thought I would mention it in case anyone knows what causes it.
I've thought i found the cause if this. but it seems a bit more complex.
I run zakstunts with game exe. (the execompiled version of stunts that is used for the reverse engineering) so no modifications in the code.
In this version i have normal explosions with the original cars but the Ferrari Indy by Ryoma, the supercart by overdrive and this car (those if picked for testing) all have this explosion bug.

EDIT: Just checked the original uncracked game, and it is exactly the same there. It seems to be something shared with all custom cars.
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)

Duplode

#1
That issue with the explosion graphics does happen with a lot of custom cars (I remember first noticing it with the McLaren MP4/4), though not all of them (the Skyline is a counterexample). I have no idea about why it happens, either...

(This is a very nice car, by the way! I know it's a different chassis-engine combo, but anyway the colour schemes bring me back to Indianopolis 500: The Simulation  :))

Cas

About the crash sprite bug, I'm only guessing, but could it be that something such as the car-car collision radius, the distance between the wheels or perhaps between the first eight vertices (bounding box) have to be an exact multiple of some number?  This would explain why moving the car away from the camera increases the error, because the division gets more and more imprecise.
Earth is my country. Science is my religion.

alanrotoi

Quote from: Cas on March 29, 2022, 04:14:48 AM
could it be that something such as the car-car collision radius, the distance between the wheels

I guess they are the same as Porsche March so I would discard them.

Quote from: Cas on March 29, 2022, 04:14:48 AM
perhaps between the first eight vertices (bounding box) have to be an exact multiple of some number? 

I don't understand why the first eight vertices? :D You mean the first 4 pairs of bytes?


What I did and I'm sure Zapped also did with McLaren Honda is to use as base to model car1 was to use car0 from Porsche March.

Daniel3D

#4
Quote from: alanrotoi on March 29, 2022, 04:51:45 AM
What I did and I'm sure Zapped also did with McLaren Honda is to use as base to model car1 was to use car0 from Porsche March.
Maybe there is a connection in using car0 as car1.
Can't imagine what or how though.

Maybe models imported into stressed as object VS models made from scratch?
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

#5
Quote from: Daniel3D on March 29, 2022, 07:01:02 AM
Quote from: alanrotoi on March 29, 2022, 04:51:45 AM
What I did and I'm sure Zapped also did with McLaren Honda is to use as base to model car1 was to use car0 from Porsche March.
Maybe there is a connection in using car0 as car1.
Can't imagine what or how though.

Maybe models imported into stressed as object VS models made from scratch?
I replicated the bug with the porsche INDY.

If you save an original P3S as an 3SH in stressed you can edit the file in Carworks.
If you then copy Car0 to Car1 in Carworks and safe, you have the bug.
There is something in Car0 different from Car1 in the original cars.
So any car with an scaled edit of a Car0 used as model for Car1 will have the bug I think.
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)

alanrotoi

Wow well done! We are getting closer. So does it works with all cars or only Porsche March? The only explanation would be there is a polygon forgotten in a high distance from the car, then the game thinks the car has a bigger size?

Daniel3D

The strange thing is that I did not edit the model.
Just copy and paste.
Carworks does automatic resizing, but I it would be the same as manual resizing.
If it export car0 in stressed and directly try to load it as car1, stressed crashes. (Might be a scale error)
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)

alanrotoi

Could the problem be the polygon number 13? It is useless but it's there.

alanrotoi

No it isn't :D I checked in Lola and isn't there so... I don't know.
Thinking from this idea about car0 and car1... if you look ingame when racing starts you'll see Mclaren and Lola a bit forward at the start comparing with the Indy. I thought it's because this car0 to car1 copy.

Daniel3D

Quote from: alanrotoi on March 29, 2022, 03:58:35 PM
No it isn't :D I checked in Lola and isn't there so... I don't know.
Thinking from this idea about car0 and car1... if you look ingame when racing starts you'll see Mclaren and Lola a bit forward at the start comparing with the Indy. I thought it's because this car0 to car1 copy.
Well, if you copy 0 to 1 you can see the model of the pmin move backwards a bit. So you are correct in that regard.
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

Well spotted, Daniel!  I still think it has to do with the scaling. My reasoning is this:

Say the guys at DSI knew that they would have scaling problems when rendering the shapes on track, then they made sure to use proper factors for the car1 model, but this was not necessary for car0, so they didn't fix those. Now, when you copy car0 on top of car1, you usually do get the bug because car0 simply wasn't made taking this bug into account, but car1 was. Our custom cars have all their shapes made without this scaling bug into account, so we always get the bug.

I think Stunts is trying to produce a crash sprite that looks correct for each car shape, so it attempts to scale it and even to shit it according to where the car centre is and how big it is in each of its dimensions (or maybe just one dimension, could be too). To do this, it's readying something from the model that could be used to have an idea of how big the car is. This could be the distance between the front wheels and the back wheels (and perhaps also the distance between the left wheels and the right wheels for the other dimension, if it does take two different dimensions into account) or it could be the size of the bounding box (first eight vertices in every shape).

Now, the collision radius and the collision box (which I hadn't mentioned) would've been suspects too, but now, Daniël's tests are convincing me that they are not the culprit because these values are stored in the CAR*.RES file and are only used for car1. It has to be something that's present in every shape. So, again, I'd say, look at these things:

- Distance between wheels (in each dimension)
- Size of the bounding box (first eight vertices)
- Maybe distance between the non-bounding vertices that are the farthest away from each other in each dimension, but I don't think so
Earth is my country. Science is my religion.

Daniel3D

Quote from: alanrotoi on March 29, 2022, 03:49:29 PM
Could the problem be the polygon number 13? It is useless but it's there.
It could be something like this. But it would be in car1..
And missing in the Lola (and most other custom cars)
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

#13
Quote from: Daniel3D on March 30, 2022, 08:52:55 AM
Quote from: alanrotoi on March 29, 2022, 03:49:29 PM
Could the problem be the polygon number 13? It is useless but it's there.
It could be something like this. But it would be in car1..
And missing in the Lola (and most other custom cars)
It's not a vertice or polygon. No relation can be found at least.
It's not in the collision box parameters. That is tested, and they have no influence on this bug.
I can't find anything in culling data,
It's not in the mystery bites.

I checked the source code, but that is very hard to read in this case.
I can identify the animation loop, and references to the scale, location and pitch.
But I can't figure out how..
It seems that this bug is at the moment unsolvable

There may be a clue in the source, but that requires somebody more at home in programming than me.

Part of the code below. 8)
https://bitbucket.org/dreadnaut/restunts/src/aa1e714a66f8f9bd0d78bb1c0c3ab6b69252721d/src/restunts/asmorig/seg012.asm#lines-13556
shape_op_explosion proc far
    var_14 = word ptr -20
    var_12 = word ptr -18
    var_10 = word ptr -16
    var_E = word ptr -14
    var_C = word ptr -12
    var_A = word ptr -10
    var_8 = word ptr -8
    var_6 = word ptr -6
    var_4 = word ptr -4
    var_2 = word ptr -2
     s = byte ptr 0
     r = byte ptr 2
    arg_0 = word ptr 6
    arg_shapeptr = dword ptr 8
    arg_6 = word ptr 12
    arg_8 = word ptr 14

    push    bp
    mov     bp, sp
    sub     sp, 16h
    push    ds
    push    si
    push    di
    mov     ds, word ptr [bp+arg_shapeptr+2]
    mov     si, word ptr [bp+arg_shapeptr]
    mov     cx, [bp+arg_6]
    mov     ax, [si+SHAPE2D.s2d_unk1]
    imul    [bp+arg_0]
    sub     cl, ah
    sbb     ch, dl
    mov     [bp+var_2], cx
    mov     cx, [bp+arg_8]
    mov     ax, [si+SHAPE2D.s2d_unk2]
    imul    [bp+arg_0]
    sub     cl, ah
    sbb     ch, dl
    mov     [bp+var_4], cx
    jmp     short loc_3484E
    ; align 2
    db 144
    push    bp
    mov     bp, sp
    sub     sp, 16h
    push    ds
    push    si
    push    di
    mov     ds, word ptr [bp+arg_shapeptr+2]
    mov     si, word ptr [bp+arg_shapeptr]
    mov     ax, [bp+arg_6]
    mov     [bp+var_2], ax
    mov     ax, [bp+arg_8]
    mov     [bp+var_4], ax
    jmp     short loc_3484E
    ; align 2
    db 144
loc_3482C:
    pop     di
    pop     si
    pop     ds
    mov     sp, bp
    pop     bp
    retf
    push    bp
    mov     bp, sp
    sub     sp, 16h
    push    ds
    push    si
    push    di
    mov     ds, word ptr [bp+arg_shapeptr+2]
    mov     si, word ptr [bp+arg_shapeptr]
    mov     ax, [si+SHAPE2D.s2d_pos_x]
    mov     [bp+var_2], ax
    mov     ax, [si+SHAPE2D.s2d_pos_y]
    mov     [bp+var_4], ax
loc_3484E:
    cmp     [bp+arg_0], 2
    jb      short loc_3482C
    cld
    mov     ax, [si+SHAPE2D.s2d_height]
    mul     [bp+arg_0]
    mov     al, ah
    mov     ah, dl
    or      ax, ax
    jz      short loc_3482C
    mov     [bp+var_8], ax
    mov     ax, [si+SHAPE2D.s2d_width]
    mov     [bp+var_A], ax
    mul     [bp+arg_0]
    mov     al, ah
    mov     ah, dl
    or      ax, ax
    jz      short loc_3482C
    mov     [bp+var_6], ax
    mov     dx, cs:sprite1.sprite_pitch
    sub     dx, ax
    mov     [bp+var_C], dx
    add     si, 10h
    mov     dx, 1
    xor     ax, ax
    mov     [bp+var_12], ax
    mov     [bp+var_14], ax
    div     [bp+arg_0]
    mov     [bp+var_10], ax
    mov     al, ah
    xor     ah, ah
    shr     ax, 1
    jz      short loc_348A8
    add     si, ax
    mov     cx, ax

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)

alanrotoi

If only happens to custom cars it is a problem of the edition. It doesn't happen to all the custom cars. At least itnhappens when you use car0 from (at least) Porsche March. Does it happens if you use only stressed or when you resize the model with carworks it appears? Wich cars has this bug?