Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Monitor variables of a running program?

I'm working on a small multiplayer game which has a tick method which does all kind of logic things like moving, creating and checking game elements.

The tick method is called every 100 milliseconds. Sometimes things go wrong due a bug. But these bugs are hard to track down mainly because things are being called many times a second. So when i add a debug log entry at some points the log gets overcrowded and not really easy to understand.

Is there a way to monitor certain variables while the game keeps running?

I tried jmx but the time to setup jmx to monitor a variable is quite long due the complex nature of jmx. In addition when tracking a but i don't know which variable to monitor, this means i need to switch from variable to variable quickly.

like image 286
Tinus Tate Avatar asked Sep 13 '25 00:09

Tinus Tate


1 Answers

This is a big problem with Game design where draws are called 30/60 times a second.

I found that outputting all the values on screen helped a lot as it doesn't save the previous values so you can easily see when things change.

You also can add breakpoints when a value is changes to a range it shouldn't be, thus allowing you to inspect the code further such as

  1 if(val>1000){
  2     debugger;
  3 }
like image 93
Dean Meehan Avatar answered Sep 15 '25 13:09

Dean Meehan