Author Topic: Replay Longer [VC]  (Read 1066 times)

0 Members and 1 Guest are viewing this topic.

Offline Dannye

  • Veteran Member
  • Posts: 3565
    • View Profile
Replay Longer [VC]
« on: December 18, 2022, 04:18:22 AM »
Replay Longer, By Dannye:
The purpose of this mod is to provide support for longer replay files, and thus allow for the reliable capture of stunts which may otherwise be unable to fit completely within one replay.rep file (eg. due to factors such as length, weather, pedestrians, traffic).

Supported Games:
  • Vice City [v1.0, for Windows] (and any map-mods based off this game-engine)
(sorry, no San Andreas support at this time)

Details:
  • This mod extends the maximum filesize for replay files, and thus the amount of gameplay they can potentially include. Normally a replay file will be no larger than 781kb, with this mod they can reach up to 8x that size (thus around 6mb).
  • This is an "ASI" mod, so if you want to use it just put the ASI file in your game directory and then it will automatically be applied whenever the game is run - you don't have to do anything.

Compatibility:
  • If a replay you create while using this mod has a filesize that doesn't exceed the the normal game max of 781kb, that replay file will also be compatible with copies of the game that are not using this mod (thus this mod is not required to playback those replay files). If you use this mod to create a replay file larger than that filesize however, playback will only be possible on games with this mod applied.
  • Some features of the latest official Freeplay release (v7 beta 2) have issues when being used on games that have this mod applied. Using any older Freeplay avoids the issue, as does simply not using the problematic features (Replay Loopback and Breakpoint Jumping) in the latest version - but more importantly a newer Freeplay version will be released soon that includes fixes to prevent these issues.

Usage Notes:
  • In many cases this mod is not necessary (and perhaps not desired at all), as the default max replay size of the game is generally sufficient, and so if you don't "cut" your replays before each stunt attempt this mod will potentially just be increasing the number of prior failed attemps that get included in the replay of a successful stunt, which is of no benefit. Thus you may prefer to only use this mod when beginning a stunt session where you intend to work on stunts that may require the extra length, or have it always applied but indeed make sure you do cut your replays while stunting (note that the USCM provides two approaches for automating this if you'd prefer to not have to manually do it via F3).
  • Since this is a memory-editing mod that needs to be active while stunting, you may wish to know more about what it is doing to the game before you are comfortable using it. To assist in this, the commented source code for the mod is included in the release package.

Downloads: (source code included)
  • [VC] Replay Longer v1.0 (Dec 2022): Download

Acknowledgements:
  • With thanks to Darkstar and Knapman

Happy (longer) stunting!

Offline AllBeast

  • pro stunter
  • Veteran Member
  • Posts: 1635
    • View Profile
Re: Replay Longer [VC]
« Reply #1 on: December 18, 2022, 04:35:47 AM »
cool, nice work, now i can make super long combos

edit:
just checked, it is works with no problem, at least for me

edit2:
i just wondering, why only 8x time longer, from where this limit  come?
« Last Edit: December 18, 2022, 07:48:39 AM by AllBeast »

Offline Lex

  • Senior Member
  • Posts: 1327
  • No longer active
    • View Profile
Re: Replay Longer [VC]
« Reply #2 on: December 18, 2022, 05:04:12 AM »
this is like every GTA IV players only dream!  it's sad that game wasn't really pat by stunters  :happy:

Offline DeathCobra

  • Veteran Member
  • Posts: 4994
    • View Profile
Re: Replay Longer [VC]
« Reply #3 on: December 18, 2022, 05:31:44 AM »
Is there any risk with corrupting reps using this?

Offline khaimyk

  • Posts: 176
  • alone
    • View Profile
Re: Replay Longer [VC]
« Reply #4 on: December 18, 2022, 05:47:12 AM »
All beast vs Jason :  :rolleyes: :cheernutz:

Offline VaNilla

  • next week m9
  • Veteran Member
  • Posts: 3806
    • View Profile
    • YouTube
Re: Replay Longer [VC]
« Reply #5 on: December 18, 2022, 10:07:54 PM »
Great job! I would love to see this in SA, I had a couple of stunts that required two replays in the past :euro:.

I have a feature request too, but I don't know if it's feasible. I usually save 5-10 replays whenever I land a VC/SA stunt, by saving one replay, alt tabbing to make a copy, and repeating the process until I have multiple replay backups - this helps sidestep the risk of corruption. Perhaps you could add a validation step to the replay write to ensure the data isn't corrupt, while also allowing the user to save multiple replay backups with a single press of F2? The steps would look like this; save replay, validate replay, wait something like 100ms (so every replay is slightly different to reduce the potential of corruption), repeat X number of times (X being customisable in an INI file). If possible, this would effectively nullify the risk of replay corruption in the future :jajaja:.
« Last Edit: December 18, 2022, 10:35:24 PM by VaNilla »

