Major engine changes and reworks to allow for similar play on different devices. Movement and animations are now time-dependent using delta time as opposed to frame-dependent. This allows the game to run the same without need for locking frame rate with former sync() function or vsync. Fixed update was added which is updated 60 times per second regardless of frame rate.
Fixes and Changes
Timer.java:
Removed unused and redundant functions and variables. Added delta time to make calculations time dependent instead of frame dependent. Made functions static
Player.Java:
Removed redundant import
Changed variable speeds
Changed delta position directions
Added delta time in movement to make player movement time-dependent instead of frame-dependent
Animation.java:
Formatted file
Removed redundant and unused variables
Renamed variables and functions for readability
Fixed run() to use new delta time
GameEngine.java:
Removed redundant and unused variables
Frame unlocked update()
Added fixedUpdate()
Implemented delta time in fixed update
Removed sync() as it was redundant and overridden by glfwSwapInterval(1) Implemented delta time in FPS counter
GameObject.java:
Formatted variables
GameLogic.java:
Frame-unlocked update function
Game.java:
Changed update() to work with new changes.
Made camera follow player
Main.java:
Formatted GameEngine() arguments for readability
MapTree.java:
Small formatting
Type of change
[x] Bug fix (non-breaking change which fixes an issue)
[x] New feature (non-breaking change which adds functionality)
[x] This change requires a documentation update
Checklist:
[x] I have performed a self-review of my own code
[x] I have commented my code, particularly in hard-to-understand areas
Possible Bugs and Errors
Animations, while called in fixedUpdate(), are slightly slower when vsync is enabled compared to when frame rate is unlocked. Movement does not appear to be effected by this bug and there does not appear to be any impact on game play.
Tests were conducted to ensure movement speed was the same among multiple frame rates. Further testing on separate devices is encouraged.
Description
Major engine changes and reworks to allow for similar play on different devices. Movement and animations are now time-dependent using delta time as opposed to frame-dependent. This allows the game to run the same without need for locking frame rate with former sync() function or vsync. Fixed update was added which is updated 60 times per second regardless of frame rate.
Fixes and Changes
Timer.java: Removed unused and redundant functions and variables. Added delta time to make calculations time dependent instead of frame dependent. Made functions static
Player.Java: Removed redundant import Changed variable speeds Changed delta position directions Added delta time in movement to make player movement time-dependent instead of frame-dependent
Animation.java: Formatted file Removed redundant and unused variables Renamed variables and functions for readability Fixed run() to use new delta time
GameEngine.java: Removed redundant and unused variables Frame unlocked update() Added fixedUpdate() Implemented delta time in fixed update Removed sync() as it was redundant and overridden by glfwSwapInterval(1) Implemented delta time in FPS counter
GameObject.java: Formatted variables
GameLogic.java: Frame-unlocked update function
Game.java: Changed update() to work with new changes. Made camera follow player
Main.java: Formatted GameEngine() arguments for readability
MapTree.java: Small formatting
Type of change
Checklist:
Possible Bugs and Errors
Animations, while called in fixedUpdate(), are slightly slower when vsync is enabled compared to when frame rate is unlocked. Movement does not appear to be effected by this bug and there does not appear to be any impact on game play.
Tests were conducted to ensure movement speed was the same among multiple frame rates. Further testing on separate devices is encouraged.