hex007 / freej2me

A free J2ME emulator with libretro, awt and sdl2 frontends.
Other
500 stars 78 forks source link

Lag issues in "Heroes Lore: Wind of Soltia" #73

Closed Nokia64 closed 2 years ago

Nokia64 commented 4 years ago

Neat RPG from Korea. Popular for it's deep mechanics / gameplay, and amazing pixel-esque graphics, PC/Console RPG alike. Screenshot from 2020-02-06 00-17-59 Screenshot from 2020-02-06 00-27-15

On FreeJ2ME, the games suffers from severe lag issues while moving around, on every JAR release I tried. Input gets nested, and last many frames longer than expected. In fact, it's the whole FreeJ2ME what lags, as features such as screenshotting lag behind too.

recompileorg commented 4 years ago

Well, I'm not getting slowdown, though it does seem to have a bit of delay releasing keys. That is, if I press down for a second or so, it takes a second or so to stop after I release the key. Is that the issue you're talking about?

Nokia64 commented 4 years ago

Yes, that is it. The weirdest part, is that it is the whole FreeJ2ME what "lags", not only the game. Try, in example, using the [+] [-] scaling hotkeys while the movement quirks occur.

XerTheSquirrel commented 4 years ago

Took a look at the byte-code for this and found that there is heavy use of various kinds of synchronization (synchronized (foo), Object.wait(), Vector which is always synchronized, and Canvas.callSerially()). There are multiple threads involved and lots of the event handling methods are locking monitors as part of their event handling (which is always a bad idea).

vadosnaprimer commented 4 years ago

@XerTheSquirrel could you check Bounce Tales too (regarding lag)? https://github.com/hex007/freej2me/issues/52

XerTheSquirrel commented 4 years ago

@XerTheSquirrel could you check Bounce Tales too (regarding lag)?

52

I would need the JAR to check it out.

vadosnaprimer commented 4 years ago

Sent you an email.

recompileorg commented 2 years ago

This might be worth checking again after @Nokia64's last commit.

Nokia64 commented 2 years ago

Good catch, these quite solved this issue indeed! Sounds like all the threading and locking involved as @ XerTheSquirrel described wasn't playing nicely with all the unexpected keyPressed events Thank y'all!