atmos's Avatar

atmos

@atmossig.bsky.social

32 Followers  |  41 Following  |  27 Posts  |  Joined: 31.10.2024  |  2.2515

Latest posts by atmossig.bsky.social on Bluesky

#programming #gtav #gta5

05.07.2025 05:14 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

P.S my bad if wording sucks or I got anything wrong lmao. I tried my best to explain it.

05.07.2025 05:13 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

Thanks for reading! More to come soon. Gonna tackle fixing some other bugs e.g., cloth freaking out at high fps and general choppiness at high fps, incl a bug with Franklin using his special ability too fast and it pauses dialog for too long.

05.07.2025 05:13 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

-and we got higher refresh rate monitors and we could run older titles at higher frame rates, it pushes beyond the 60FPS target, so it leads to the bug.

05.07.2025 05:13 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

It was set as 60 since the game would never go above it, it couldn't even reach it, they probably had internal PC versions that would play it on a 60hz monitor (refresh rate lock) so this issue would've never happened to them.

When newer monitors came out and as hardware improved-

05.07.2025 05:13 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

-which is the correct state. This remains true for any framerate.

== HOW IT MIGHT'VE SLIPPED THROUGH ==

Easy, fixed development hardware, this game was made originally for the PS3/XENON hardware (Xbox 360), which ran the game at around 30fps~, dipped lower but still, target fps was 30.

05.07.2025 05:13 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

-there is a 42.8& chance that the number will be less than the fraction, causing iAmmoToDeplete to become 1.

Over the course of 140 frames in one second, this will approx happen 42.8% of the time (140 * 0.428 β‰ˆ 60).

The total ammo depleted in that second will be ~60 units-

05.07.2025 05:13 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

The fix works by calculating the ideal depletion ratio as a float. For Example, at 140 FPS, the ratio is (1/140) / (1/60) which is approx 0.428

The integer part (0) is taken as the base amount to deplete.
The fractional part of (0.428) is used as the chance
A random number is generated-

05.07.2025 05:13 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0
Video thumbnail

Now testing again once we recompile it...

Yep, it's fixed! We can pour the gas can at 60FPS perfectly fine, and when we go-to 240FPS (way higher than 60FPS) we pour the same amount of fuel as before!

05.07.2025 05:13 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0
Post image

== CORRECTED CODE ==

To solve this, the logic had to be replaced entirely lmao, it has to handle fractional depletion values that occur at high frame rates. The final solution was to use a probably-based approach to ensure the avg. depletion rate is always consistent.

05.07.2025 05:13 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

So when at any FPS above 60, e.g., 140, it is behaved as if it was at 60FPS, it calculated iAmmoToDeplete as 1, but since it is doing this for every single one of those 140 frames per second, the can drains at a rate of 140 units/sec, more than twice as fast it should normally.

05.07.2025 05:13 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

At any FPS above 60, the fwTimer::GetTimeStep() becomes smaller than the 60FPS baseline. The MAX function then incorrectly discards the real (and smaller) delta time, and instead uses the larger fBaseTimeStepSeconds.

05.07.2025 05:13 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

HOWEVER! The line

const float fCurrentTimeStep = MAX( fwTimer::GetTimeStep(), fBaseTimeStepSeconds );

Introduces a bug.

At 60FPS or below, it works correctly, fwTimer::GetTimeStep() will be 1.0/60.0 or greater, so the MAX function chooses the correct delta time.

05.07.2025 05:13 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0
Post image

So for example, draining the can in 10 seconds regardless of FPS.

== ORIGINAL FLAWED CODE ==

Formatted to fit, not what it looks like in og.

Whoever was developing this correctly identified the need for the baseline fBaseTimeStepSeconds and to use the actual time per frame fwTimer::GetTimeStep()

05.07.2025 05:13 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

-to emit a continuous stream of "effect", which, the Petrol Can does.

The primary job of it is to handle this continuous action and most importantly deplete the weapon's ammo over time as the player holds the fire button.

The goal of the depletion is to happen at a constant rate of course.

05.07.2025 05:13 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

In "Weapon.cpp" the code that controls the jerry can pouring logic is a method called CWeapon::FireVolumetric

This methods determines how a weapon behaves when used. Other weapons use FireDelayedHit or FireProjectile, for this, it uses FireVolumetric, it's a special case designed for weapons-

05.07.2025 05:13 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0
Post image

The code for the weapons is stored in "game\Weapons\Weapon.cpp" along with tons of other code for things like debugging, accuracy, bullet, explosion, etc.

== ABOUT THE CODE ==

05.07.2025 05:13 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

As you can see in the 2nd clip, when I go to 240fps, it pours WAYY faster, like WAYY too fast. Let's fix it, since that should NOT be happening...

05.07.2025 05:13 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0
Video thumbnail

In Grand Theft Auto V, when your fps is anywhere above 60FPS the gas can will pour faster than if you were on 60FPS

Video of issue attached, 1st is at 60, 2nd is at 240 fps (my monitor refresh rate)

05.07.2025 05:13 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

Fixing GTA 5 Gas Can pouring tied to FPS
A thread🧡

(more to come soon since it's interesting asf to me)

In Grand Theft Auto V that when your fps is anywhere above 60FPS the gas can will pour faster than if you were on 60FPS

Let's dive in!

05.07.2025 05:13 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 2    πŸ“Œ 0

hey!! i’d like to be friends!! :))

30.12.2024 00:00 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

do you need somebody to talk to?

11.12.2024 13:24 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

I JUST SPENT MY LIFE SAVINGS ON HAWK TUAH COIN.

05.12.2024 00:09 β€” πŸ‘ 49    πŸ” 5    πŸ’¬ 7    πŸ“Œ 0

game dev pro tip:

if you're struggling with motivation, try setting realistic goals

like "today i will open the project folder"
or maybe even "today i will look at one (1) line of code"

22.11.2024 13:46 β€” πŸ‘ 8250    πŸ” 781    πŸ’¬ 206    πŸ“Œ 59
Post image Post image Post image Post image

Pictures as of recent.

18.11.2024 22:07 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
Post image Post image Post image Post image

random

11.11.2024 23:40 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
Post image Post image Post image Post image

Photos from 2022 at the beach I edited in photoshop today

Camera | Canon EOS 30D

10.11.2024 17:53 β€” πŸ‘ 3    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
Post image

Tried making hyperpop art of Spamton Neo.

#deltarune #hyperpop #fanart

31.10.2024 17:36 β€” πŸ‘ 7    πŸ” 2    πŸ’¬ 0    πŸ“Œ 0
Post image Post image Post image Post image

more :)

31.10.2024 15:11 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
Post image Post image Post image Post image

4 of my favorite photos I’ve taken these past couple months.

31.10.2024 14:24 β€” πŸ‘ 8    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

@atmossig is following 20 prominent accounts