construct 2 is not so fast after all

Discussion and feedback on Construct 2

Post » Fri May 20, 2016 3:34 am

For those, who getting confused over "Wait 0" thing.
Tutorial by Ashley
Wait 0 thread

@winkr7 Basically, "Wait 0 seconds" postpones the following actions until the end of the event sheet.

gamecorpstudio wrote:when you have multiple actions on the same condition and the system might skip or write a bad value or half of a value instead the real one.
C2 event sheet is read from top to bottom... but sometimes it might skip 1 action or 2

This is not okay, sounds more like a bug. Then it might skip the "Wait 0" action too, lol. There's nothing in the manual or tutorials about skipped actions because of a framerate or anything else.
Last edited by Sisyphus on Fri May 20, 2016 4:07 am, edited 1 time in total.
B
22
S
9
G
7
Posts: 421
Reputation: 6,543

Post » Fri May 20, 2016 3:58 am

mikehive wrote:OK, I understand the problem with a browser game. But what if a game is released as a nw.js exe, or as a mobile app? Is that still something to be concerned about?

Sorry if I'm derailing the thread.


It does not matter, global, local...if a player wants to cheat they will. There are things you can do to mitigate it, and try to make it harder...but you can not really prevent it 100%.

Global variables in a programming sense, are typically to be avoided...but for construct and game purposes made with C2, I don't see any real concern with it personally. Should you take steps at preventing cheating? Sure...but it comes down to, at what cost?

If this is a game with sales, then you better do something, but it won't be using global vs. local variables.
B
42
S
17
G
8
Posts: 491
Reputation: 8,302

Post » Fri May 20, 2016 5:42 am

I just mentioned global variables as a way to help the OP with his 3rd problem. Honestly I use global variables for the same purpose, to minimize my overall code. The security issue doesn't really concern me as most players just play the game, not hack it. As long as the game isn't multi-player it doesn't matter.
What does matter is lowering the amount of code you use to make your life easier. In that reguard global variables can definitely help.
Check out my awesome Android Game releases https://play.google.com/store/apps/deve ... ames&hl=en
B
38
S
18
G
24
Posts: 681
Reputation: 16,613

Post » Fri May 20, 2016 6:52 am

PixelPower wrote:I just mentioned global variables as a way to help the OP with his 3rd problem. Honestly I use global variables for the same purpose, to minimize my overall code. The security issue doesn't really concern me as most players just play the game, not hack it. As long as the game isn't multi-player it doesn't matter.
What does matter is lowering the amount of code you use to make your life easier. In that reguard global variables can definitely help.

3rd problem ? when i write my own pathfinding system i dont know how a global variable can help me !
i can do this :
use function (do pathfinding stuff) return position of object > set position
but when you want to use this code again you have to write the set position part again
and it would better if we write whole system and drag the sheet to what every object we want! (cleaner and faster)
and what happens if i want to get first mypathfinding nodepoint ?
here i can set the object instance variables in function but when we want to use this function again we have to change the object , so the function is usless here
but in secound way (which other engines use) i can set variables and access to them by another sheet
B
16
S
6
Posts: 243
Reputation: 1,755

Post » Fri May 20, 2016 9:02 am

Sisyphus wrote:This is not okay, sounds more like a bug. Then it might skip the "Wait 0" action too, lol. There's nothing in the manual or tutorials about skipped actions because of a framerate or anything else.


No it cant since "wait 0" action is delayed, as the post you shared says, to the end of event sheet and then performs it.

But when you have 10-20 actions under a condition or is a very cluttered area of conditions and actions in your event sheet and you dont have the "wait 0" between them,and based on your computer performance or browser performance there are some times slow downs of performance.

Maybe because of browser plugins/framework maybe because of your computers outdated drivers, sometimes we have high usage resources and the browser may slow down even for 1 second or less ... at that moment since C2 system is directly responding to how well our computers can run HTML5 and this sort of issues might happen.

This issue was also mentioned many times by Ashley and other developers over the years in the forum posts. The skipping is not directly mentioned in the manual but the performance and optimization is, and its suggesting the slow downs might skip 1 action or the actions might not perform as well as they should. And thats why Wait 0 was implemented. At least thats how i see it and understand it so far from testings and the course of C2 development announcements.

But its not something that C2 can fix. Its more of a Hardware, Software(not only C2 but all dependencies that C2 has), and user usage mix problems.

Which C2 is developed and patch so often to avoid bad performances like this.

Another example that is based on performance and the limits of HTML5 are the jitters that always pops up around forum, that are caused by the html5 platform and how well the Math is made in the Core's Engine.

But this pushes the topic back to the eternal conflict between developers on having to choose from HTML5 or flash. Since immediately flash is/was a bit faster but still has more problems then HTML5 itself.

