Lemmini: Speed issues and source code

Started by kyevan, July 01, 2008, 10:48:50 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

kyevan

Lemmini takes nearly 100% of my CPU time when running normaly, and the music is horribly choppy. Strangely, if I set it to fast forward, it's perfectly fine. The only thing I can think of is that it's useing loops for timing which is... not the right way to do things. At all.

Second, the Lemmini page claims that it is Free Software, but I can't seem to find the source code. It'd be nice to be able to fix these issues... since Lemmini is one of the better Lemmings engines currently available.

Mindless

Lemmini is free (gratis) software, though I would appreciate if it were free (libre) software as well.

kyevan

Oh. :(

So let's see. We have Lemmex, which is windows-only, Lemmini, which is nonfree and has some issues with its timer taking the entire CPU, and Tundra, which is written in rather messy python... joy. I suppose, unless we can get the source to Lemmini, fixing and extending Tundra is probably the best way to move forward... I've been meaning to really sit down and learn Python, anyway.

Edit: Oh, there's Lemmings DS, too, but that's, well, for the DS.

0xdeadbeef

As I already told you via EMail, the main reason for Lemmini not being open source is the fact that I never found the time to clean up the sources to a degree that I'd happily publish them.
Then again, I gave the source to several people already who asked me for it. So it's not really closed source either.

About that CPU load issue: Lemmini is pretty much optimized for a Java application. Then again, there is a price to pay for being platform independent and running a 256 color game in 32bit color mode. Should not be an issue for a PC of the last 4-5 years though.

Your guess about timing loops are mostly wrong. Indeed, Lemmini uses a (more or less sophisticated) mixture of sleep() and time loop, as sleep-instructions of less than 20ms don't work correctly on most OSes in Java and could even shift the system time under XP. Only on very low-end systems, were drawing the frame needs too long, the sleep() might never be executed. Even then, this alone would not cause the music to stutter, as it's played in a separate thread (true preemptive multitasking).

In an nutshell, you either have a really low end machine, or there are some other issues (drivers, very old version of JRE and so on).

On my AMD 64 X2 4200+ (which is pretty low-end nowadays), Lemmini uses about 33% CPU with music on and no frames skipped. I runs fluidly on much slower machines as well. The lowest end PC I ever tried it on was an old Athlon with 800MHz and and very little RAM (256MB). After setting the desktop to a 16bit color mode, it ran quite ok (a few frames skipped here and there, but music and sound ok).

kyevan

You hadn't told me when I posted this, and yes, things have been cleared up now.

As for the speed thing, switching to 16-bit color fixed it! I hadn't thought of that!

(I wonder if it could be avoided by converting the images and working in 32 bits?)

0xdeadbeef

Lemmini is converting all graphics to the best format for blitting it to the screen buffer. For a 32bit desktop, this is 32bit and for a 16bit desktop this is 16bit. There are some (very old) gfx card that are much slower for 32bit operations. Also for system with limited memory, storing all graphics data in 32bit format saves quite a bit of memory. In either case, it makes sense to switch the desktop to 16bit.
Depending whether the graphics card or the memory is the weakest point, one of these points or both might increase performance quite a bit.

Anyway, due to your complaints, I had a look at the Lemmini sources the first time in a while and even did some research on some specific timing problems with Java/win32. While this won't help you, I think I found some workaround to decrease CPU load on most machines since by reducing the minimum sleep times and increasing time measurement accuracy. Then again, this means I have to rise the minimum Java runtime to 1.5 - which shouldn't really be a problem in 2008. Also, unfortunately, I don't have any very low end systems to test any more.

So who wants to try out a test release, might do so:
http://lemmini.de/lemmini079.jar

kyevan

Probably graphics card - Yay for GeForce 5500 FX on the PCI bus? >_>

0xdeadbeef

Well, I experienced this problem with a Nvidia Riva (TNT?) card from the late 90s, so I'd guess everything from the GeForce range should do. Then again, the GeForce FX 5500 seems to be a card from 2005, so maybe it would make sense to buy a cheap card from 2007/2008. Not for Lemmini, but 3D stuff.
E.g. there is a Geforce 8500 GT (PCI) available from Sparkle for about 80ÇȮ

Just for the protocol: which gfx card and how much RAM do you have right now?

kyevan

GeForce 5500 FX as the graphics card, of course, and 512 megs ram. Running Windows XP.

Actually, that little graphics card has done me pretty well. Of course, it helps that of my favorites, the most graphicaly intensive games are Sims 2 and Guild Wars. It does pretty well on anything without shaders ;)