Castle Trouble

Hi

I’m proud to present you the first “real” game of Fishbros, its name is “Castle Trouble”.

It has been created with our 2d library (Pyro2D) and it’s pure 100% Java.

It’s only an alpha versione but I hope you’ll enjoy it.

Any comment, suggestion or bug report is well accepted :slight_smile:

It can be found on our home page in the games section…

http://www.fish-bros.it

http://www.fish-bros.it/castletrouble.png


Tested on Mozilla 1.3, Explorer 6 and Opera 7.10.

Tested successfully on:

P4 (1.7Ghz,512Mb RAM, GeForce4MX)
P4 (1.8Ghz,384Mb RAM, Intel Extreme)
Acer Laptop (Celeron 650Mhz, 192Mb RAM, ATI Rage mobility)
Celeron (900Mhz, 256Mb RAM, GeForce2MX)
K7 (800Mhz, 256Mb RAM, GeForce2MX)

… sadly only with WinXP.

Here are some features:

  • 12 test levels
  • Two players on the same computer
  • 640x480 screen size
  • Less than 100 colors in in-game sections, and runtime calculated tile shadows to reduce download time
  • Pure 100% Java (including the timer =) )
  • Online playable
  • So far only 185Kb

To do:

  • More levels
  • Harry up mode
  • More and better sounds
  • Intro and ingame music
  • Customizable controls
  • Server side highscore list
  • Calibrate levels’ difficulty
  • Loading text during level change

To fix:

  • On Opera 7.10 key events are not catch (strange!)
  • When cpu load is high (at game startup) the timer is inizialized wrong.
  • Audio libray sometimes gives very high latency (JavaSound isn’t solid as it should be)

Suggestions:

  • Controls appear in the bottom of select screen
  • Please wait when level changes!

That is really good!

The levels are a bit too easy, but for an alpha it’s very good. =)

The graphics are perfect.

Looks excellent (haven’t played it yet coz I use Opera). Your website is really crisp as well. Top job.

Cas :slight_smile:

  1. Tested on Suse 8.2 with Java 1.4.2 works great :slight_smile:
  2. What are you using as timer?

Nice looking game!

It runs fine with one exception, the game freezes for half a second when a sound effect is played.

Ran it on an athlon 2.0ghz , winxp, jdk1.4.2 and with a motherboard soundchip (abit motherboard)

runs extremely slow on my box :frowning:

p4 @ 2.7 & Radeon 9700 np (!)

getting ~ 9 FPS

Broken on Mac OS X.

Transparent areas of sprites - aren’t. I see a cyan background on everything that was supposed to have transparent areas.

Then it crashed Safari when I tried to move the critter.

I have seen the transparency problem on OS X in fullscreen mode… but usually applets work fine.

Be sure to preserve the alpha channel in your sprites when you load them if you are moving them to managed images.
It seems that the default alpha channel for a new image may be 0 for Windows and 0xff for Mac? Is this specified by the Java spec? (i.e. is it a Mac bug?)

[quote]Your website is really crisp as well. Top job.
[/quote]
The website layout is broken on Safari. There are gaps between images where there should not be any.
Mozilla Firebird has the same problem.
:frowning:

Yeah…

The site has not been tested with Mozilla. Sorry!
We are working on it.

We are working also on the bugs…

Matzon, can you give me more infos about your PC?
You should press F10 during game, it will show some
tech info. They could be useful to fix that bug.
Another useful thing could be the game log taken from the Java console.

For transparency I don’t know what to say…
I simply load images using this routine:


URLClassLoader urlLoader = (URLClassLoader)getClass().getClassLoader();
URL fileLoc = urlLoader.findResource(basePath + name + EXT);
                  
img = tk.createImage(fileLoc);

As you can see I don’t alter the images in any way.
I’ve already eard about different default transparency attribute on Windows and Mac OS, but I really don’t know much about it.

Maybe I’ve a solution for the sound problem…

The timer adapts itself to the OS timer resolution, and use it as a “beat”. All the game logic use that resolution to regulate its speed.

Many thanks for the help

'splodes mightily on the latest version of OSX Panther. I’ve sent a report to Apple about it.

What format are the images? GIF or PNG?
What is the pixel format of your back buffer?

works great on my athlon 1800, Windows XP.

Great game, very professional !

F10:
fps: 6
tmer res: 32
speed: 1.2
entities: 8

[quote][] – Debug Level = 1

[] App: Initialized

[] Loader : Loading classes

[] App: Input handler initialized

[] App.init() Running online

[] Game.constructor() Game created

[] App.start() started

[] App.start() buffer[0] is true Volatile!

[] App.start() buffer[0] is true Accelerated!

[] App.start() buffer[1] is true Volatile!

[] App.start() buffer[1] is true Accelerated!

[] App.start() buffer[2] is true Volatile!

[] App.start() buffer[2] is true Accelerated!

[] Game.init() Game initialized

[] Game.init() Loading DATA…
.
.
.
[] App.run() Main loop started.

[] App.run() real Timer res : 16

[] App.run() real Game fps : 31

[] App.run() fixed Timer res : 32

[] App.run() Game fps : 25
.
.
.
[] -> FPS: 1

[] -> FPS: 5

[] -> FPS: 6

[] -> FPS: 6

[] -> FPS: 6

[] RealFPS: 6 speed: 0.8064516
.
.
.
[/quote]

Hi

