Sodium

Sodium

35M Downloads

Very high values (> 1 million) for player's air value slows down the game's framerate.

James103 opened this issue ยท 4 comments

commented

Expected Behavior

The game should still run at playable frame rates and the number of air bubbles displayed is capped at 10, even if the player's Air is over 2 billion.

Actual Behavior

When the player's Air value is upwards of 2 billion, it takes upwards of 30 seconds to render a single frame, most of that is spent drawing the over 70 million air bubbles (where each air bubble represents 30 units of air).

Additionally, there is noticeable slowdown in the game's framerate starting at a value as low as 1 million for the player's oxygen level.

Note that this bug exists in vanilla Minecraft, but can only really be exposed by either using NBT editing (which limits the player's air value to 32,767) or with the Carpet mod. I'm posting it here because I think Sodium can fix this bug.

Reproduction Steps

  1. Install the latest version of Carpet mod (at least 1.4.12).
  2. Go underwater.
  3. Execute the command /script run modify(p, 'air', -2147483600).
  4. Wait a couple of seconds.
  5. After 2.35 seconds without Respiration, the total time required to render a frame increases from several milliseconds or centiseconds, to about 20-30 seconds even on high-end computers.
  6. Take a look at the air bubbles once the first such frame is rendered - air bubbles stretch to the far left side of the screen, and way past even that.
  7. Execute the command /script run modify(p, 'air', 5000000).
  8. Use Alt+F3 to open up the FPS graph.
  9. Notice the slowdown in framerate.

Attachments

This is when the player's air value is set to 5 million, adding some 64 ms/frame to a base render time of 8 ms/frame.
image

System Information

  • Java Version: Java 8 update 265 (OpenJDK)
  • CPU: Intel Core i5-9400F @ 2.90Ghz
  • GPU: Nvidia GTX 1660
commented

Does this occur without Sodium installed? If so, then this issue would properly be a feature request to fix a vanilla bug

commented

The issue occurs regardless of whether Sodium is installed. This can be relabeled as a feature request.

commented

Is there a practical reason for Sodium to fix this?

I'd imagine that since this occurs in vanilla anyway, it is not used in minigames. Similarly if there are mods that take advantage of it, they would probably patch it themselves.

commented

As Madis points out, I don't believe there is any reason to fix this since the only way to prompt the bug is to use NBT editing to set invalid values for the Air field.