My 2cents about construct2

Discussion and feedback on Construct 2

Post » Tue Nov 29, 2011 7:48 pm

Not to mention the fact that ImpactJS doesn't implement all of the HTML5/JSCSS3 spec, since it needs to translate the calls to OpenGL...
B
33
S
9
G
6
Posts: 709
Reputation: 6,704

Post » Tue Nov 29, 2011 8:15 pm

IMHO, I think C2 is a great tool for those, like me, who knows the logic behind software production, but did not falls in love with programming languages. Instead, we invested more in graphic appeal and gameplay. So ,the C2 current limits do not hinder the evolution of my work and my personal satisfaction with their development.
B
89
S
5
G
7
Posts: 164
Reputation: 7,546

Post » Tue Nov 29, 2011 9:22 pm

[QUOTE=newt] 2. Please, please, please stop using uid. It was not designed for this purpose.
Instead use the object index, as in sprite(index). Each time you add an instance(even in the editor) it is assigned an index based on how many instances already exist. That's far more practical than trying to guess what the uid is.[/QUOTE]

This seems counter logical to me. If a UID is a uniquely assigned ID that will never change during runtime, and the object index merely lists the current index of the instance, which (am I right in thinking) will change if more instances are added or removed around it, then it makes for much better practice to use the UID when referencing any specific instance. The only argument against it that I can think is some sort of speed hit due to the way the look up is implemented.jumprock2011-11-29 21:22:44
B
16
S
5
G
1
Posts: 43
Reputation: 1,595

Post » Tue Nov 29, 2011 9:44 pm

It doesn't change during runtime, but you cannot count on what it will be until after the object has been created at runtime. Each time you run the game the UID will likely be different.

Think of it like this - if on preview 1, you create an instance of a sprite, it will have a UID, like 1. If on playthrough 2 you create an instance of sprite2 first, then create a sprite instance, sprite will have a different UID, like 2, than it had on the first playthrough, because sprite2 was assigned the UID 1 first because it was created first.

Does that make sense?Arima2011-11-29 21:45:12
Moderator
B
87
S
32
G
33
Posts: 3,005
Reputation: 27,397

Post » Tue Nov 29, 2011 9:54 pm

Atleast it doesent bug in the event editor where groups are constantly selected and it jumps back and forth
B
18
S
4
G
1
Posts: 413
Reputation: 2,512

Post » Tue Nov 29, 2011 11:32 pm

[QUOTE=Arima] It doesn't change during runtime, but you cannot count on what it will be until after the object has been created at runtime. Each time you run the game the UID will likely be different.[/QUOTE]

So the index doesn't change during runtme at all, no matter how many instances are added and removed around it? If so it's a different beast to what I understood.

I guess sometimes you want to rely on ids that are essentially hard coded, but equally there are times where you need to use dynamic references that are created at run time. This is unavoidable when you are spawning items such as bullets or enemies that aren't manually placed but generated by code.


So what were the perceived negatives of using UID besides the fact that they will likely be different for each execution of the game?
B
16
S
5
G
1
Posts: 43
Reputation: 1,595

Post » Tue Nov 29, 2011 11:56 pm

The index is based on how many instances exist, or how many are picked, so yes that number will change if you create or destroy instances.
Like if you destroy sprite(0), sprite(1), will then be able to be referenced as the old sprite(0).

If you need a something to constantly pick a specific instance, you should use an instance variable.
That's essentially the same method as using the uid by setting a sprites instance variable to its uid on creation, but when you think about it, that's an extra step that's not needed, as you can pick via instance variable just as easy as you can pick by uid.

Also I think one way to think about uid's is to treat them as if they were random numbers.
Image Image
B
161
S
48
G
89
Posts: 7,347
Reputation: 66,249

Post » Tue Nov 29, 2011 11:59 pm

Hi, after reading all of your replies and especially the one coming from Ashley. I think that construct2 has the potential to become the BEST html5 engine, code or no code, it just need to open up to its full potential.

I don't want to rely on firebug because then I would get a trace of the inner workings of construct, not of my "code" if I have to delve deeply in the recess of construct2 code I'm better off learning to code in a "real" html5 framework. At this point I would really settle off for a console.log(allmyvars);.

All the discussion on UID kinda make my point more valid. It's imperative to be able to access an object clearly after it has instanced, I don't care if UID changes, that is normal, what is not normal is that currently is a hit/miss thing.

There should also be a more clear way of understanding the flow and precedence of construct, I have often to rely on instancing an insane amount of variable like object_position_X,object_position_X1,object_position_X2, etc because sometimes var are overridden during complex instruction in an unpredictable way. This could be achieved simply by having groups behave like real functions, like

start group (passing variables)
do what the group does
return something
deactivate the group automatically

Right now is kinda possible to do this, but it involves a check (is group active) and a consequent manual deactivation after the group does it's thing and when you have 10-20 groups it gets confusing and unpredictable.

Take a look at this: http://dl.dropbox.com/u/23551572/C2/destroyByUID.capx
(from this thread: http://www.scirra.com/forum/topic46461.html).
After working on this for several days (to expand my game) I found out that the whole isSelected bit is not completely reliable, I added tons of new event inside that bit and I started noticing a delay between the destroying of the first and second card, I presume because sometimes it misses the isSelected bit, goes back to the beginning and starts over, resulting in a bit of delay, this is a big issue because we have no instruments to check the precedence of instruction and the flow of construct.

Since I bought this product I've seen only updates that add even more "click and play" features (like jump through platform) and none that addresses the real issues, and I fear that if this is the road you are taking serious projects will never see the light of the day.
B
29
S
9
G
6
Posts: 525
Reputation: 8,294

Post » Wed Nov 30, 2011 12:10 am

[QUOTE=newt] The index is based on how many instances exist, or how many are picked, so yes that number will change if you create or destroy instances.
Like if you destroy sprite(0), sprite(1), will then be able to be referenced as the old sprite(0).
[/QUOTE]


Hmm, OK, so the index is as I originally thought, and thus very unreliable to use as a reference because it has the potential to change during runtime.

The UID however will never change during runtime so acts as the most reliable reference. I still don't understand what the perceived negative is?

I use randomly asigned IDs a lot in my other work so I'm sort of defending them here, also, database convention such as in SQL uses randomly (or more likely incrementally) assigned IDs for identification because they are persistant, and by definintion, unique. Feels to me like a UID is one of the most robost identifiers to use, and also made even more attractive by the fact that there is a function built into Construct to select items by this identifier. Of course you need to keep reference but that's part and parcel of making larger scale dynamic games and applications.

PS - Persistance in this case means runtime persistance.jumprock2011-11-30 00:13:01
B
16
S
5
G
1
Posts: 43
Reputation: 1,595

Post » Wed Nov 30, 2011 12:34 am

@0plus1 if you find bugs or issues in C2, the good thing to do is to file a bug report.
If some issue hasn't been detected, it can't be corrected.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

PreviousNext

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 5 guests