Thank you for site comments, now it WORKS as it should also on Mozilla 1.3, incredible the problem was caused only by the first line of HTML code! The doc-type, this is the fix:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">

Now I’m working on the game…

Soon I’ll upload alpha 2 (and I’ll reply all questions!).

java.lang.NoSuchFieldError: BLACK
at fishbros.pyro.Loader.init(fishbros/pyro/Loader)
at sun.applet.AppletPanel.run(AppletPanel.java:339)
at sun.plugin.navig.motif.MotifAppletViewer.maf_run(MotifAppletViewer.java:119)
at sun.plugin.navig.motif.MotifAppletViewer.run(MotifAppletViewer.java:115)
at java.lang.Thread.run(Thread.java:479) :frowning:

Hi

I’ve tried to solve audio problem (Maybe DrBizzar0 will tell its OK), eliminating suspended sounds queque.

Eliminated a stupid third back buffer.

To swpalmer: That’s the way I create backBuffers, I don’t know what’s their format because they respect the desktop format:


GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice gs=ge.getDefaultScreenDevice();
gc=gs.getDefaultConfiguration();
            
int i=0;
            
while(i<numBackBuffers){
      backBuffer[i] = gc.createCompatibleVolatileImage(width,height);
      ImageCapabilities iCap=backBuffer[i].getCapabilities();
                  
      if(iCap.isTrueVolatile()) Debug.print("App.start() buffer[" + i + "] is true Volatile!",1);
      if(iCap.isAccelerated()) Debug.print("App.start() buffer[" + i + "] is true Accelerated!",1);
                  
      if(backBuffer[i]==null){
            Debug.err("! App.start() cannot create backBuffer as VolatileImage!");
            return;
      }
      i++;
}

The graphics are all in 8bit PNG with one bit transparency. Maybe the “mask/transparency” problem on Mac happens only with 8bit pics and not with 24 or 32bit ones?
Can you give me a screenshot (not necessarily full size) of the game in action?

The problem posted by Matzon is probably related with the timer (it detects the right resolution, and the FPS but cannot run the game smooth).
I’ve tried to fix it by selecting at runtime another timer function. Maybe it’s a hopeless try.

Inserted loading text between levels.

I’ve created my timer starting from the ORIGINAL idea of jbanes, that’s the topic:
http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=share;action=display;num=1048008212

My timer also select the number of ticks per second to make the game run for example at 50FPS instead of 100 on a computer with 10ms of timer resolution, or at 32FPS instead of 64. This to prevent CPU overload.

[quote]java.lang.NoSuchFieldError: BLACK
at fishbros.pyro.Loader.init(fishbros/pyro/Loader)
at sun.applet.AppletPanel.run(AppletPanel.java:339)
at sun.plugin.navig.motif.MotifAppletViewer.maf_run(MotifAppletViewer.java:119)
at sun.plugin.navig.motif.MotifAppletViewer.run(MotifAppletViewer.java:115)
at java.lang.Thread.run(Thread.java:479) :frowning:
[/quote]
I’ve patched it…
It should work now.

Thanks.

[quote]I’ve created my timer starting from the ORIGINAL idea of jbanes, that’s the topic:
http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=share;action=display;num=1048008212
[/quote]
I should probably clarify something. The timer concept did not change when it became GAGETimer. The only thing that has changed is the addition of a hi-res timer for Windows. This was added because games require that sort of precision, not because it was a “cool idea”. Using GAGETimer without the DLL will revert it back into its pre-GAGE state, but your game will not be able to time more than 20FPS on Windows 9x machines.

[quote]My timer also select the number of ticks per second to make the game run for example at 50FPS instead of 100 on a computer with 10ms of timer resolution, or at 32FPS instead of 64. This to prevent CPU overload.
[/quote]
Can you explain what you mean by this? Keeping time is a hardware task and should never strain the CPU. There has been some discussion on the use of AdvancedTimer.sleepUntil() since it uses Thread.yield() for as acurate of timing as possible. It won’t actually overload the CPU tho, as the call simply tells other programs to do something while we’re waiting.

BTW, the game looks nice. When do I get to play it on my new iBook? :wink: ;D

I’ve only taken the “timer idea” (explained in your first post on that topic), because I’m not really interested in native solutions.
I know that a native timer is more accurate and that it don’t gives problems on different Window versions, but my library is “online oriented” and so I cannot use any DLL.

I don’t understand why Sun has not yet added a real timer (like the one packaged with Java3D) to Java2D.
In teory THEY could make a native timer for every platform! :-/

[quote]Can you explain what you mean by this? Keeping time is a hardware task and should never strain the CPU. There has been some discussion on the use of AdvancedTimer.sleepUntil() since it uses Thread.yield() for as acurate of timing as possible. It won’t actually overload the CPU tho, as the call simply tells other programs to do something while we’re waiting.
[/quote]
I was not so clear.
The problem I’ve tried to solve happens when a computer has an “accurate” timer and its resolution (for example 15ms) forces the game to run above 50fps.
In that case I simply wait two beats in order to make the game run at half the framerate possible.
This to prevent the game from running at 100FPS (maybe too many for some computers) when it only needs 25FPS.

Nothing special ::slight_smile:

Doesn’t it run on iBook?

Sun has added a new Timer at sun.misc.Perf with 1.4.2, but that is not the postition it will stay, it is hidden there because officially the .2 is only allowed to have bug fixes, new features only in 1.5 …