I'm working on my first official Java game. The smallest I can make my whole game is about 400 MB. It seems that most of the space is taken up by the sounds (WAV) which is about 300 MB altogether.

It's a 2D game based off of the Modern Warfare 2 multiplayer. It consists of a lot of sounds and sprites. Does this sound like an unusually large size for a game like this or should I not worry about it?

First, if you can, use something like MP3s instead of WAVs, that will save a ridiculous amount of space.Might need to investigate a mp3 loader or library for it, but it would be worth the investment.

EDIT: Kinda ninja'd, but yeah, WAV is totally uncompressed, and MP3 is pretty well compressed, and still sounds fine to most ppl down to about 192 Kbps or so

In regards to an mp3 loader, just use libgdx; it works quite well.

But if he's not using libGDX, then what would be the point? He would have to include the library in his jar file which would greatly increase the file size. Just write your own loader, you'll learn more in the process.

First, if you can, use something like MP3s instead of WAVs, that will save a ridiculous amount of space.Might need to investigate a mp3 loader or library for it, but it would be worth the investment.

EDIT: Kinda ninja'd, but yeah, WAV is totally uncompressed, and MP3 is pretty well compressed, and still sounds fine to most ppl down to about 192 Kbps or so

In regards to an mp3 loader, just use libgdx; it works quite well.

Yea, well if he went LibGDX for sound then he would probably want to use it for the rest of the game (I'm still assuming he isn't already), and while it might improve performance etc, that's pretty much premature optimization and would greatly increase development time, and I find that completely changing the way you do things in the middle of a project is not the way to stay focused and get it done.

WAV files are huge. I would recommend converting your sound files over to a different format like MP3 because they are much smaller. Also, why do you have almost a thousand sound files?

There's a lot of things that can go on at once in this game. Shooting, explosions, helicopters making noise, etc.

But anyhow thanks for the answers so far guys. I know WAV files can be very big but I decided to use them because I preferred to avoid using 3rd party libraries. But I guess I'll have to suck it up. I'll look into using MP3s or OGGs instead.

I'm wondering why your sprites take up 100MB. That seems too high.Judging from your screenshot I would guess that your sprites should not use more than a few MB in total.Can you upload a few of your biggest sprites? Maybe we can see why they are too big.

I'm wondering why your sprites take up 100MB. That seems too high.Judging from your screenshot I would guess that your sprites should not use more than a few MB in total.Can you upload a few of your biggest sprites? Maybe we can see why they are too big.

I just realized that I left all the Photoshop copies of all my sprites inside the sprite folder. After removing all of them, it drops the size of the sprites folder to about 18.7 MB

Sorry for the confusion on that. Is that still large? Do you still want to see some of my sprites?

I'll second (or more like fourth or fifth at this point) using ogg. Even the AAA studios like Blizzard use it. As for your sprites, store them as PNG and run them through OptiPNG and they should become quite a bit smaller.

// Put this at the start of your rendering. No need to use every single one.g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);g.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE);g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);g.setRenderingHint(RenderingHints.KEY_TEXT_LCD_CONTRAST, Integer.valueOf(100));g.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);g.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);g.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);

I'd have to agree with Arnaud. You'd probably get a lot more bang for the buck by using a relatively small pool of sounds and applying blending/audio processing to get variation. A single "footsteps" sound effect could have reverb added to or a low pass filter to simulate walking in large cavernous spaces, or a grassy field respectively for instance. DSP may be a bit more complex, but it can potentially save you a lot of space in your final product.

Arthur: Are all men from the future loud-mouthed braggarts?Ash: Nope. Just me baby...Just me.

Generally you would use WAV files for short sounds (Special FX) and Mp3 or other compressed format for music and large sounds.

I've heard that, but I always wonder, why? Is it loading times? I have several theories on this, but I want to know other people's opinions on this, as I am wondering if I am doing something genuinely 'wrong.'

I think it's for ease of processing since you don't have to unpack/decode the data on the fly. I would imagine many sound libraries would store the data in memory in an unpacked format for this reason. Just my $0.02.

Arthur: Are all men from the future loud-mouthed braggarts?Ash: Nope. Just me baby...Just me.

I think it's for ease of processing since you don't have to unpack/decode the data on the fly. I would imagine many sound libraries would store the data in memory in an unpacked format for this reason. Just my $0.02.

That is a reason I've considered, but also, all sounds loaded into memory are in an uncompressed (raw) format. Only files streamed from the HDD avoid this (and only partly, as they must be decoded in as the stream comes in), which is what you try to do for long sounds, like background music, to avoid using hundreds of MB's.But surely the processing time required to decode many small mp3's or such is small compared to other concerns?

But surely the processing time required to decode many small mp3's or such is small compared to other concerns?

Indeed. Although I've seen people use .wav files for sound FX, I can't say I've really seen many people advocate using it outside of beginners tutorials. Maybe it's just traditional to suggest them since they were pretty ubiquitous back in the early days of game development before we had accessible and affordable/free compression technologies. It seems like rather dated advice to me, but there may be other reasons that I'm not aware of. I'd be interested to hear other's take on it as well.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org