Offline Dannye

  • Veteran Member
  • Posts: 3565
    • View Profile
Re: Replay Longer [VC]
« Reply #6 on: December 19, 2022, 02:23:57 AM »
Is there any risk with corrupting reps using this?
Honestly I'd hesitate to say anything more definitive than 'hopefully not'. That's something nice about Freeplay - I can do as many crazy hacks as I want and I know since it is only meant to be used AFTER stunt/replay creation, the worst case scenario on something going wrong is a mild inconvenience. But indeed with the context of this mod being during-stunting, bugs are a big deal. I feel like I have a pretty good understanding of the parts of the game code that I am changing to hopefully know that I have made the correct changes (and I've spent a bunch of time testing it to try and find any issues and everything has seemed fine thus far), but there's that word again. I'd understand anyone not wanting to risk it, and that'd be another reason to consider an approach to using this mod where you only activate it when intending to work on a stunt that truly might need the extra space. That said, I have got the mod setup on each of my copies/mapmods of VC, so that way if there is a problem there's a good chance it's me that'll find it (or at least also get screwed by it).


i just wondering, why only 8x time longer, from where this limit  come?
It mostly comes from the desire to reduce the number of, and complexity of, the game hacks necessary to make the mod work (and thus reduce chance of error). [More detail: the x8 improvement comes from me changing a value that the game usually has set to 8 and instead making it 64. I pick 64 because it is a power of 2 and less than 127, and they are both important factors as otherwise I'd be needing to make many more changes to the game code/logic in addition to what is mainly just swapping numbers around, and that was not an enticing idea (also anything > 255 would require insane amounts of extra work)]


I usually save 5-10 replays whenever I land a VC/SA stunt, by saving one replay, alt tabbing to make a copy, and repeating the process until I have multiple replay backups - this helps sidestep the risk of corruption. Perhaps you could add a validation step to the replay write to ensure the data isn't corrupt, while also allowing the user to save multiple replay backups with a single press of F2?
Regarding corrupted replays in normal/unmodded versions of the games, that is not something I have much knowledge of - other than a vague recollection that there is a chance of it happening in SA (is it really an issue in VC too? or do you also do your multiple-rep approach there just out of habbit of needing it for SA?) - and I certainly don't know why it can happen (nor why multiple rep saves in a row can produce a working one if priors were bugged), so unfortunately I'm not sure if I'd be able to do something like what you've described, though I can understand the desire for it.

Offline VaNilla

  • next week m9
  • Veteran Member
  • Posts: 3806
    • View Profile
    • YouTube
Re: Replay Longer [VC]
« Reply #7 on: December 19, 2022, 01:03:12 PM »
Regarding corrupted replays in normal/unmodded versions of the games, that is not something I have much knowledge of - other than a vague recollection that there is a chance of it happening in SA (is it really an issue in VC too? or do you also do your multiple-rep approach there just out of habbit of needing it for SA?) - and I certainly don't know why it can happen (nor why multiple rep saves in a row can produce a working one if priors were bugged), so unfortunately I'm not sure if I'd be able to do something like what you've described, though I can understand the desire for it.

I think I've had it happen in VC too, but with extreme rarity. It happens rarely in SA too, but ever since I lost my original landing of the Memento finisher to corruption, I've been doing this just in case, and I think it's saved me a handful of times since. If I save 10 replays of my landing in SA, usually they're all working, but sometimes 1 replay out of 10 is corrupt, which just goes to show how much risk there is in SA. With the same strategy in VC, I've never seen corruption occur, so it is habitual, but nonetheless a worthy safety measure given how long it can take to land some stunts. The risk seems greater on HDD's too, where some Windows power profiles spin down HDD's after periods of inactivity - this isn't necessary with SSD's, so there's no risk of saving a replay while your HDD isn't spinning.

Offline Simon

  • Admin
  • Posts: 4900
  • aka Darkstar
    • View Profile
Re: Replay Longer [VC]
« Reply #8 on: December 20, 2022, 06:31:52 AM »
I usually save 5-10 replays whenever I land a VC/SA stunt, by saving one replay, alt tabbing to make a copy, and repeating the process until I have multiple replay backups - this helps sidestep the risk of corruption.
I'm a bit curious about this one, have you ever done this and had one of the replays been corrupted but not the others?
From the source code of the game (at least in VC, not super knowledgable about SA) the saving functionality is just writing data directly from a buffer in memory. Any corruption is likely to have happened in this buffer rather than during the writing itself (although not impossible I suppose), so saving multiple of what would ultimately be the same corrupted buffer likely wouldn't fix anything, at least in my head.

Offline MV

  • Veteran Member
  • Posts: 964
    • View Profile
Re: Replay Longer [VC]
« Reply #9 on: December 20, 2022, 09:48:18 AM »
To add to Simon's question..

If I save 10 replays of my landing in SA, usually they're all working, but sometimes 1 replay out of 10 is corrupt, which just goes to show how much risk there is in SA.
Is this corrupted one usually the first or last of the batch that you saved, or is it randomly in the middle?

Offline DeathCobra

  • Veteran Member
  • Posts: 4994
    • View Profile
Re: Replay Longer [VC]
« Reply #10 on: December 20, 2022, 01:33:09 PM »
I usually save 5-10 replays whenever I land a VC/SA stunt, by saving one replay, alt tabbing to make a copy, and repeating the process until I have multiple replay backups - this helps sidestep the risk of corruption.
I'm a bit curious about this one, have you ever done this and had one of the replays been corrupted but not the others?
From the source code of the game (at least in VC, not super knowledgable about SA) the saving functionality is just writing data directly from a buffer in memory. Any corruption is likely to have happened in this buffer rather than during the writing itself (although not impossible I suppose), so saving multiple of what would ultimately be the same corrupted buffer likely wouldn't fix anything, at least in my head.

I've had a couple of cases where corruption seemed to occur when F3ing quickly after F2. Or just fat fingering the keys. I figured it was probably something to do with the game attempting to access the file whilst it's still being written, but not too sure.

The problem for me with the saving multiple reps option is in VC I get crashes fairly regularly when alt-tabbing or maximizing the game again. Seems to be common no matter the executable I use. Having said that, it's no added risk I guess since unless you have the file state viewable on a second screen, you wouldn't know if the rep is corrupted or not until you tab out anyway. Which I've considered doing. But it's kinda a pain in the ass.

Maybe at some point we could have a tool that verifies rep integrity without erasing the replay buffer (i.e. via F3). Would let you resave via F2 if something went wrong.

Would also say my corruption fears stem mostly from my SA days where I lost a handful of reps to it. In VC it doesn't seem as frequent.
« Last Edit: December 20, 2022, 01:35:41 PM by DeathCobra »

Offline VaNilla

  • next week m9
  • Veteran Member
  • Posts: 3806
    • View Profile
    • YouTube
Re: Replay Longer [VC]
« Reply #11 on: December 20, 2022, 08:31:45 PM »
Simon and Nerve yup, for instance when I landed my SA Magnetron naval base stunt, all 10 replays saved correctly except 1, and I think it was the 3rd or 4th replay - this was while waiting four seconds after saving each replay to make sure they finished writing from memory to disk, so nothing like pressing F3 too quickly as DC mentioned. My PC did have issues with memory corruption (it was why I started swapping my RAM/SSDs prior to disappearing), but I've had the same thing happen on a perfectly functional PC (hence the Memento finisher first landing loss :cheersad:).

I have a feeling that corruption might not just be down to literal corrupt data, but rather that the game fails to open replays that start in certain locations or animation states - this would explain why a replay saved just four seconds later than a corrupt replay can work when the previous does not. I've literally never seen replay corruption happen in IV/V, it seems like both validate that replays have saved correctly before finishing (good thing since both reset the replay buffer after saving to disk if I remember correctly :ninja:).

What DC said about alt tabbing rings true for me as well. I can alt tab as much as I want in SA within reason, but VC crashes much more often when alt tabbing, meaning that while in SA I can consistently save 10 replays, in VC I occasionally get about 5-6 replays saved before the next alt tab crashes the game :D.

This is why I think having a burst fire of multiple replay saves would be useful, you dont want to spend 20+ hours landing a stunt just to lose it to corruption when you could simply save multiple replays spaced out by some delta and completely solve the problem :euro:.
« Last Edit: December 20, 2022, 09:01:29 PM by VaNilla »

Offline .Dakar

  • Senior Member
  • Posts: 268
  • gta vc creator
    • View Profile
Re: Replay Longer [VC]
« Reply #12 on: December 21, 2022, 10:46:05 AM »
I wonder if someday Dannye will be able to extend the death screen, for example for stunts using bigbang cheat.

Offline Reynard The Fox

  • Reynolds
  • Senior Member
  • Posts: 3290
    • View Profile
Re: Replay Longer [VC]
« Reply #13 on: December 31, 2022, 03:22:25 AM »
Great work Dannye! This should not be very hard to port to SA as the replay system is nearly identical as most methods seem to be the same. One would just have to identify the mentions of the buffer in these methods. I'm not sure if this is needed in SA at all as replays can be quite long already.

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal