Old Dos program (Wa-tor) ported to Java runs too quickly

  • Context: Java 
  • Thread starter Thread starter dkotschessaa
  • Start date Start date
  • Tags Tags
    Dos Java Program
Click For Summary

Discussion Overview

The discussion revolves around the challenges of slowing down a Java port of the Wa-Tor predator-prey simulation game, originally designed for DOS. Participants explore various methods to control the game's speed, considering both programming solutions and alternative approaches.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Exploratory

Main Points Raised

  • One participant expresses nostalgia for the game and seeks a way to slow it down, noting its original design for a 1985 DOS machine.
  • Another participant suggests adding an inner loop with a sleep function to the main game loop to control speed.
  • A different suggestion involves using a timer with a callback function to manage game logic timing.
  • One participant proposes using Thread.sleep to pause execution, providing a code snippet as an example.
  • Another participant argues that slowing down Java may not be feasible without access to the source code, recommending the use of DOSBox for running the original DOS version with speed throttling options.
  • One participant recalls issues with older programs written in Turbo Pascal that became unpredictable due to changes in computer speed and suggests using multiple integers for cycle checks as a workaround.
  • Another participant acknowledges the availability of the source code and expresses intent to try modifying it.
  • A participant reflects on the game's similarity to the "Game of Life" and wishes the original poster good luck.

Areas of Agreement / Disagreement

Participants present multiple competing views on how to effectively slow down the game, with no consensus reached on a single solution. Some suggest programming modifications, while others recommend using external tools like DOSBox.

Contextual Notes

Participants note limitations related to access to the source code and the challenges posed by modern computer speeds affecting older software. There are unresolved technical details regarding the implementation of suggested solutions.

dkotschessaa
Messages
1,063
Reaction score
763
When I was a (very lonely) child, I used to play endlessly with this predator-prey simulation game:
http://www.leinweb.com/snackbar/wator/

(You may have trouble getting this applet to run based on java updates, other security settings and what not).

There is more information about it here:

http://en.wikipedia.org/wiki/Wa-Tor

This program would actually be a great compliment to a presentation I'm thinking of doing. (Haven't found one on the web that works as well).

However, the thing runs EXTREMELY fast. It was originally meant to run on a 1985 DOS machine.

I don't know anything about Java. Is there any easy way to slow it down?

-Dave K
 
Technology news on Phys.org
dkotschessaa said:
predator-prey simulation game:
How do I play it?
 
Assuming there's a main loop in the game, add an inner loop that just iterates, perhaps with some type of sleep like function.
 
Use a timer with a callback function to the game logic.
 
Use Thread.sleep:

Code:
try {

    Thread.sleep(1000); // SLEEP for 1 second ie 1000 ms

} catch (InterruptedException e) {

    e.printStackTrace();  

}
 
I don't think there's a way to slow down java, unless you wrote the code and have access to it to modify it.

If you can find the DOS version, you can use DOSbox, which I believe has some options to throttle the speed of emulation on more modern PC's, though it can be kind of a pain to configure.

If you do have the source code (if you did the port), the above advice is pretty solid.
 
jedishrfu said:
Use Thread.sleep:

Code:
try {

    Thread.sleep(1000); // SLEEP for 1 second ie 1000 ms

} catch (InterruptedException e) {

    e.printStackTrace();  

}

elusiveshame said:
I don't think there's a way to slow down java, unless you wrote the code and have access to it to modify it.

If you can find the DOS version, you can use DOSbox, which I believe has some options to throttle the speed of emulation on more modern PC's, though it can be kind of a pain to configure.

If you do have the source code (if you did the port), the above advice is pretty solid.

Yes, the source code is there on the site i linked. Let me give this a try.
 
Computer getting fast are such a pain. At some point all programs written in Turbo Pascal and using crt module stopped to work. From what I remember they were checking how many runs of an internal loop were required per millisecond, that was later used in some kind of sleep() function. Once the integer counter overflowed programs became unpredictable.
 
You could always 2 integers (or more) for the checks on cycles and use conditionals to work around that problem. It's not the most glorious method, but it could work without having to rewrite the entire game while ensuring the timing is correct.

Also, I didn't realize the source was available in the link (on my phone, and I'm not a fan of mobile browsing), so I apologize for not checking that out before posting.
 
  • #11
I used to love that game, its a variation of "game of life", predator/pray simulation. Good luck.
 

Similar threads

  • · Replies 34 ·
2
Replies
34
Views
55K