Why is a blank project 106k?

Discussion and feedback on Construct 2

Post » Wed Jun 11, 2014 6:46 am

Hello,

I am working on a project that needs to be as small as possible. However, its a bit disturbing that before I even start a project in Construct 2 a blank project is already 110k runtime.js. when I have a limit of around 250k. Anyway possible to strip the runtime down to the bare bones?
Last edited by DrathVader on Wed Jun 11, 2014 4:15 pm, edited 1 time in total.
B
14
S
2
Posts: 67
Reputation: 2,044

Post » Wed Jun 11, 2014 11:14 am

No, that is the already stripped down bare bones runtime. It's not actually that big, since jQuery (a JS library used on a huge number of web pages) is about 95kb when minified. On top of that most modern servers will send it over the network compressed, which will reduce the "empty" C2 script size from about 106kb to 35kb from a quick measurement.

Who or what is imposing a 250kb limit, why is the limit imposed, and does it apply before or after compression? It makes very little sense since a single image or music clip from the game could easily dwarf that.
Scirra Founder
B
398
S
236
G
88
Posts: 24,441
Reputation: 194,661

Post » Wed Jun 11, 2014 4:11 pm

Hey Ashley,

My restrictions are for a mobile network of 3g or less. The 250k restriction includes images and runtime. I turn the images that I can to jpg and use my own png compression. In my case the unit needs to load instantly without preloaders so every kb counts. In the past I always break the 250k limit it is just frowned upon. Right now I am 30% done with my project and my runtime is already 180k "minified". Are we able to draw shapes with CSS in Construct2? Do you have any advice on what practices I should follow to keep my runtime to a minimum? What events/actions/behaviors cost a lot? For example, Is the behavior LiteTween more efficient than EaseTween behavior?


EDIT: Was on the train before when I commented so I missed some things. Are you saying, the 106k for example polite loads over the network so in a way the initial load time is more like 30k(ish) when pulled from the server? Also, a blank document is 367k uncompressed and 106k compressed.
B
14
S
2
Posts: 67
Reputation: 2,044

Post » Wed Jun 11, 2014 4:46 pm

A 500kb game should load in 20 seconds on a decent 3G signal. The average size of the top 1000 websites is apparently 1.2mb. Whoever is imposing a 250kb restriction is asking you to produce a working game in about one fifth the size of the average website, which is a very unusual limitation to put in place. Either way the compressed script is only 35kb so represents only 14% of your budget.

We are not designing a game engine for such extreme requirements. It should be obvious that a game is going to be a fair bit larger than a website. Perhaps you need to hand-code the game to meet such stringent limits.

FWIW C2 does not use CSS at all (all canvas-based), and I am doubtful your own PNG compression can beat what Construct 2 already does - be sure to double check you're actually reducing sizes and not using a less optimised tool that is producing larger PNGs.
Scirra Founder
B
398
S
236
G
88
Posts: 24,441
Reputation: 194,661

Post » Wed Jun 11, 2014 5:07 pm

Think of this as more of an interactive unit and not a game. The Interactive unit I am building needs a load time of 1-3 seconds on a 3g netwrok. I agree, hand coding this would be more file size efficient and in most cases I would. However I really enjoy the workflow in construct 2 and it solves some problems that would otherwise be time consuming to code by hand. I would like to give CS2 a chance to be a tool I use daily.

The PNG tools I use get the filesize much much lower. The reason is the unit is in retina so I am able to push the PNG compression further than normal and end up with a clean result. I also compress each PNG individually "by hand" so some are more compressed than others as apposed to everything compressed the same . Flat images turned into compressed JPG's rather than PNG I save even more resources than what is exported via construct 2. However what I am saying is, I take the files exported from Construct 2 and compress them again via 3 other stages. Sounds like I will just see what happens, I broke the resource restrictions in the past I will just break them again. lol Thanks for the feedback, thanks for the great product :)
B
14
S
2
Posts: 67
Reputation: 2,044

Post » Wed Jun 11, 2014 8:51 pm

On 3G it can take 3 seconds to just establish a connection. I cannot understand at all why such restrictions would be put in place. Who is this for and why does it need to be so extraordinarily responsive even over a patchy radio link?
Scirra Founder
B
398
S
236
G
88
Posts: 24,441
Reputation: 194,661

Post » Wed Jun 11, 2014 9:07 pm

Sorry, I can not disclose the project or the client. The interactive unit runs at the same time of "another" unit that is very resource hungry. I should be fine, like I said I have gone over that limit before. If It was up to me I would just use a pre-loader. Which, may be something I will use if it gets much larger. Lots to add yet, so I assume it will be over.
B
14
S
2
Posts: 67
Reputation: 2,044

Post » Fri Jun 13, 2014 5:06 pm

Ashley wrote:On 3G it can take 3 seconds to just establish a connection. I cannot understand at all why such restrictions would be put in place. Who is this for and why does it need to be so extraordinarily responsive even over a patchy radio link?

Maybe he's trying to code an interactive banner-game? Trying to fit a game into an ad?

That's the only reason I can think of for such restrictions.
B
36
S
8
G
8
Posts: 532
Reputation: 6,903

Post » Fri Jun 13, 2014 5:12 pm

Fimbul wrote:
Ashley wrote:On 3G it can take 3 seconds to just establish a connection. I cannot understand at all why such restrictions would be put in place. Who is this for and why does it need to be so extraordinarily responsive even over a patchy radio link?

Maybe he's trying to code an interactive banner-game? Trying to fit a game into an ad?

That's the only reason I can think of for such restrictions.


Bingo :) If you ask me its a bit large for this purpose. Lots of dynamic content and server data. And It cant slow down the native platform.
If it was any other case, 250-500k is nothing. I hope I get to use my Business License more often. I really enjoy Construct 2 especially enjoy seeing it consistently evolve.
B
14
S
2
Posts: 67
Reputation: 2,044

Post » Fri Jun 13, 2014 5:21 pm

I had another look at an empty project: I think your measurements are wrong because you count the icon files, which are not loaded by default. The server can also be set up to send everything zipped (very likely this is already the default). jQuery can be set to load from a remote CDN instead of using a local copy, in which case it is very likely already cached and will not need to be downloaded again. The latest betas also add a web app manifest, which you can remove to shave off a few extra kb (and guarantee the browser doesn't load the icons) - just remove the <link rel="manifest" ...> line from index.html. Then you can replace loading-logo.png with a far simpler image (use something simple with solid colors and no gradients) which should only take up a couple of kb.

Based on all of the above, an empty project comes out as 37-38kb for me. Not bad for such a feature-rich framework!
Scirra Founder
B
398
S
236
G
88
Posts: 24,441
Reputation: 194,661

Next

Return to Construct 2 General

Who is online

Users browsing this forum: olympo and 13 guests