Integrate code in Construct 2.

0 favourites
  • 12 posts
From the Asset Store
Casino? money? who knows? but the target is the same!
  • Hi,

    I'd want to put some code in my Construct 2, and there's no posibility. I have a little bit of experience with javascript, but when I tried the javascript SDK it was quite difficult.

    If anyone could make a behavior that can put code on an object, that would be awesome.



  • If the sdk was too difficult to use, how would adding code in another place be any better?

  • I have a plugin that does what you ask. however since there is no IDE way to inject code into the original runtime.js, this leaves all extra code running on the VM. And the VM is slow. Also even if you did use code. The C2 API isn't built for ease of use. The sdk is just clunky. In the mean time your pretty much going to have to use the SDK if you want your code to run optimally.


    To be honest the SDK is a heavy weight to implement, with little beneficial returns. It's not "hard", it's just intuitive, restrictive, overloaded with "add" functions. Where as usual Plugin design don't require such heavy use of adds or definitions. They often just need to fill out abstract function names and light registration. There are definitely better ways to handle the entire SDK system. However you are right. Due to having no way to get code in properly(post export code insertion only). There is no other viable method to get code running.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There was talk of adding a way to do the sdk in events, but with C3, that todo has probably gone the way of the dodo.

    How hard wold it be to implement a "lite" version of the sdk?

  • It's doable now, but it's more heavy stuff. The process requires

    get prototype object

    get memory object object.function, params ).bind( prototype )

    you also need to get the memory instance here and there as it seems just grabbing the object once will fail on a different function.

    where as to use the system as a standard sdk

    object = getObject

    object.function( params )

    Guess we will see what comes about in 6+ months.

  • Yeah looks like a separate editor would be the only way right now.

  • Why not use official function for "lite" behavior?

    I had made more than 180 plugins, I did not feel that SDK is difficult. Even the engine code is clear enough for tracing.

  • I never said difficult, I said "heavy" and that's in regards to base overhead. However it's un-intuitive, not impossible.

    This blog is awesome to know the nitty gritty <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">, I got the function call methods from your blog and plugins as you had already managed to do so; so using your basics just saved me time.

    However I did make a mistake. It's Call or Bind, and no need to use both.

    Also it should be. My error, i was workign off memory. I started building a SDK lib to make life easier, and didn't recall the exact method. memoryobject, params)

  • Ok,

    Thanks for the replies! I will try again the sdk, but, one thing: what differences are between using the xml plugin or making a javascript one?

  • There shouldn't be much difference, as the only thing another plug could add would be an editor, but C2 lacks the ability to allow that. Its pretty much the main argument for C3.

    That being said it would be nice to know what features it will have, as well as will we ever get the ability to "event" a plug?

  • bernivic135

    There are two kinds of plugins, one is add more abilities into C2 engine. one is encapsulate events to have more clear appearance on event sheet, in my point of view.

    You could make a plugin which parse a specific format string like xml, then do somethings. It could get result quickly without understand the detail of format.

  • bernivic135

    I'd also recommend giving the plugin architecture another shot. Just take a look at some of the existing plugins / behaviors js code. Start by deconstructing the simpler ones, for example rotate/sine behavior, and then move on to more complex ones like platform. Honestly, I think it's fairly straightforward. I have a simple template behavior and template plugin that I use as a sort of scaffolding when I need to quickly prototype new ones.

    There are already tons of people who have written addons for C2. It really depends on what you're trying to accomplish.

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