News:

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

Main Menu

A twist for replay handling

Started by alanrotoi, October 27, 2021, 11:55:50 PM

Previous topic - Next topic

alanrotoi

Just wondering if it is possible for example to race in my own .rpl of z243 just to race against me. The car in the replay would be untouchable or can have an opponents identity. Just to race against a strong time instead of Skid. All in the same replay, a playable replay. I don't know who to call it. A race against yourself :D

dreadnaut

Like a "ghost car"? That would be very cool, but I expect quite difficult to add to the game.

Alternatively, you could open two dosbox windows side by side, drive in one and run the replay in the other ;D

Cas

Actually, I hadn't thought of Dreadnaut's very simple, yet effective solution! :D

But to add an answer to Alan's insight in the technical spectrum, I'd say that it would definitely require significant changes to the code and knowledge of what does what because Stunts was not designed with that option. We can consider a few points that would tell us more exactly why it would be so complicated and might also help us find a trick to prevent this:

Stunts has one memory region destined to replay information. This region is being read while you play a replay and is being written to while you race. My guess is that Stunts does not zero the whole region before you start driving, but just updates a word somewhere that tells how many ticks have been recorded. This means that we could, in theory, be reading the event just after the one we're recording, before it gets overwritten.

Problem with this is there is another region where opponent car coordinates and orientation are stored while reproducing a replay and I guess this region is the same as the one used by the AI to store the next calculated car position as you race. We would have to disable the AI writing to this region and activate the replay reading routine, but one tick ahead, so that the information is stored. Sounds complicated.

Additionally, this would not be enough as to prevent you from crashing against the ghost car. There is a way to create a ghost car, which is to change some car parameters to make the 3D boundaries null. I don't know if this has an effect on Stunts detecting that the car in question has crashed, though. Anyway, it's one more thing to change.

Another possibility would be to not use the opponent car coordinates and instead, use a 3D shape, but I don't know if these can be internally rotated at angles that are not multiple of 90 degrees. I know they can be rendered passable because you can render the player and opponent cars as passable by placing bytes 2 and 3 on the grid. Because the player and opponent cars are nothing but these same shapes being moved and rotated to a specific position, I wonder if this can be done.

This is one of the many things that is probably easier to achieve by writing a new engine from scratch.
Earth is my country. Science is my religion.

Daniel3D

Or create a ghost car without collision box.
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

That's what I mean. Cars have collision information of two forms: an outer sphere, that can be calculated more quickly and an inner box that's always centred and takes slightly longer to calculate. The outer box that's defined out of the first 8 vertices of every 3D object is actually the interaction bounding box and is there to tell the engine when the car has entered a scenery or track object's region of interaction, which activates collision checks between them, but as far as I know, this is not used for car-car collisions at all.
Earth is my country. Science is my religion.

alanrotoi

You can "cheat" the car collision changing the car size. If you make the extra car as small as possible (in collision parameters but not in graphics) it might be a simplier solution.

Daniel3D

Quote from: alanrotoi on November 11, 2021, 05:44:34 AM
You can "cheat" the car collision changing the car size. If you make the extra car as small as possible (in collision parameters but not in graphics) it might be a simplier solution.
Doesn't that influence jup distance and handling?
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)