Jump to content

Maximum preferred file size for HTML5 games?


away168
 Share

Recommended Posts

Hi guys,

I used to make HTML5 games with maximum of 5 MB file size, targeting for mobile devices. I never asked them how big it should be, though. Can someone tell me what's the most file size for a game they can accept right now? or it doesn't matter much?

I want to increase the quality of my games, so it affects the file size too, especially cause of the sounds (like... 900KB - 1MB per track for 64k bit rate, for each of my character's theme, and there are like 10 of them not including main and menu themes!).

 

Thanks a lot.

Link to comment
Share on other sites

You can use MOD/XM/S3M Music Modules to keep file sizes low and add lots of music to your game.

This was the way to do music back on the Amiga/Atari/C64 Games, when memory and game-size has to be very low. The cool thing is that if you write the mods yourself you can add multiple songs without using different sound samples - so you can put in hours of music in a few KB (depending on the sample size).

Have a look at for example:

https://github.com/jhalme/webaudio-mod-player

Link to comment
Share on other sites

You might want to consider that not all bytes take the same time to "load" (as in be-ready-to-use).  This varies based upon approaches and technologies used, but audio often needs to be natively processed on-load prior to it being available to play.  Loading an ogg or m4a will take both the time to load the bytes (a function of filesize, connection speed, cache) plus the time taken to process it (a function of codec, browser, device performance, memory availability).

Tempting as mods and trackers might be, the performance hit to a game at run-time is unlikely worth the saving in byte size offered by modern audio compression?  Same can be true of streaming audio where the run-time processing will not let up and becomes wasteful on second loop.

Also consider caching (both appcache and default approaches) - not all bytes are cached as equally effectively by default  Audio is often a special case here as well and generally doesn't cache well, if at all, on some popular browser device combos.

In summary it's not about always about how many MBs, it's about where those MBs are assigned, what type of game it is, who the expected audience is, and how they measure quality and value.

Link to comment
Share on other sites

@b10b Good point. I have never used mods in Javascript projects, but I'm wondering if the CPU impact is really that big. Remember: The Amiga had only 7MHz back then. I know it had custom chips but I think (haven't tested it) decoding MP3 or OGG is much more expensive than playing a few (pitched) samples at a given time.

Back in the FLASH days I wrote an MOD-Player which preprocessed the whole song before it starts playing. So you can preprocess it as AudioStream and you have the best of both worlds (You loose some realtime features of course - but it isn't a requirement most of the time).

In summary it's not about always about how many MBs, it's about where those MBs are assigned, what type of game it is, who the expected audience is, and how they measure quality and value.

Agree with you 100%. If the type of game requires lots of MB's a "Lazy Loading"-approach would be great.

Link to comment
Share on other sites

@Jochen mods are ace - I spent too many months of my life in screamtracker ;)  It'd be interesting to know for sure whether trackers can boost performance - the github mod project mentioned that performance varied significantly from browser to browser for example.  Good point on pre-processing to negate that issue.  From I have seen most mobile browsers don't really "play" OGG or M4A at runtime either, choosing to convert them to a raw format on load (and store it for later playback).  That pre-process strategy may have changed with advances in processors and memory?  Anyways, I hope to see mod make a comeback too - perhaps programmatically linked to the progress of the game?

Link to comment
Share on other sites

@Jochen

I have take a look at this mod, so I'm not very clear on what it is doing. Is that an 8 bit music making tool or something? Cause I already make some of mine using FL Studio with some instruments. I'm not really sure if I could import mine there, nor using that to make my music.

@b10b

Sorry I wasn't very clear about who are "they" in my post. I was asking about the total file size that should be delivered to the publisher. They usually have that requirement. I'm not willing to cut stuff when the game is done because I don't know about it.

I can't really say anything much how this audio can impact my game as I haven't finished making the game to test it, but this is new and nice info to me and I'd love to know more how an audio can impact my game performance.

In regards of the direct consumer, I think I wouldn't cache them all (initial loading) at first as the game size increases above 5 mb. I'd be doing the lazy loading approach as Jochen says, with a hope there are no timeouts during the game. If the memory usage is (still) low, I'd go for initial loading. That really depends on the game. I'm sure it won't affect CPU as well, since it should stay on the memory as long as I don't play it. I don't know about processing all of them at first, as that depends on the loading approach.

