Author Topic: A twist for replay handling  (Read 164 times)

alanrotoi

  • Lives on Stunts
  • ******
  • Posts: 4334
  • Suck my Indy!
    • View Profile
    • Maite Zaitut, La Vengadora Oscura
A twist for replay handling
« on: October 27, 2021, 11:55:50 PM »
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

  • Corner Controller
  • ***
  • Posts: 1260
    • View Profile
    • chezDreadnaut
Re: A twist for replay handling
« Reply #1 on: October 28, 2021, 12:35:10 AM »
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

  • Straight Specialist
  • ***
  • Posts: 1177
  • Think different. That's OK... as long as you think
    • View Profile
    • Dimioca Labs
Re: A twist for replay handling
« Reply #2 on: October 30, 2021, 12:58:43 AM »
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

  • Friend of Oracle
  • ***
  • Posts: 989
    • View Profile
Re: A twist for replay handling
« Reply #3 on: October 30, 2021, 02:03:40 AM »
Or create a ghost car without collision box.
Ever tried, ever failed. Try again, fail better.

Currently running 19 separate instances of Stunts or 4D Sports Driving.
---------
Stunts resources.
https://mega.nz/folder/JM8HQI5a#mH5ZBNwXC0eEBmockWo50A

Cas

  • Straight Specialist
  • ***
  • Posts: 1177
  • Think different. That's OK... as long as you think
    • View Profile
    • Dimioca Labs
Re: A twist for replay handling
« Reply #4 on: October 31, 2021, 01:26:31 AM »
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

  • Lives on Stunts
  • ******
  • Posts: 4334
  • Suck my Indy!
    • View Profile
    • Maite Zaitut, La Vengadora Oscura
Re: A twist for replay handling
« Reply #5 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.

Daniel3D

  • Friend of Oracle
  • ***
  • Posts: 989
    • View Profile
Re: A twist for replay handling
« Reply #6 on: November 11, 2021, 06:15:05 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?
Ever tried, ever failed. Try again, fail better.

Currently running 19 separate instances of Stunts or 4D Sports Driving.
---------
Stunts resources.
https://mega.nz/folder/JM8HQI5a#mH5ZBNwXC0eEBmockWo50A