C2 vs real programming

Discussion and feedback on Construct 2

Post » Thu Sep 13, 2012 5:05 am

Meh, writing a plugin is far more complicated than just looking for a work around. I do agree with Twins that my thinking (being more used to programming) complicates things but hey, i do know that you can work around it xD
B
4
Posts: 10
Reputation: 470

Post » Thu Sep 13, 2012 1:52 pm

@accidentallyc I guess I did not fully understand your second question. Writing plugins is not that complicated, especially if you were to write a plugin just for your game, for private use.

Assuming you want some custom javascript code executing every game tick, your plugin could have just one C2 "action" defined in the edittime.js and then have that action be called from C2's every tick event. The runtime.js would be as complicated as you wanted to be. If it you just need a few lines of code then the JS function that gets called when the action is fired would have only a few lines of code. That code can access any C2 object instances and their behaviors and properties.

If you want some custom code to be called when a certain event is fired, then instead of having your plugin action called on every tick, just call it when the the event is fired.

Another way of "text editing" the C2 events is to open the event sheet files in a good text editor, but that is definitely not a supported (or good?) way of doing things and you have to be very careful (make backups!).
B
26
S
7
G
3
Posts: 118
Reputation: 4,264

Post » Thu Sep 13, 2012 6:02 pm

@juantar thanks for the tip. I will delve into it when i find the need but so far simple work arounds can solve the problem. The newest update of construct 2 is quite good as well. Is it possible to change the first post tho? People might come and answer an already answered issue xD

(completely unrelated: what in the world is prompt mode / basic mode at the edit message form? )
B
4
Posts: 10
Reputation: 470

Post » Thu Sep 13, 2012 8:20 pm

[QUOTE=accidentallyc] Meh, writing a plugin is far more complicated than just looking for a work around ...[/QUOTE]
[QUOTE=juantar] @accidentallyc ... Writing plugins is not that complicated ...[/QUOTE]
@accidentallyc
juantar is quite right. If you can handle the logic of gaming, then you shouldn't find writing plugins all that difficult - particularly if you start with my tutorial

And IMO it adds another level to the fun of Construct 2.

(As for Prompt Mode/Basic Mode, try inserting a URL in your post in each mode and you'll see the difference.)Velojet2012-09-13 20:26:05
B
105
S
20
G
12
Posts: 549
Reputation: 20,320

Post » Fri Sep 14, 2012 3:54 am

[QUOTE=Mipey] Real programming? REAL programming?! [/QUOTE]
It's funny you say that because I'm testing the waters of the great fearsome assembly ocean at this moment in time.
B
19
S
3
G
2
Posts: 148
Reputation: 1,945

Post » Fri Sep 14, 2012 10:30 am

C2 is awesome, but coming from actionscript events based programming with large teams of developers, I find that these are my biggest challenges:

1) no user defined events.
E.g. there are about 20 places I want to say end the game for various different reasons and do a load of house keeping and display stuff, i.e.I want to raise an event called "gameEnded" with some parameters, and have one event handler defined. Importing event sheets goes part way to solving this, but is more like a "goto". Also, the concept of change listeners would be nice, so if say the score changed, this could trigger some actions.

2) no way to re-use code. I re-type a lot of code in a lot of games which are all similar to each other. This is a bit of a maintenance nightmare - when I change the common "library" code, I will have to edit 30+ games, and retest them all in case I made the C2 equivalent of a typo. You dont seem to be able to cut and paste actions between projects, even if you call the objects the same names. I experimented with manually editing the event sheets in notepad++, but kept crashing C2 (not surprisingly).

There is a function plugin someone wrote, but as a general rule we don't touch plugins if they are not part of the supported C2 product so may end up not being maintained, bug fixed or working with a release.nutmix2012-09-14 10:39:38
B
15
S
5
G
2
Posts: 357
Reputation: 3,691

Post » Fri Sep 14, 2012 1:20 pm

[QUOTE=nutmix] C2 is awesome, but coming from actionscript events based programming with large teams of developers, I find that these are my biggest challenges:

1) no user defined events.
E.g. there are about 20 places I want to say end the game for various different reasons and do a load of house keeping and display stuff, i.e.I want to raise an event called "gameEnded" with some parameters, and have one event handler defined. Importing event sheets goes part way to solving this, but is more like a "goto". Also, the concept of change listeners would be nice, so if say the score changed, this could trigger some actions.

2) no way to re-use code. I re-type a lot of code in a lot of games which are all similar to each other. This is a bit of a maintenance nightmare - when I change the common "library" code, I will have to edit 30+ games, and retest them all in case I made the C2 equivalent of a typo. You dont seem to be able to cut and paste actions between projects, even if you call the objects the same names. I experimented with manually editing the event sheets in notepad++, but kept crashing C2 (not surprisingly).

There is a function plugin someone wrote, but as a general rule we don't touch plugins if they are not part of the supported C2 product so may end up not being maintained, bug fixed or working with a release.[/QUOTE]

The main point here is that construct 2 should be object oriented instead of procedural.
B
35
S
8
G
8
Posts: 532
Reputation: 6,868

Post » Fri Sep 14, 2012 3:01 pm

To change it to a model like Unity (object compositional) uses would demand pretty much some major code rewrite i think. Each approach has it advantages and downsides.
Of course Unity model is harder to grasp but much more flexible.
B
58
S
13
G
10
Posts: 632
Reputation: 12,505

Post » Fri Sep 14, 2012 3:59 pm

I really dislike giving up enormous benefits for tiny advantages... besides, everything coding-wise is OO nowadays, so everyone is going to have to learn it some day.

As for it being hard, remember that the longer this is postponed, the harder it is to add later.
B
35
S
8
G
8
Posts: 532
Reputation: 6,868

Post » Fri Sep 14, 2012 4:28 pm

I second the suggestion to introduce some form of event re-usability in C2. IIRC, MMF had something called "behaviors" that were basically event sheets attached to the objects. Inside those events you would reference other "families" (I really don't remember the exact terms) so you could just copy and paste your object into another project and those events would work if the "families" were in the new project. I am sure Scirra has already thought of something similar and maybe they are working on it.
B
26
S
7
G
3
Posts: 118
Reputation: 4,264

PreviousNext

Return to Construct 2 General

Who is online

Users browsing this forum: mystazsea and 14 guests