In a few more years maybe all this will be behind, with the technologies and the software that is continuously updated. Till then we(the normal inexperienced flock of users) cant do nothing but wait. And submit bug reports or performance issues.

And then another short note on user usage of software ... most C2 developers tend to not have a clean code... keeping their event sheet all unoptimized and having blank conditions under blank conditions under functions over functions that basically do nothing just delaying the system and then as mentioned above issues pop up.
And the unoptimization of a code it can bring performance down quite visible in some cases even close to unusability of an app.

Because 1 condition in blank its another maybe 0.001 % tick delay based on the amount of conditions and actions we have in our event sheet, and on large scale games that 0.001% can get pretty high stacking.

I'ved seen capx's that where like the above example ... having 10 functions under 10 blank conditions and at the end 1 action that was calling another cluttered useless function that was basically repeating same hierarchy just calling another action or condition ... which did not make sense at all.. and the app at that moment tested was performing really bad maybe 1% of what it should have been.

So it all comes down to all this things that combined kills performance, on a newly platform called HTML5 that still has years to be developed in order to get perfect and fast enough. Even though, i personal consider it fast enough at this point for what most people use it for on the side of C2.
I could go on... but im way off-topic and this kind of talking wold be better discussed in open topic then C2 General.

Im not sure if you still understand now why "action skipping" might happen. And why "wait 0" wont be skipped. But you already shouldve noticed all this by now ... :P since your not a new C2 user lol ... have a great day all
B
75
S
22
G
68
Posts: 1,333
Reputation: 43,263

Post » Fri May 20, 2016 1:12 pm

@gamecorpstudio Can you please explain, how firing actions in the end of the event sheet can avoid skipping? When you developing your games you put "Wait 0" everywhere? Really? I can't even find any info about skipped actions on the forums. Can you show where it's discussed?

gamecorpstudio wrote:The skipping is not directly mentioned in the manual but the performance and optimization is, and its suggesting the slow downs might skip 1 action or the actions might not perform as well as they should. And thats why Wait 0 was implemented.

I've re-read all Ashley's tutorials and blog posts about performance and optimisation and events. No suggestions or anything else about action skip. I really think that if a thing like action skip is possible Ashley would have written something about it anywhere, but there's not a word about it.

gamecorpstudio wrote:Because 1 condition in blank its another maybe 0.001 % tick delay based on the amount of conditions and actions we have in our event sheet, and on large scale games that 0.001% can get pretty high stacking.

Can't get your point here, blank condition is the same as Every Tick condition, it's even stated in Ashley's blog post.
Last edited by Sisyphus on Fri May 20, 2016 2:57 pm, edited 3 times in total.
B
22
S
9
G
7
Posts: 421
Reputation: 6,543

Post » Fri May 20, 2016 1:48 pm

My usage of wait (0):

In the same event, to make sure previous actions are completed before the next actions after the wait(0) is processed.

Example:

event condition = true
-action set variable x = call function meh (y,z)
-action wait (0)
-action set variable a = variable x


In this example, variable x is set by means of the process in function meh.
the wait (0) forces the process of the function in order to set the variable x to be completed before moving on to the next action.
Thus variable a will always be set with the result of function meh which was moved into variable x before the wait.

In short, the wait(0) allows the previous actions of the same event to be completed prior to moving to the next actions after the wait(0).

I avoid relying on the wait(0) when it involves a different event, or even a sub event of the event using the wait(0) as its unreliable and merely makes the entire event sheet wait 1 tick before processing further where it was, making it loose data and information or picked objects.

At least that's how I always see it.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,562

Post » Fri May 20, 2016 2:06 pm

@lennaert Yeah, when you need to postpone actions till the end of event sheet it's okay, but what about skipped actions mentioned by @gamecorpstudio ? Have you ever noticed this?
B
22
S
9
G
7
Posts: 421
Reputation: 6,543

Post » Fri May 20, 2016 3:26 pm

@Sisyphus wrote:lennaert Yeah, when you need to postpone actions till the end of event sheet it's okay, but what about skipped actions mentioned by @gamecorpstudio ? Have you ever noticed this?


I never noticed missed/skipped actions really.

But I think this has to do with the approach and intended use.

Like, the following example:

Global variable x = 1

-event: Trigger once
sub event 1 condition x = 1
-action wait(0)
-action set x = 2
-sub event 2 condition x = 2
-action browser plugin execute js "alert('x is now 2');"


with the wait(0) disabled, the popup shows.

Enabled, it might look like it is missing actions ;)

Toggle the Wait(0) for clarification and restart app.


example capx
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,562

Post » Fri May 20, 2016 5:07 pm

Um, if you ever find that variables aren't set instantly, then that is a bug. :P
Please report it.
Just sayin...
Image ImageImage
B
168
S
50
G
169
Posts: 8,281
Reputation: 108,191

PreviousNext

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 13 guests