Algrig's Recent Forum Activity

  • Just look at the perfect audio handling on mobile devices in the second app--Rotary Phone at algrapps.com. I mean, trying it to do with simple <audio> tag is nearly impossible: mobile browsers refuse to work or freeze completely. It seems that Construct 2 is using Webaudio API and make sound work in mobile apps too.

  • Hi everybody,

    Would like to share with my original and functional web apps at algrapps.com, built with Construct 2. C2 is really awesome, perfect audio support for html5 web is worth to be mentioned separately.

    Thanks Scirra,

    Albert

  • (Sorry I had a mistake in previous post, now I have re-edited it, this is the correct version).

    Nice solution!

    I was looking for that a while ago and came to an alternative solution.

    It may be useful.

    If you do not minify the exported javascript code, you can just add a few lines in c2runtime.js file and it will only scale down and not up the specified size. Here is, how it works:

    You make the project, put the fullscreen mode to letterbox scale and export the project, without minifying the javascript.

    After the export, you should open the c2runtime.js and find the blocks of code, corresponding to letterbox scale. Usually they start with this:

    "

    if (mode >= 4)

         {

         var orig_aspect = this.original_width /

         this.original_height;

         var cur_aspect = w / h;

         if (cur_aspect > orig_aspect)

              {

    ...

    "

    Now, you find the following two blocks:

    1. " if (mode === 5)     // integer scaling

         {

         intscale = neww / this.original_width;

         if (intscale > 1)

              intscale = Math.floor(intscale);

         else if (intscale < 1)

              ...

         ...

         }

    2. if (mode === 5)     // integer scaling

         {

         intscale = newh / this.original_height;

         if (intscale > 1)

              intscale = Math.floor(intscale);

         else if (intscale < 1)

              ...

         ...

         }

    In both above-mentioned blocks, right after the closing bracket "}" and just above the blocks

    1. else

         {

              offx = (w - neww) / 2;

              w = neww;

         }

    2. else

         {

              offy = (h - newh) / 2;

              h = newh;

         }

    you should add the following block (the same thing in both cases):

    else if (w > CertainWidthValue && h > CertainHeightValue)

         {

              offx = (w - CertainWidthValue) / 2;

              offy = (h - CertainHeightValue) / 2;

              w = CertainWidthValue;

              h = CertainHeightValue;

         }

    So, the latter block appears twice in the script.

    Instead of CertainWidthValue and CertainHeightValue you can write in any desired values (e.g. the real size of the game), above which the project will not scale up, even if the window is enlarged. But be sure, to keep the original aspect ratio, when writing in the maximum width and height values for scaling up, in order not to distort the game.

    Save the file and you are done! Before testing, do not forget to clear the browser cache :)

    Have a nice day!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • ghost thank you so much for the reply!

    What I am now working on is not a standard game. It's more a bunch of special animations (layouts) of various sizes (300kb-8mb). When the user visits the website the starting layout is shown, where s/he can input some info and get a random animation for that day. The start layout itself is only 200kb, but should be visited daily to receive a random animation of the day. Animations are added and replaced in the project on a daily basis and I do not need the game to be playable offline.

    Now you see, it is senseless that the user download the whole 8+mb project each day, when re-visiting the web-site. Taking into consideration the 3g connection on mobile devices, it turns out 240+mb of traffic a month, which is rather expensive. That is why layout-by-layout loading is so much important for me.

    Anyway, your reply made me think on two aspects:

    1. If the project has been downloaded to cache, won't it be downloaded once more if the user visit the web-site the next day?

    2. If I add new layouts to the same project (c2runtime.js is changed), will the whole project be downloaded into cache or will only the updated elements be downloaded?

    Besides, I am currently working on a scheme of tying different projects through the use of iframes and Browser object JavaScript execution capability. Seems to be ok. I will post here, as soon as I have a workable solution (hope by the end of weekend).

    P. S. It is strange that in one of the C2 updates it was mentioned that layout-by-layout loading was working by default, if the browser supports WebGl. However, oddly, it is not the case with the Chrome, as my own tests has shown.

  • C2 is just fantastic for html5 games development. However, now I have been stuck to a problem. I am creating a multi-level (multi-layout) html5 game, with lots of different graphics on each layout and the player can choose which one to play.

    THE PROBLEM: Since it is an html5 game, I need to optimise bandwidth usage of the game (so that it is always small, to be easily played on 3g devices). So, I do not need all the layouts, together with their graphics, to be pre-loaded at the very start. However, in C2 it seems impossible, since all the layouts are loaded at start, hence, a lot of unnecessary traffic is used. Even, when I load sprites at run-time, the game still grows in size as events and layouts are added.

    THE DESIRED SOLUTION: Is there any way to tell the project to do a layout-by-layout loading. So that the traffic is used and the layout loaded, only when player has chosen the corresponding layout. I just do need it for html5, not for CocoonJS or so on.

    ALTERNATIVE SOLUTION: Is there any way to call another project(game) within a project, without reloading the page. So that I could have created separate games (instead of separate layouts) and each game is loaded, when called within the main choice menu layout, which is a separate project by itself.

    Thanks a lot!

Algrig's avatar

Algrig

Member since 24 Aug, 2013

None one is following Algrig yet!

Trophy Case

  • 11-Year Club
  • Email Verified

Progress

12/44
How to earn trophies