I also depend on default temporary cache for faster loading and not appcache, as appcache is already deprecated long ago, and it gave me a bit of headache when I used it before because of the versioning, even when it's as simple as updating the text file.

I'm not very clear on what you're trying to say, do you mean I should worry on after the audio is loaded, or the audio type itself may not be loaded due to issues that you explained? What do you mean by not all bytes are cached as equally effective by default?

My process is kind of simple so I'm still learning on how this audio my affect things. Back then (and what I know until now) My approach is, I just retrieve the audio from a remote URL (in this case... local URL) using my loader, cache them, wait for them to process until it's ready and use it. Is there something I miss?

I'm currently using Cocos Creator this time though (not making from scratch anymore), I hope I don't need to modify nor check to worry about these things.

Link to comment
Share on other sites

@Alectora Works sorry for not being clearer.  1) Some browsers process audio files once they are loaded (blocking).  2) Some browsers don't cache audio files.  I've yet to find a definitive independent resource that either explains these phenomena or lists which browsers do what, so my findings are based on observation and memory profiling from the limited range of devices I have (<12).  I observed that processing time was proportional to the duration of the audio, not the size of the file.  I also observed that once memory is exhausted then playing audio can dramatically reduce the performance of a game's framerate.  Preloading extra music files prior to launching a level seems like a valid solution to me (if it is combined with unloading the previous level's music).

Link to comment
Share on other sites

@AlectoraWorks No, you can't create it with software like Fruity Loops - it's a very limited format compared to FL, Logic, Cubase Files. No VST or Audio Units or something is supported. There a various free trackers available who can create/save/export MOD/XM Format, for example MadTracker and MilkyTracker (I'm sorry I'm not very up-to-date with the actual tracker scene).

  •  
Link to comment
Share on other sites

On 24. Oktober 2016 at 9:21 PM, b10b said:

@Jochen Anyways, I hope to see mod make a comeback too - perhaps programmatically linked to the progress of the game?

Yes - I always loved the MOD Format because you can do some great dynamic effects which are very hard to achieve with traditional streaming music (mute/unmute tracks, jump to patterns, increas/decrease speed, or even sync the gameplay to music-events...).

Link to comment
Share on other sites

23 hours ago, b10b said:

@Alectora Works sorry for not being clearer.  1) Some browsers process audio files once they are loaded (blocking).  2) Some browsers don't cache audio files.  I've yet to find a definitive independent resource that either explains these phenomena or lists which browsers do what, so my findings are based on observation and memory profiling from the limited range of devices I have (<12).  I observed that processing time was proportional to the duration of the audio, not the size of the file.  I also observed that once memory is exhausted then playing audio can dramatically reduce the performance of a game's framerate.  Preloading extra music files prior to launching a level seems like a valid solution to me (if it is combined with unloading the previous level's music).

Ah okay! Probably it's not noticeable for me cause back then I wasn't using too much audio, but I did have experience where my game's framerate drops like hell without knowing why. So I guess now I know what's the culprit. Will put this on my test list.

Ugh, I really can't help the part where the browsers don't cache audio files. It's probably cause the cache size isn't so big they'll keep cleaning it up, but grain of salt, I never really checked this, which goes to my test list as well.

I'd also check if the processing time blocks too long (too noticeable), then I'd go for initial loading. But if it's just a bit on my minimum device (like... less than 100 ~ 150 ms freeze time due to the processing), I think I'd let it go haha.

Thanks b10b that's so much helpful information for me. ;)

 

15 hours ago, Jochen said:

@AlectoraWorks No, you can't create it with software like Fruity Loops - it's a very limited format compared to FL, Logic, Cubase Files. No VST or Audio Units or something is supported. There a various free trackers available who can create/save/export MOD/XM Format, for example MadTracker and MilkyTracker (I'm sorry I'm not very up-to-date with the actual tracker scene).

  •  

Oh well, I heavily uses external instruments (VSTs). At least I have another choice if I find the game genre suitable, one day. Will save me some bytes to know this resourceful info. Thanks man. :D

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...