BreakingTheTower icon indicating copy to clipboard operation
BreakingTheTower copied to clipboard

Not working in Windows 10

Open 40OE opened this issue 8 years ago • 11 comments

Title. Woud love to see support for this.

40OE avatar Apr 13 '17 14:04 40OE

@40OE You could be more accurate. I've just tried to run the JAR in command line with Oracle Java 1.8 and the games is frozen, I see the window but it doesn't react, nothing happens when I click.

ghost avatar Jul 27 '17 14:07 ghost

This is the root cause:

"Thread-2" #18 prio=5 os_prio=0 tid=0x00000000217ac000 nid=0x23cc runnable [0x00000000245ff000] java.lang.Thread.State: RUNNABLE at com.mojang.tower.TowerComponent.run(TowerComponent.java:119)

  • locked <0x00000007568a2f78> (a com.mojang.tower.TowerComponent) at java.lang.Thread.run(Thread.java:745)

"AWT-EventQueue-0" #16 prio=6 os_prio=0 tid=0x00000000217a3000 nid=0x103c waiting for monitor entry [0x00000000237ed000] java.lang.Thread.State: BLOCKED (on object monitor) at com.mojang.tower.TowerComponent.mousePressed(TowerComponent.java:416)

  • waiting to lock <0x00000007568a2f78> (a com.mojang.tower.TowerComponent)

Rather use a queue and remove the synchronized keywords. When mousePressed() is called, it should add a Runnable into this queue. Then, the Runnable should be removed and called just before rendering here: https://github.com/alexeypetrushin/BreakingTheTower/blob/master/src/com/mojang/tower/TowerComponent.java#L125

Markus wrote "Do not distribute altered versions of this game in any way". Therefore, I can't "distribute" a fixed version. Good luck.

ghost avatar Jul 27 '17 14:07 ghost

I confirm that this bug isn't reproducible under GNU Linux. I've just tested the game under Mageia Linux 6 with OpenJDK 1.8 update 131.

ghost avatar Jul 27 '17 17:07 ghost

@40OE Please give it a try: https://github.com/gouessej/BreakingTheTower/blob/master/Tower.jar

@alexeypetrushin Do you want me to make a pull request?

ghost avatar Jul 27 '17 19:07 ghost

Hmm, thanks, but no, I'm scared by the license, it says code shouldn't be modified :)

al6x avatar Jul 27 '17 21:07 al6x

My fix doesn't work :(

@alexeypetrushin Ok, I understand your position. I'll go on trying to fix this bug anyway.

ghost avatar Jul 28 '17 08:07 ghost

My latest fix works, enjoy :)

ghost avatar Jul 28 '17 09:07 ghost

thanks gouessej, the fix works fine! If markus sees this, hopefully he'll understand haha

40OE avatar Aug 09 '17 00:08 40OE

@40OE Actually, I think that Markus will strongly refuse to use my fix because he won't be interested in maintaining this game (he wrote in java-gaming.org that he found it bad) and because he won't admit that I'm able to fix something he created. We have some disagreements but it doesn't prevent me from respecting him and from appreciating some of his games.

ghost avatar Aug 09 '17 08:08 ghost

@40OE I've just moved my source code to Sourceforge as my server isn't ready to host it yet and I'm leaving Github: https://sourceforge.net/p/breakingthetower

ghost avatar Jun 05 '18 11:06 ghost

Hi. I dont know if threads are the problem here. Because I have the issue that the game is frozen on title screen and is not responsive to click to start. So I looked at the source code and found out that in TowerComponent.java on line 108 of run function there is a variable lastTime that is declared as float. And then there is this tick while loop where you add to lastTime a double variable msPerTick which is a fraction of something like 0.03333333. And the while loop has a condition while (now - lastTime > msPerTick) { if (!paused && frameTicks++ < MAX_TICKS_PER_FRAME) tick(); lastTime += msPerTick; } So at every while loop cycle the lastTime variable is incremented by msPerTick until lastTime is big enough to break the while loop but the problem is that because lastTime is float it is not properly incremented by the fraction. It allways stays the same value (hence the game is stuck at that loop). When i changed lastTime from float to double then it started to get incremented and the game is not frozen anymore. But to be honest it still not working good in the terms that it is trash fps performance. It do not work smoothly but it actually works. And one more thing. The name of the variable msPerTick is misleading because it suggest storing time in miliseconds per tick. But it is actualy a fraction of 1/TICKS_PER_SECOND so actually it store time of one tick in seconds right?

Ok 20 minutes later I actually made the game to run smooth. To do this first you have to change lastTime from float to double. And then around line 117 (i dont know for sure the line because the code is poluted by my modifications:D) there is variable now. So you need to set now to double now = (System.nanoTime() / 1000000d) / 1000.0d;. And also if you have problem loading the game from source code from your IDE you need to move the res files like logo.gif island.gif sheet.gif and winscreen.gif from res folder to src.com.mojang.tower folder or to change the resource path name in bitmaps.java file starting at line 33 logo = ImageIO.read(Bitmaps.class.getResource("logo.gif"));.

bodziozet avatar Feb 10 '24 23:02 bodziozet