hex007 / freej2me

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

DOOM RPG gets very slow with sounds #90

Open coldner opened 4 years ago

coldner commented 4 years ago

It looks like sounds in DOOM RPG need to load from file everytime when game wants to play this sound. The longer you play, game requires more and more time to load a sound and finally it's impossible to smooth playing. Looks like a kind of memory overflow.

Game with sound disabled works very fine.

DOOM RPG version: 1.8.94 OS: Windows 10

vadosnaprimer commented 4 years ago

Try other phone device options (don't remember how they are called).

recompileorg commented 4 years ago

This is probably my favorite mobile game. I started this project with the primary goal of being able to play this game on my television. In that process, I've torn this game apart, dissecting and analyzing more details about it that is reasonable. I have an article about some it here: http://www.neocomputer.org/projects/doomrpg

Sound is very strange in DoomRPG. IIRC, the sound effects are complicated MIDI files instead of the more obvious wav files. I can't image that they're saving any space that way! Java is notoriously bad at playing MIDI files, and I believe that is responsible for most of the pain here.

A few things to try:

Try version 1.0.92. It's still awful, but I haven't really noticed things getting worse as you play.

Try changing your default MIDI synth. VirtualMIDISynth seems popular. https://www.youtube.com/watch?v=4MZnZQO7rJk

If you're able, take a look at the code in src/org/recompile/mobile/PlatformPlayer.java starting at line 205. It's about as simple as I could manage, and I don't see anything obvious that would cause the issue, but there's no harm in looking at it.

Nokia64 commented 4 years ago

I have also experienced "lag spikes" when a MIDI sound begins to play under Windows, both under FreeJ2ME and KEmulator.

With KEmulator, when using the old JRE 1.4, that uses its own internal MIDI synth rather than passing MIDI to Windows one, there's no issues. When running the same KEmulator executable and game with the newer JRE 8, that passes MIDI to Windows synth, the game lags for half a second before playing a MIDI sound. Similar issues happen with FreeJ2ME, that performs a little better, though. Could not try with the older JRE 1.4 since FreeJ2ME requires JRE 8 or higher.

naviabbot commented 2 years ago

A lot of lag spikes happen with this game and supposedly many other ID Mobile games. John Carmack posted a workaround on his twitter account. Full thread here: https://twitter.com/id_aa_carmack/status/1395089205986988043

His workaround is using the switch -XX:+DisableExplicitGC on the command line or as a part of a batch file. It works.

vadosnaprimer commented 2 years ago

:( изображение

recompileorg commented 2 years ago

I read that as well. It might be worth following up with him.

recompileorg commented 2 years ago

I asked him on Twitter and he told me that they not only submitted a patch, but it was accepted. This must have been it:

https://github.com/hex007/freej2me/commit/c8312464fd06f0253d295682c56528a57686a645

So that's pretty neat.