freej2me icon indicating copy to clipboard operation
freej2me copied to clipboard

Torn graphics - TowerBloxx

Open hex007 opened this issue 8 years ago • 20 comments

Game : TowerBloxx

Graphics are torn as shown below.

screenshot from 2017-09-26 23-39-30

screenshot from 2017-09-26 23-39-37

hex007 avatar Sep 27 '17 06:09 hex007

@nikita36078 This also affects your application.

hex007 avatar Sep 29 '17 05:09 hex007

@hex007 Buffer clearing fixes this issue in J2ME Loader, but it also makes menus invisible(gameplay looks ok), so another solution is needed.

nikita36078 avatar Sep 29 '17 06:09 nikita36078

@nikita36078 I think this might be a clipping issue. The previous graphics are not being cleared.

Where are you clearing the buffer to get the partial result. Could you paste some code?

hex007 avatar Sep 29 '17 16:09 hex007

Was able to achieve this by commenting gc.setClip(int, int, int, int); and drawing a rectangular boundary over the clip area. Including gc.setClip causes the problem

@recompileorg @nikita36078 any insights ?

https://github.com/hex007/freej2me/blob/076a86b46a18f1c39461e2dabb169bb697ca0c00/src/org/recompile/mobile/PlatformGraphics.java#L275-L282

screenshot from 2017-09-29 13-43-59

hex007 avatar Sep 29 '17 20:09 hex007

I'd guess that there is some difference between setClip on j2se vs j2me.

Tower Blocks doesn't seem to run at all on the AWT build on Windows. I can't reproduce the problem there.

recompileorg avatar Sep 29 '17 21:09 recompileorg

I tried it on Kemulator just to test and It works as expected.

EDIT: The AWT build on linux works but persons and clouds are not rendered. On the next screen the grid and buildings are not shown.

hex007 avatar Sep 29 '17 21:09 hex007

@recompileorg Are we using double buffering? @nikita36078 Suggests that might help solve this issue.

hex007 avatar Sep 30 '17 23:09 hex007

Yes, though I don't see why that would make a difference here.

recompileorg avatar Oct 01 '17 00:10 recompileorg

Tower Blocks doesn't seem to run at all on the AWT build on Windows. I can't reproduce the problem there.

Did you try the SDL build?

hex007 avatar Oct 01 '17 01:10 hex007

No, nor did I try the libretro build. Though the differences reported here, and some other oddities I've seen, lead me to believe there is an incompatibility between java implementations that is leading to the difference in behavior as the front end shouldn't have any effect on those issues.

It might not be a good idea to rely on graphics2d clipping, and instead handle it in other ways, like rendering to a temporary area and copying the area inside the clipping region over.

recompileorg avatar Oct 01 '17 03:10 recompileorg

Can you compare between Oracle JDK and openJDK on Windows?


Technically both frames should look the same but they dont. The binaries are from the same build on the same system using freej2me-sdl.jar and freej2me.jar respectively.

On Linux (Fedora x64 Open/JDK) SDL frame is different than AWT frame at the same instance of the game; Tower Bloxx > Build City

SDL Screenshot screenshot from 2017-09-30 22-28-30

Awt screenshot screenshot from 2017-09-30 22-29-07

hex007 avatar Oct 01 '17 05:10 hex007

That is curious, as the exact same data is being sent to the AWT UI as the SDL UI.

recompileorg avatar Oct 01 '17 07:10 recompileorg

I checked KEmulator code, it uses Graphics2D methods for clipping and as we can see, it works properly.

nikita36078 avatar Oct 01 '17 07:10 nikita36078

@nikita36078 Where did you get Kemulator source from?

hex007 avatar Oct 01 '17 07:10 hex007

I decompiled it with Bytecode Viewer, KEmulator isnt open source unfortunately

nikita36078 avatar Oct 01 '17 08:10 nikita36078

@recompileorg Are you able to reproduce this?

hex007 avatar Oct 01 '17 08:10 hex007

@nikita36078 Smali code?

hex007 avatar Oct 01 '17 08:10 hex007

@hex007 No, Bytecode Viewer can generate Java pseudocode and it is readable enough.

nikita36078 avatar Oct 01 '17 08:10 nikita36078

@nikita36078 Do you use Windows or Linux? Can you try comparing SDL interfave vs awt

hex007 avatar Oct 01 '17 08:10 hex007

@hex007 I use Windows, and TowerBloxx stucks at game logo, I dont know why.

nikita36078 avatar Oct 01 '17 08:10 nikita36078