grossd's Recent Forum Activity

  • Hi Ashley, all,

    If i were to run one or many C2 games within a Game using the iFrame plugin, would this cause significant performance degradation?

    Why yes: because C2 runtime, runs two or many times in parallel, creating both memory usage and processing overhead

    Why no: because in the end all C2 game instances run on the same processor, and hence processing is time shared overhead is similar to running all games within one C2 game.

    Which argument is correct?

    If there is significant overhead could in principle the code be optimized to recognize multiple instances of C2 being loaded in a browser?

    thank you,

    Dan

  • OK. thanks.

    re: iframe composites

    So, Iframe within IFrame is not supported -- only one level of iFrame per C2 project.

    re: optimization

    Indeed something I haven't thought about: a C2 app running inside an iFrame imports all of the C2 runtime code again. I wonder whether browser optimize such things, since it appears to me that iFrame is in the end of the day a browser DOM construct, not an independent browser running in a browser -- at least according to my intuitive understanding of how iFrames might work.

    Dan

  • What is the ID used to direct a message to the page that includes the iFrame?

  • Hi Pode,

    Thank you for your prompt response. Can can you further explain the problem?

    What if each Canvas included in an iFrame is self contained and the only sharing with the "outer" canvas are events and messages.

    For example, I created a "virtual" keyboard and Entry Field to enter text. I'd like to reuse this functionality across several games/quizzes. So, I envision the keyboard to "live" within an I frame, and the linkage to the outer application is only via messages sent -- i.e. the complete text entered.

    EDIT: i.e. the application within the IFrame is treated as one object type in the "outer" application.

    Dan

  • Hi,

    I have been agonizing some time already that C2 isn't supporting "precompiled" C2 Layout/Event components and modularity -- what i believe to be a prerequisite to developing clean, reusable and scalable source code.

    But, I believe that I found a way to achieve it using adaptations of currently existing plugins. I would like to find someone with plugin development experience with whom I could jointly develop this to be shared in the C2 community.

    Here is the overall approach that seems to work:

    1. C2 would could be complied and then embedded in a C2 Project layout using Pode iFrames.

    2. Communication between the C2 project and project included in the IFrame would occur using HTML5 messaging such as implemented in the Pode's PostMessage plugin, which can send and receive message in event sheets using iFrame IDs.

    The C2Embedding plugin would offer additional features:

    1. the C2 project that embeds another project would provide the project a unique ID, which is then used in subsequent messaging to direct messages to the correct embedded iFrame C2 project . This could be provided as a parameter in the URL that links to the IFrame of the embedded C2 project would.

    2. a Dictionary could be used to specify the data interface between the main project and the embedded project. The Variable Dictionary would include "global" variable names in the embedded project that could be set or changed, which would then be reflected in the embedded C2 project.

    3. An Event trigger Dictionary could be used to indicate the events triggerable in the embedded C2 project -- or, in case of a lighter approach: an event with tag could be used to trigger events within the C2 project.

    4. the embedded C2 project could trigger events in the main project. A tags could indicate the event kind triggered.

    this is it, in essence.

    Having such a capability, would allow compiling C2 projects into "components" and have those components embedded and integrted in other C2 projects.

    i feel this could be very useful in better managing projects.

    Dan

    p.s. more thinking needs to be done to support special platforms such as node web-kit, how these access, load and run pre-compiled components in iframes.

  • Hi Pode,

    Is there a way to send a message to the C2 app that contains the iFrames (the main app in your case), rather than only between peer iframe apps?

    What i'd like to achieve is the ability to continuously exchange messages between an app in a frame and the main app, from setup and initialization messages to messages in response to external and internal events.

    thanks,

    Dan

  • Hi,

    Currently, web-nodekit only supports downloading text files. To save a canvas snap shot I added a bit of javacript inject code. You can download it here: http://wiki.goalorientedsolutions.com/d ... pshot_file

    Please be aware that due to some current discrepancies between web-nodekit in the preview and when exported, the save feature only works projects exported to web-nodekit.

    Dan

    p.s. thanks to emoaeden for encouraging me to package this in a capx.

  • Hi,

    I just noticed that there exist a discrepancy between launching node-webkit in preview and when exported.

    In preview the following reference when injected as via the browser, throws a reference error, whereas when exporting it does not:

    var fs = require('fs');

    It would be great if both the preview and the export would equally load whatever library is needed to resolve the reference (node.js? perhaps).

    thank you,

    Dan

  • Hi Ashley,

    OK, so I solved it with some Javascript injected with the browser, and a tailored javascript call as follows:

    (Its pretty basic. It's too bad that its not supported "natively" in C2 in the node-webkit plugin, but since I am new to javascript, it took me a bit to stich together, and I feel my solution is rather brittle).

    In C2:

    set varCanvas = right(CanvasSnapshot,len(CanvasSnapshot)-23)

    Execute JavaScript varScript & "; me( 'c:\\results\\file99.jpg', '" & varCanvas & "');"

    and javascript I've loaded in the varScript variable:

    function me(name, canvas) {

    var fs = require('fs');

    var img = new Buffer(canvas, encoding='base64');

    fs.writeFile(name, img, function(err) {

    // if(err) {

    // document.write("<p>");

    // document.write(err);

    // document.write("</p>");

    // } else {

    // document.write("<p> The file was saved!</p>");

    // }

    //

    }

    );

    };

  • Ashley, any chance that node-webkit could support saving a canvas snapshot as an jpg or png -- or is this a limitation imposed by node-webkit itself.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I noticed that node-webkit save, saves a base64 string -- so I guess I would need to translate this back into a jpg image, somehow, from the outside.

  • I see. Thanks.

    I noticed that nodekit supports file save. Can it save CanvasSnapshot (non text files)?

grossd's avatar

grossd

Member since 4 Feb, 2014

Twitter
grossd has 1 followers

Trophy Case

  • 12-Year Club
  • Jupiter Mission Supports Gordon's mission to Jupiter
  • Forum Contributor Made 100 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

17/44
How to earn trophies