You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/blog/2024/12-30-bevy-mobile-framerate/index.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ On the one hand a game is supposed to run smoothly which requires a high enough
15
15
16
16
In this short post we talk about how to balance the two and how to adapt the balance based on your specific apps needs.
17
17
18
-
We will also find out why the default settings of Bevy on mobile used to lead to the worrysome statistics in the xcode debugger you see on the right - indicating that we run at ∞ fps and using 200% CPU 🥵.
18
+
We will also find out why the default settings of Bevy on mobile used to lead to the worrisome statistics in the xcode debugger you see on the right - indicating that we run at ∞ fps and using 200% CPU 🥵.
19
19
20
20
# Why mobile has to be treated differently
21
21
@@ -31,9 +31,9 @@ The Bevy engine is a general purpose game engine. It is not specifically designe
31
31
32
32
So how to fix this problem? The short answer is: Limit the framerate.
33
33
34
-
The catch is though that your device might vsync at 60Hz already making you think the problem lies somewhere else. The footgun is that even if the rendering is limited to 60Hz Bevy will - by default - still update all your systems as often as it possibly can even if rendering updates are only happening in a 60 fps rate.
34
+
The catch is though that your device might VSync at 60Hz already making you think the problem lies somewhere else. The foot-gun is that even if the rendering is limited to 60Hz Bevy will - by default - still update all your systems as often as it possibly can even if rendering updates are only happening in a 60 fps rate.
35
35
36
-
The solution is to configure the refresh rate of winit:
36
+
The solution is to configure the refresh rate of *winit*:
Using `UpdateMode::reactive` will lead to bevy refreshing our systems also based on user input like mouse events as they happen but in an abscence of any event to *react* to it will limit the refresh rate to 60Hz. This is a sensible default for most mobile games.
46
+
Using `UpdateMode::reactive` will lead to bevy refreshing our systems also based on user input like mouse events as they happen but in an absence of any event to *react* to it will limit the refresh rate to 60Hz. This is a sensible default for most mobile games.
47
47
48
48
But we can do better. We can adapt this at runtime.
49
49
50
50
# Adaptable framerate
51
51
52
52
In the above example we simply configure this 60Hz rate on startup. But you can adapt this at any time. This allows you to reduce the refresh rate in menus or more static situations and increase it during action phases where a low fps would lead to a reduced user experience.
Copy file name to clipboardExpand all lines: docs/blog/2024/12-30-bevy-mobile-framerate/index.html
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -35,7 +35,7 @@ <h1 class="title">
35
35
<p>Mobile Games have to walk a fine line between rendering performance and energy conservation.</p>
36
36
<p>On the one hand a game is supposed to run smoothly which requires a high enough framerate and yet not to consume too much energy and therefore draining battery too quickly.</p>
37
37
<p>In this short post we talk about how to balance the two and how to adapt the balance based on your specific apps needs.</p>
38
-
<p>We will also find out why the default settings of Bevy on mobile used to lead to the worrysome statistics in the xcode debugger you see on the right - indicating that we run at ∞ fps and using 200% CPU 🥵.</p>
38
+
<p>We will also find out why the default settings of Bevy on mobile used to lead to the worrisome statistics in the xcode debugger you see on the right - indicating that we run at ∞ fps and using 200% CPU 🥵.</p>
39
39
<h1id="why-mobile-has-to-be-treated-differently">Why mobile has to be treated differently</h1>
40
40
<p>Traditionally games are rendered at the highest possible framerate. In case of PC and console games this means utilizing the hardware to the fullest maximizing fidelity, image and effect quality and overall richness of the experience.</p>
41
41
<p>On mobile however, the situation is different. The hardware is not only less powerful but also the device is not designed to be cooled actively. Instead the heat has to be dissipated through the case and the screen. This means that the device can get <strong>hot</strong> quickly. On the other hand the phone battery is another limiting factor. The more energy the game consumes the quicker the <strong>battery</strong> will be drained. As a phone user I don't want to suddenly change my charging habits just because I played my game.</p>
@@ -45,19 +45,19 @@ <h1 id="why-mobile-has-to-be-treated-differently">Why mobile has to be treated d
45
45
<p>The Bevy engine is a general purpose game engine. It is not specifically designed for mobile games. This means that the default settings are not optimized for mobile. This is not a problem as long as you are aware of it and know how to adjust the settings.</p>
46
46
<h1id="how-to-limit-processing">How to limit processing</h1>
47
47
<p>So how to fix this problem? The short answer is: Limit the framerate.</p>
48
-
<p>The catch is though that your device might vsync at 60Hz already making you think the problem lies somewhere else. The footgun is that even if the rendering is limited to 60Hz Bevy will - by default - still update all your systems as often as it possibly can even if rendering updates are only happening in a 60 fps rate.</p>
49
-
<p>The solution is to configure the refresh rate of winit:</p>
48
+
<p>The catch is though that your device might VSync at 60Hz already making you think the problem lies somewhere else. The foot-gun is that even if the rendering is limited to 60Hz Bevy will - by default - still update all your systems as often as it possibly can even if rendering updates are only happening in a 60 fps rate.</p>
49
+
<p>The solution is to configure the refresh rate of <em>winit</em>:</p>
<p>Using <code>UpdateMode::reactive</code> will lead to bevy refreshing our systems also based on user input like mouse events as they happen but in an abscence of any event to <em>react</em> to it will limit the refresh rate to 60Hz. This is a sensible default for most mobile games.</p>
56
+
<p>Using <code>UpdateMode::reactive</code> will lead to bevy refreshing our systems also based on user input like mouse events as they happen but in an absence of any event to <em>react</em> to it will limit the refresh rate to 60Hz. This is a sensible default for most mobile games.</p>
57
57
<p>But we can do better. We can adapt this at runtime.</p>
<p>In the above example we simply configure this 60Hz rate on startup. But you can adapt this at any time. This allows you to reduce the refresh rate in menus or more static situations and increase it during action phases where a low fps would lead to a reduced user experience.</p>
60
-
<p>A simple way would be to tie it to gamestates:</p>
60
+
<p>A simple way would be to tie it to game states:</p>
0 commit comments