Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I wanted each time I play my game, it will show in the console how many times you compiled or run the game. How do I do that?

share|improve this question
3  
You need to work on your accept rate. 0% is very low. –  Byte56 Sep 28 '12 at 15:30

1 Answer 1

up vote 3 down vote accepted

Well the question really is how do you compile your game:

  • If you just use javac in the console, make a batch file (in whatever batching language your OS supports, i.e. .bat file for windows, .sh file for Linux, etc) that before executing the compiling command (or after) will read the current build number from a text file, increment it and re-write it;

  • If you use a project build tool such as Ant or Maven, you can configure them to automatically place the build number (and build date, etc) into a specified text file.

Finally, whatever your approach, make your application code read the values in that text file and display them somewhere.

share|improve this answer
1  
As to how many times you've played your game, just add code to the start of your game that increments a counter in a file.. –  Jari Komppa Sep 28 '12 at 11:25
    
If you do not yet use a build tool like ant or maven, you really should consider using it. –  Markus Sep 29 '12 at 9:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.