Improve the performance - sanj0/salty-engine GitHub Wiki
Improve the performance
Info This page is only applicable for Salty Engine >= 0.14.8-SNAPSHOT Here are some tips and tricks to improve the performance of a game made with the Salty Engine. In fact, you can improve the performance, especially in big games, heavily! Note: The list is in no certain order.
1. Play around with the fixed tick rate
Actually, most of the time, a game made with Salty Engine is choppy or slow because of the math stuff, not because of the rendering process, so try to set the fixed ticks up to like 10. In your code, it will look like this:
public class MyGame extends Game {
public static void main(String[] args) {
init(GameConfig.config(1920, 1080, "My new Game", 5));
// instead of using 1
}
}
2. Use the ImageLoader
When using the class utils.ImageLoader
, images only get loaded once and not for every instance of a GameObject again. For more information on the usage of that, please take a look at it's documentation.
3. Reduce the FPS
You can make the game run at a fixed fps count by using Game.start(fps)
instead of Game.start()
.
A short example:
public class MyGame extends Game {
public static void main(String[] args) {
init(GameConfig.config(1920, 1080, "My new Game", 5));
start(60);
// instead of e.g. start();
}
If you use all or most of those tips, your game should run with a constant and good performance. If not, please email me.