Suggestion for the benefit of programmers

0 favourites
  • 8 posts
  • After months I'm sold. Completely, to the point I'm investing a lot of time and resources to develop with construct2 which is bar none the best engine for html5, the problem is that is not programmer friendly. The problem is testing. Testing on iOS requires: "compiling"->transferring files to a mac->importing into xcode->compiling->testing same thing goes for Android (minus the mac part).

    If you are doing a complex app, the phonegap build service is a joke, there are too many functions that you are missing (ads, push notifications and so on) all thing that with callJS you can do.

    The problem though is that callJS cannot access the c2 code directly, relying on a hackish method of doing eval on the function.

    Now take this code:

    function showConfirm() {

        navigator.notification.confirm(

            'You are the winner!', // message

            function(button){return button;},              // callback to invoke with index of button pressed

            'Game Over',            // title

            'Restart,Exit'          // buttonLabels

        );

    }

    This is a phoneGap notification, the result cannot be read though eval. To read it I had to make the function set a global var outside c2 and the read it again with another callJS function, this took a lot of time as testing it required all the previously detailed steps. More than this callJS doesn't work in preview mode for the reasons detailed here: scirra.com/forum/localpreview-where-are-the-assets_topic50738.html

    As I see there are two implementation that you could do:

    1) Local preview that reads ALSO files from a fixed folder, where to put for example the callJS javascript file, or images lazy-loaded with one of the plugins.

    2) Integrated post-compiling function. A new action like callJS that calls a function/method/object that can access the c2 variables AFTER compiling.

    Like

    codeBlock->call myfunction or myvar set call myfunction

    then opening the "compiled" c2runtime file we find our function (or class) and from there we can code without passing through c2 anymore, including manipulating c2 variables, I understand that this is dangerous as setting a varible at the wrong time could lead to unexpected results, so it could be even undocumented as an advanced feature, but serious users could really benefit from this, which by the way already do with callJS (which is amazing) but it could became less tedious this way and could open tons of possibilities especially for mobile. Even an API could be a nice idea.

    I don't think these are too much work, and even if they are could attract tons of users indirectly, because the way I see it casual user tends to be happy with the free version, while "hardcore" users are the one that are more prone to shell out money for the licence, and nothing attracts that audience like a gallery of commercial products made with construct2 that could become a reality if the right crowd is attracted to this engine and starts developing with it. I don't want to detract from the amazing community we have here, that is full of talent (as the plugin section demonstrate) but as it is construct2 is not exactly a professional editor, but under the hood it's a professional engine. An external API could make a real difference here, just like local preview did <img src="smileys/smiley2.gif" border="0" align="middle" />

  • Isn't LAN preview there to remove all the tedious compiling process ?

  • Isn't LAN preview there to remove all the tedious compiling process ?

    I'm sorry but did you actual read what I wrote?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • > Isn't LAN preview there to remove all the tedious compiling process ?

    I'm sorry but did you actual read what I wrote?

    I think he meant to respond to another topic.

    I think what would really solve your problem would be a callback plugin, that allowed external events to act upon construct 2's logic.

    I was thinking about a way to implement this, but I think it would work better if done natively (as opposed to being created as a plugin, the current callJS script, while nice and useful, still feels like a hack), since it seems like something best integrated into the core (system plugin).

    This would allow us to leave the canvas as a simple HTML5 canvas and put all our interface elements outside, as DIVs and styled buttons, as well as make possible the construction of web APPLICATIONS (not just games).

    The possibilities are nearly endless: we could hack together split screen (make two c2 canvas windows and leave sync logic outside), make smaller (and faster) social applications (with the share buttons outside the game), not to mention integrating different plugins into C2 (jQuery UI, for instance).

    Want to hear Ashley's thoughts on this.

  • CallJS - Preview:

    (Local)-preview is still working - under the circumstance that the Scripfile is 'online' (- eg: Path: dl.dropbox.com/u/31151399/Construct2/Examples/callGoogleMaps/myScripts.js) - not nice and not userfriendly but I think it's not the biggest problem to save the scriptfile in a dropboxfolder. (capx)

    'Hack' together HTML-outside-C2 and C2:

    I've only played a litte bit with that but with the new ID-Property for TextBoxes this could be possible - I suppose. (forumposts+capx)

    Perhaps those two 'hidden features' make the life for now a little bit easier.. <img src="smileys/smiley2.gif" border="0" align="middle">

  • Joe7 the problem in preview is not only callJS, but also lazy loading and all the stuff that picks files outside c2. Yes everything could be made into an hack, and basically is what we are all relying currently to achieve even simple stuff. My point remain though, it would make life a lot easier to have the ability to "inject" files inside the preview runtime.

    The TextBoxes id is nice, but it's a drop in an ocean, basically it's not enough to manipulate the canvas, but it's a start.

  • The problem is you just need CallJS and custom javascript to work with LAN preview. Have I interpreted your post correctly?

    I don't really want to make hackish changes or add "dangerous" features to support third party plugins. I think the best solution is to host your custom javascript on the web and include it via a plugin. Perhaps if 'CallJS' had a 'Load external script' action. You'll need to set up cross-domain permission on the server for it to be able to access it from the preview server, but it should be straightforward. Then your work flow can be to develop your script hosted on the server while also working on LAN preview. When you're ready to compile just include the script inline like you'd usually do. Does that sound like it would work?

  • Ashley this has steered in a direction that wasn't part of my post. Basically what I "asked" from you is:

    1) Preview on lan that actually starts from a folder to put there file we are loading with plugins or external js (eg callJS Inject ..)

    2) Native callJS, an API or a way to define function INSIDE the c2 class that we can manipulate AFTER "compiling". Basically a way to manipulate the code of C2 after "compilation" without messing with your code.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)