Making an arcade game run smoothly

Okay so I'm making a mario/ adventure game with sound (I'm using javax media). I'm having issues with my sound being smooth as well as graphics. I was wondering if their were any good reads on efficient game programming. When I started making the game it ran smoothly, but as I added a layer of sound, multiple interactive objects, teleports, animation, and backgrounds the program started to clip and such. Are they're any free programs out their that can graphically show how my program is using memory. Its just that the program clips and the music stops and seemingly random times. Also, Thanks.

[610 byte] By [WookieRebela] at [2007-10-2 13:20:37]
# 1

> sound being smooth as well as graphics. I was

> wondering if their were any good reads on efficient

> game programming. When I started making the game it

There are plenty but almost all these days have to do with programming 3D games

> Are they're any free programs out their that can

> n graphically show how my program is using memory.

JProbe

> Its just that the program clips and the music stops

> s and seemingly random times. Also, Thanks.

This is probably garbage collection happening. there isn't really a way around this in java. That's why most serious game developers don't use java to develop games.

tjacobs01a at 2007-7-13 10:55:53 > top of Java-index,Other Topics,Java Game Development...
# 2

I sort of doubt it's just auto gc. The reason is that the sound and graphics will "clip" when I'm just moving the world and not really destroying any objects. Mind you, when in battle the situation definetly doesn't improve. Is there a way to safely integrate sound with a fast moving arcarde game.

WookieRebela at 2007-7-13 10:55:53 > top of Java-index,Other Topics,Java Game Development...
# 3
Well, sorry I might sound like a dunce. Of course there is a way to safely integrate it. What I'm asking is if you guys have picked up on any tips or know what packages would suit this the best? Thanks.
WookieRebela at 2007-7-13 10:55:53 > top of Java-index,Other Topics,Java Game Development...
# 4

From the problems you said your expiriencing, it sounds to me like the following problems are in effect:

1. Your not using a back buffer. A back buffer will prevent screen flicker, but of course, a back buffer wouldn't relate to your sound problem.

2. Your not preloading your images. If you don't preload your images with a MediaTracker, than your images won't be loaded until they are drawn (either directly to the screen or on to a back buffer image). Preloading corrects most problems and also speeds up game play by at most 70% (according to my calculations). This can relate to your sound problem since loading an image generally halts your game.

3. Your not preloading your sounds. If you don't preload your sounds, you will have a delay before it plays the sound whenever you for example shoot a bullet. To correct this, use a try...catch statement to load your sounds (a try...catch statement alone won't preload your sounds!), then use:

sound.play(); sound.stop();

Best to do this while your images are preloading.

Best of luck,

Jamison

Jamisona at 2007-7-13 10:55:53 > top of Java-index,Other Topics,Java Game Development...