Dynamic FPS

Dynamic FPS

16M Downloads

[Feature suggestion] Make FPS actually dynamic

Felix14-v2 opened this issue · 5 comments

commented

Description

Over time, more and more laptops are equipped with a high refresh rate screen, 120Hz and higher, but this leads to high power consumption when running Minecraft on battery. Actually not all game scenarios require such a high FPS: you don't need to see 144 FPS of the world rendering when you are messing around in a chest, view achievements, or just stand still for any other reason.

Solution

Dynamic FPS can detect player movement speed (as well as other conditions) and adjust FPS to it. This would allow Minecraft to save large amount of computing power almost without affecting the game perception.

By default, FPS can be reduced to 60 and then boosted when certain conditions are met. For example (with base frequency of 144 Hz):

State FPS Condition
fast movement 144 xyz-coordinates are changing fastly* (e.g. when sprinting, falling or flying)
generic movement 120 xyz-coordinates are changing on average speed (walking)
slow movement 90 xyz-coordinates are changing slowly (e.g. sneaking)
fast camera movement 144 yaw/pitch are changing fastly*
average camera movement 120 yaw/pitch are changing moderately*
slow camera movement 90 yaw/pitch are changing slowly*
in danger 144 player is receiving damage
in combat 144 player is holding weapon
in inventory** 90 a UI is opened (inventories, chests, villagers, hoppers, droppers etc)
is active varies delay defore reducing FPS after detecting last important condition like in danger or in combat

* — sensitivity may be defined by user
** — can ignore is active condition

Displays on different devices have different refresh rate and support changing them, so a FPS preset system is also needed.

Additional

This feature will also require its own hotkey (to conveniently switch it if your scenario isn't listed above) and the option to disable it in multiplayer (because there's a lot of movement unrelated to player).
Theoretically it is possible to detect if a device has power supply connected, but in practice... Previous attempt to use this (Battery Status Info mod) was totally unsuccessful, so basic manual switching by hotkey would be simple and effective.
Also some conditions may support custom extensions in config file (or even API for mods) to allow modpack/datapack authors define modded inventories and weapons. In case of datapacks the problem is we can't add custom item ID and have to modify the existing ones with custom data. Before 1.20.5 datapack creators used custom NBT tags and CustomModelData for this, but since 1.20.5 it is enough to check the presence of minecraft:custom_data component.

Related

Yeah, Nvidia GeForce Experience and Intel control panel has similar options, but they both works as bad as you can imagine (and even worse if we talk about Intel, it's just murders your GPU trying to detect the motion). GeForce Experience is a garbage itself, so having standalone mod with this feature would be very helpful.

P.S.

Over time, more and more mods began to appear, trying to replace Dynamic FPS. However, your mod has always been one step ahead of others in terms of quality, performance and functionality, and such a feature would make the mod the absolute leader in its category :)

commented

Sounds like an interesting idea in general, but I have some questions right away:

Since you say the battery status info mod is "totally unsuccessful": did it not manage to show your battery status or do you mean its usefulness is not as big as it could be?

Also I'm unsure whether you'd really want to adjust the FPS for every individual screen (there's .. a lot), but I could see us having a separate FPS limit for screens that do pause the game and screens that don't (so inventories etc. vs settings screens, and maybe special case some like the chat screen).

And thirdly, what do you imagine other mods (or datapacks) to actually do? Why would Dynamic FPS care that you are holding a custom item? I'm not opposed to it I just do not understand the use case here.

commented

you say the battery status info mod is "totally unsuccessful": did it not manage to show your battery status

Yes, I tested it on my phone, laptop and 2 tablets with Windows and Linux, and the mod did not display the battery charge correctly on any of them. I just suspect that doing so isn't easy.

Also I'm unsure whether you'd really want to adjust the FPS for every individual screen

Sorry, I explained my idea badly. The idea was to reduce the world rendering FPS, but not the entire game FPS to keep the game responsive in UIs (something like inverted Exordium). If we want to save power by reducing the quality of elements that a player is not currently focusing on, then we can freely limit the FPS of the world rendering. If a player has opened some kind of UI, it is unlikely that they are closely following the world in the background.

By the way, Bedrock Edition has additional performance hack there — it uses Fog Occlusion to reduce the render distance without actually changing it when you open a screen:
Screenshot_20240106-022516
Screenshot_20240106-022607
So instead of changing render distance they just move the fog nearer and make the fog occlusion optimization reduce visible chunk data. In java Edition, we can't change the distance and avoid chunk reloading, but using this trick we can.

Why would Dynamic FPS care that you are holding a custom item?

One of the most important scenarios of the game is pvp/pve. In combat, it is important to have minimal delay and maximum game responsiveness, and I think that the most effective way to determine whether a player wants to fight is to check for weapon in main hand. If we talk about datapacks, we can't detect if an item is just a regular stick or custom sword with its own damage and texture based on it, so the only simple way is to assume that all custom items are weapons.

But I agree that this usecase can be very niche and not worth your attention and time.

commented

Thanks for the info, I think your feature request(s!) are clear to me now.

I'd be curious whether we could make a working battery detection system (and then have a battery mode as well with a diff max FPS?), I might contact you about testing such a thing since I do not own a laptop.

commented

I would be pleased to help you with testing! Does the project have a discord for more convenient communication? I receive notifications by email, and delays in reading can cause you a lot of inconvenience.

commented

I don't think we have a Discord, but I can contact you on there if you'd like once I'm working on this (tag is @lostluma).