Class GameLoop

java.lang.Object
ActiverseEngine.GameLoop
All Implemented Interfaces:
Runnable

public class GameLoop extends Object implements Runnable
Represents a highly parallelized game loop maximizing CPU usage while maintaining stability. Threads are split across update/render responsibilities with precise frame pacing.
Version:
1.4.0
Author:
Knivier
  • Constructor Summary

    Constructors
    Constructor
    Description
    GameLoop(World world)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Returns the target frames per second (FPS) for the game loop.
    boolean
    Returns whether dynamic lighting is enabled in the game loop.
    void
    run()
     
    void
    Starts the game loop on separate threads for update and render.
    void
    Stops the game loop and waits for threads to finish.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GameLoop

      public GameLoop(World world)
  • Method Details

    • start

      public void start()
      Starts the game loop on separate threads for update and render. This method initializes the threads and begins the game loop.
    • stop

      public void stop()
      Stops the game loop and waits for threads to finish. This method safely terminates the update and render threads,
    • run

      public void run()
      Specified by:
      run in interface Runnable
    • getTargetFps

      public long getTargetFps()
      Returns the target frames per second (FPS) for the game loop. This value is loaded from the properties file or defaults to 60 FPS.
      Returns:
      the target FPS
    • isDynamicLighting

      public boolean isDynamicLighting()
      Returns whether dynamic lighting is enabled in the game loop. This value is loaded from the properties file or defaults to false.
      Returns:
      true if dynamic lighting is enabled, false otherwise