freej2me icon indicating copy to clipboard operation
freej2me copied to clipboard

DOOM RPG gets very slow with sounds

Open coldner opened this issue 5 years ago • 7 comments

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

coldner avatar Aug 20 '20 10:08 coldner

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

vadosnaprimer avatar Aug 20 '20 14:08 vadosnaprimer

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.

recompileorg avatar Aug 20 '20 20:08 recompileorg

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.

Nokia64 avatar Aug 23 '20 21:08 Nokia64

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.

naviabbot avatar Jun 12 '22 13:06 naviabbot

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

vadosnaprimer avatar Jun 12 '22 13:06 vadosnaprimer

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

recompileorg avatar Jun 12 '22 18:06 recompileorg

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.

recompileorg avatar Jun 12 '22 22:06 recompileorg