[java] URGENT - Major Applet issue

Started by
5 comments, last by tjbrosna 23 years, 4 months ago
I have developed a java applet game. However their is some major performace issues. The game is intended to run on browsers so I have only used jdk1.1.x.The game speed is really inconsistent. I need ideas to why as this is going out on a demo cd in a day or 2. It can run fine one machine(fps 20 - 30) and then on another machine with the same spec really slow(fps ~5).Put it this way, on a PI 133 it runs along fine and on a Athlon 800 with a Radeon 256 DDR it runs terrible so it cant be the machine, it must be the java runtime environment, virtual machine etc. Has anyone got any ideas to what I can do, where I can look for help or any suggestions at all?? Thanks for your help, T.J
Advertisement
The problem may come from the browsers on the two machines as the specs show they are radically different, and that means the amount of installed software will differ so the best idea is to run the game in Applet viewer on both machines and see how they compare (no slow down from the parent browser).

I get a lot of slow down from my OS whilst using the keyboard due to the key repeat fired from the OS when you hold a key down, apprently this has a major effect on java games running on Posix based machines more than Windows/MacOS.

Well good bug hunting other wise



Phillip Stiby BSc(HONS)

I program therefore cant spell!
StibyI program therefore cant spell!
Here are some things to look for.

1) See if the slowdown is linked to any particular color depth. 8 bit and 32 bit seem to work alot better than 16 bit displays.

2) If you relly need consistancy, consited using the java plug-in. At least then you can be guanteed that you will be using the sun jdk.

3) If you go with the plug-in consiter using the new BufferdImage in Java 1.2 in place of Image, as I have consiterable improvments in performace using this insted.

4) Make sure your drawing code is happening independant of other activity.

Otherwise just overall bug hunting. Make sure when testing to run it under netscape, appletviewer, and MSIE if you opt not to use the plug-in.

Without looking at the source there''s not alot more I can do.
Changing the color depth dosent do anything. It runs fine under jdk1.2.2 and jdk1.3 appletviewers. If i open up jbuilder in the background(doing nothing, so it must change the jre) the game runs fine in the netscape and MSIE. This game loads in a load of images approx 50 gifs and 5 jpgs. Could this make a difference(I doubt it)??

Seeing the code is not an option as its way too big but heres a stripped down version of the main game loop:

//-------------------------------------------//
public void run()
{
while(Thread.currentThread() == gameThread)
{
switch(gameStatus)
{
case PLAYING:
{
if (zombieLevelRef.isFinished())
{
if(currentLevel == 2)
{
setEnding();
gameStatus = ENDING;
}
else
gameStatus = CHANGING_LEVEL;
break;
}
zombieLevelRef.play(offScrGC);
break;
}

// Loads of other case to handle other game states
//....
}
repaint();
try
{
Thread.sleep(20);
}
catch(InterruptedException e)
{}
}
}

Thanks again,
T.J

So I don''t understand.... where are you having low framerate problems?
The applet size is 800x600 which is probably why the frame rate is so slow.The player area is 800x400 and the interface is 800x200. So does anyone think this is the problem??

T.J
Make sure you have JIT enabled in the browser and that the java-console isn''t on Just to make sure..



''''2+2=5 for extremely large values of 2.''''
- Fovster

This topic is closed to new replies.

Advertisement