ID:152006
 
I am creating a game that WILL need compact coding.
A single player RPG with a storyline that will require tons of coding. Thus i must compact the file so it doesn't take 50000000000 years to load.
Is an MP3 a good playable BYOND file?
First of all, "compacting coding" does absolutely nothing except hinder the readability of your code. It's not going to save space or improve load times or improve compile times or ANYTHING desirable.

Next, if you require a lot of text, you might be better off offloading it all into a textfile and then reading from that, instead of hardcoding it into the game.

Finally, no, MP3 will not play properly on BYOND. See: http://www.byond.com/docs/ref/info.html#/DM/sound
Unless you're making a game for the 4k contest or (possibly, if it ever returns and you want your game to have a lot of stuff) the 8k contest, there is no need at all to have compact code. You're better off learning more efficient programming practicese, as well as figuring out how to use inheritance and other aspects of OOP better.
Choka wrote:
I am creating a game that WILL need compact coding.
A single player RPG with a storyline that will require tons of coding. Thus i must compact the file so it doesn't take 50000000000 years to load.
Is an MP3 a good playable BYOND file?

As said previously, you can not use MP3s. Correct me if I am wrong, but I believe .OGG will be the best to use as it takes up less space.
In response to 172.16.0.1
More info courtesy of Lummox JR and more.

Also, OP - remember there are some more things you can do to ensure a lower game file size; there are other resources other than sounds.
In response to Garthor
Okay thanks.
Choka wrote:
Is an MP3 a good playable BYOND file?

Playable? Yes, you can play MP3 files on BYOND.
Good? No, because it's too big. Most players will likely abort the download and NOT play your game if they see the resource file contains 47 MB of MP3 files.

Module (MOD) files are the way to go. Try http://www.modarchive.org

-- Data
In response to Android Data
Android Data wrote:
Playable? Yes, you can play MP3 files on BYOND.

Not really, at least not via the built-in methods. MP3 is unsupported by BYOND.
Choka wrote:
I am creating a game that WILL need compact coding.
A single player RPG with a storyline that will require tons of coding. Thus i must compact the file so it doesn't take 50000000000 years to load.

Loading times are influenced far more by resources than code. Compacting your code will do nothing to prevent slow loading for players, because only the resource download affects them.

Typically, the resources that take the most space are sounds and images. For images, make sure you're not using .bmp files for anything--always use .png, .gif, .jpg, or regular .dmi icons. (For most purposes .jpg is probably not that useful here because it only performs well for photographic images.)

For sound, either take your .wav files down in bitrate and depth, or convert them to .ogg. If you have a sound effect that doesn't use upper frequencies much then you can probably easily make it 8-bit 11025 Hz mono instead of 16-bit 44.1 KHz stereo, a savings of 87.5%. But mostly I'd go with .ogg.

For music, never under any circumstances use .wav. I wouldn't even use an .ogg-encoded .wav. Use a module format like .mod, .s3m, .it, .xm, or if you have an .xm file you can encode it with a program called oggmod to produce an .oxm (.xm with .ogg-compressed samples). Module music has the flexibility of MIDI in that you can produce a long song without adding to the file size much at all, but it sounds better because the samples are included. I would however pick modules with smaller samples and fewer of them.

Is an MP3 a good playable BYOND file?

No; BYOND does not play .mp3 files, primarily due to licensing issues with the sound engine. It does play .ogg files which are similar (a lossy compressed format for raw audio, with similar compression) but your best performance for music will come from module formats.

A 3-minute song in .mp3 with a decent bitrate is about 3 MB. Using .ogg will likely get you pretty similar results. Many module songs are under a megabyte and some are drastically less (especially if your game has a retro feel and you're looking for NES-style "chiptune" mods, which have smaller samples), but their file size is almost totally unrelated to song length so some modules are upwards of 20 minutes or more.

Lummox JR
In response to Lummox JR
Kaioken wrote:
Not really, at least not via the built-in methods. MP3 is unsupported by BYOND.

Lummox JR wrote:
No; BYOND does not play .mp3 files, primarily due to
licensing issues with the sound engine.

Actually, BYOND is capable of playing MP3 files.
fcopy("myfile.mp3", "myfile.ogg") //better to include this with the .ogg extension in the first place
recp << sound(file("myfile.ogg"))


BYOND only checks the extension; if you rename a .mp3 to .ogg it will play it, even though it's an MP3 file.

-- Data
In response to Lummox JR
Lummox JR wrote:

... your best performance for music will come from module formats.

I've wanted to look into this mod stuff, but could never find any useful information about actually creating music. Just mods of stuff others have created, or mod players or articles on the benefits of mod files in games.

What, exactly, do you need to make an xm or mod music file? What composing software is available, or is it all scripts you have to code yourself? Where should n00bs like myself go to learn how to create mod music?
In response to Xooxer
There are several tracker programs you can use for this: FastTracker 2, MadTracker, ModPlug Tracker, Impulse Tracker, Scream Tracker, and probably lots of others I've never heard of. Getting hold of samples usually means finding them in a library of sounds or ripping them from other modules (mod artists do this all the time).

All of the mod formats support different effect codes, so when tracking you should use a reference as to what they are. Some are for volume, panning, etc., and some also control looping.

Lummox JR
In response to Android Data
Android Data wrote:
Actually, BYOND is capable of playing MP3 files.

No, this doesn't work for me. Perhaps you're not using an actual MP3 file?

BYOND only checks the extension; if you rename a .mp3 to .ogg it will play it, even though it's an MP3 file.

You realize you don't make sense here, right? It's not going to play it if it thinks it's an OGG file. They're different formats, it just wouldn't work. But in reality, actual file format info isn't present in the extension, but in the file itself; decent players will allow you to play even files with improper extensions (this might be why you think you have a genuine MPEG-3 audio file) or with no extension. FMod also has this functionality, so you're wrong in saying it only checks the extension; you can play an extensionless file in it as well, but not if it's encoded in MP3 format.
In response to Kaioken
Kaioken wrote:
You realize you don't make sense here, right?

I realize it doesn't make sense, but that's how I remember having done it before -- by renaming the extension.

I tested it again, and it no longer works. Hm.

-- Data
In response to Android Data
Maybe you really had used a renamed mp3 that was originally a BYOND-supported format when testing this previously. On the internet, you technically can't know such things for sure (unless you verify) when you download stuff, even if the site claims it is an mp3.
In response to Kaioken
I've done this before too. Some of the sound files used in Solar Conquest, which are actually called OGG files, were actually MP3 files when I downloaded them. I just renamed them and it worked. Don't know why and didn't care to ask.