#2 Division by zero exception in GageTimer

Bernhard Trummer

Game Exception on Mother of all Gravity Games v1.93
java.lang.ArithmeticException: / by zero
at com.golden.gamedev.engine.timer.GageTimer.getTime(Unknown Source)
at com.golden.gamedev.engine.timer.GageTimer.startTimer(Unknown Source)
at com.golden.gamedev.GameEngine.startGameLoop(Unknown Source)
at com.golden.gamedev.Game.start(Unknown Source)
at com.golden.gamedev.GameLoader.start(Unknown Source)
at moagg.game.MoaggGameEngine.main(MoaggGameEngine.java:54)

Game Environment
Date/Time : Di, 22 Jan 2008 at 11:27
Java Version : 10.0-b19 Sun Microsystems Inc.
GTGE Version : 0.2.3
Environment : Windowed Mode [640x480] with BufferStrategy
Operating System : Windows XP 5.1 Service Pack 2


    • status: open --> open-accepted
  • Logged In: YES
    Originator: YES

    Here's a workaround for Windows to switch to the alternative SYSTEM timer:
    - Open the registry editor (regedit).
    - Open HKEY_CURRENT_USER/Software/JavaSoft/Prefs/moagg/prefs/system.
    - Change the value of the key 'timer' to the value 'SYSTEM'.

    • status: open-accepted --> pending-accepted
  • Logged In: YES
    Originator: YES

    I just forwarded the stack trace to the GTGE forum, since it looks to me like a bug in the initialization of the GageTimer class.

    • status: pending-accepted --> open-accepted
  • Logged In: YES
    Originator: YES

    As better workaround, I will introduce a system property (set in run.bat/run.sh) to define the timer to be used at game initialization.

  • Logged In: YES
    Originator: YES

    The next version of moagg will contain the native library 'timer.dll', which is used by the GAGE timer as fallback, if the default NanoTimer is not used for some reasons.

    • status: open-accepted --> closed-fixed
    • assigned_to: btrummer --> nobody
  • Logged In: YES
    Originator: YES

    The bug is now reproducable on my XP machine when using the latest Java 6 (Update 6) runtime.

    Although version 1.95 of moagg contains the previously missing 'timer.dll' in the jar directory, it is not found automatically by the game engine and the same error occurs. This can be fixed in 'run.bat' by modifying line 13 to the following:

    set MOAGG_PROPERTIES=-Djava.library.path=jar -Dlog4j.configuration=file:log4j.properties

    This fix will be included in the next release...

    • priority: 5 --> 7
  • Released v1.95b containing the fix in run.bat