I’ve set up a turn based strat game that relies solely on mouse clicks from the user. I have a main loop that merely draws the world, then sleeps for the excess time. This same runnable object that contains the loop also is the mouse listener. When the mouse listener gets an event, it relays the event down to the main “game logic” class to perform some calculation… however this is done on the fly and totally independent from the main loop. Is this a dangerous way to design the game despite only having very isolated moments of working game logic?
Another slightly related question is using Thread.sleep(excess time) vs. Thread.yield() and if one would hurt the Event Dispatching Thread “liquidity” more than the other. I’ve been using Thread.yield() and it kills any machine I run the game on. Thread.sleep() however barely uses any processor so I’m inclined to use it instead especially if there is no disadvantage.
Thanks,
jon