Integrate code in Construct 2.

Discussion and feedback on Construct 2

Post » Tue Feb 24, 2015 5:20 pm

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.
Thanks,

bernivic135
B
4
Posts: 5
Reputation: 210

Post » Tue Feb 24, 2015 6:21 pm

If the sdk was too difficult to use, how would adding code in another place be any better?
Image Image
B
163
S
48
G
100
Posts: 7,446
Reputation: 72,014

Post » Tue Feb 24, 2015 7:11 pm

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.

@newt
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.
B
87
S
18
G
9
Posts: 2,455
Reputation: 14,844

Post » Tue Feb 24, 2015 8:14 pm

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?
Image Image
B
163
S
48
G
100
Posts: 7,446
Reputation: 72,014

Post » Tue Feb 24, 2015 8:25 pm

It's doable now, but it's more heavy stuff. The process requires
get prototype object
get memory object
prototype.call( 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.
B
87
S
18
G
9
Posts: 2,455
Reputation: 14,844

Post » Tue Feb 24, 2015 8:36 pm

Yeah looks like a separate editor would be the only way right now.
Image Image
B
163
S
48
G
100
Posts: 7,446
Reputation: 72,014

Post » Wed Feb 25, 2015 2:33 am

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.
B
99
S
22
G
192
Posts: 4,176
Reputation: 111,215

Post » Wed Feb 25, 2015 4:18 am

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 :), 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.
http://c2plugins.blogspot.tw/2014/02/reuse-ace.html

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.
prototype.function.call( memoryobject, params)
B
87
S
18
G
9
Posts: 2,455
Reputation: 14,844

Post » Wed Feb 25, 2015 6:30 am

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?
B
4
Posts: 5
Reputation: 210

Post » Wed Feb 25, 2015 6:47 am

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?
Image Image
B
163
S
48
G
100
Posts: 7,446
Reputation: 72,014

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 3 guests