Inform me!

New releases and general discussions.

Post » Mon Apr 26, 2010 8:24 pm

This is more of a general wish than a special feature request.

[size=150:2xxrk0a9]Don't let Construct just ignore my instructions![/size:2xxrk0a9]

If something can't be done I want to be informed. But with the size of a project growing also a deviant behavior occurs more and more. Some things are just ignored. No error message, no crashing, nothing but just not executing an action. Posting something like this to the tracker wouldn't help much, as the occurences are like random. Here are two examples from a quite complex project:

(A) The ballad of the cursed Tempo Display

I was working on a Tempo Display. The user may click on the panel thus making it editable. Keyboard input then is converted to a value which is stored in 's'. By hitting 'enter' this value is used to display the new Tempo by switching frames of a sprite.


[size=70:2xxrk0a9]I1: The Tempo Display[/size:2xxrk0a9]

It was one of the first things I implemented after the core engine, and it worked like a charm. I was working for almost a week on other parts of the project, and one day the Tempo Display suddenly didn't work correctly anymore. The frames were still updated during editing, but as soon as hitting 'enter' the old value was shown. I first thought that I messed it up unintentionally and looked at the code. But everything was as always, no change at all. Even more, if I used a textbox instead of the font sprites, it worked as intended.


[size=70:2xxrk0a9]I2: One Event of the Tempo Display with the action that is igored[/size:2xxrk0a9]

For days I tried to get this working as it worked before but had no luck. Then, totally desperate, I thought:

"Well, this is ridiculous, but what if Construct had not enough time to do all of the instructions within a tick. But instead of doing it the next tick then, it just ignores the instruction?"

I know, it seems like nonsense, like a delusion of a tired out man smoking to much, but nevertheless I gave this idea a chance. I changed the code accordingly...and it worked! Unexplainable. And you have to find the clue without any help from Construct.


[size=70:2xxrk0a9]I3: The same event of the Tempo Display with the action working[/size:2xxrk0a9]


(B) The jinxed Position Display

At least I found a workaround for the Tempo Display. That's more than I can say about this one. This time, a Position Display shows the musical positon while music is playing. No user input implemented yet. Every musical tick a position value is updated, converted to a special format and finally shown in the display.


[size=70:2xxrk0a9]I4: The Position Display[/size:2xxrk0a9]

Again, it worked. Unfortunately I embedded the code for the conversion directly in the event that is responsible for the display. But I need it to be seperate because the conversion is done in other situations, too. Well, I changed the positions of some events (and not the content) and called the events seperately. For the life of me I can't figure out, why it's happening, but the last two digits now get ignored (and only them). Again, when using text boxes it works, just not with the sprites.


[size=70:2xxrk0a9]I5: The Position Display with the last digits never updated[/size:2xxrk0a9]

It's not the order of events. I tried several combinations (even reversed order) and it always resulted in the last two digits not being updated. I could isolate it to the one event responsible for displaying the digits.


[size=70:2xxrk0a9]I6: The event for the Position Display[/size:2xxrk0a9]


[size=70:2xxrk0a9]I7: The event for the Position Display like it is not working[/size:2xxrk0a9]

Again, there is no feedback from Construct. It just ignores my instructions. So let me please repeat my wish from the beginning of this post:

[size=150:2xxrk0a9]Don't let Construct just ignore my instructions![/size:2xxrk0a9]

Thank you :cry:
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Mon Apr 26, 2010 11:15 pm

This.
[quote:m4qlry1k]"Well, this is ridiculous, but what if Construct had not enough time to do all of the instructions within a tick. But instead of doing it the next tick then, it just ignores the instruction?"[/quote:m4qlry1k]

Pretty sure a function within a function will be another tick. In fact I often use "call function after delay" because it takes another tick to retrieve something from the gpu. Probably the same sort of thing happening with the font thing as well.
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Tue Apr 27, 2010 10:20 pm

[quote="newt":1wd6uvls]Pretty sure a function within a function will be another tick. In fact I often use "call function after delay" because it takes another tick to retrieve something from the gpu. Probably the same sort of thing happening with the font thing as well.[/quote:1wd6uvls]
Please believe me, If it were that easy I never would have created the post. It is more than this. You can't rely on something working, because a few days later the same code without changes suddenly doesn't work anymore.
Besides, we shouldn't be forced to wildly guess when to use a delay of a function. Construct should handle it automatically or at least give a error message.
The examples show the randomness of the problem and that is contra-productive. If it were a matter of delaying a function, then why the heck are 6 of 8 instances of a sprite correctly updated while the other two are simply ignored? No matter what you change.
No, if there are problems for Construct executing something I need feedback about it to handle it.
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Tue Apr 27, 2010 11:11 pm

You should probably upload an example. There's no way to tell if this is v-synced, or how to tell how your updating function parameters.
But honestly I just don't think you can get the precision your wanting in a tick based system.
All I can say is you cant count on having precision down to less than 10 milliseconds, and when it comes down to timedelta that will make a big diference, and even if you get the timing right on your system, it could vary wildly on others.

One thing I could suggest is using some sort of interpolation, or percentage to set your animation.
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Wed Apr 28, 2010 11:41 am

[quote="newt":xvspf1ir]You should probably upload an example. There's no way to tell if this is v-synced, or how to tell how your updating function parameters.
But honestly I just don't think you can get the precision your wanting in a tick based system.
All I can say is you cant count on having precision down to less than 10 milliseconds, and when it comes down to timedelta that will make a big diference, and even if you get the timing right on your system, it could vary wildly on others.

One thing I could suggest is using some sort of interpolation, or percentage to set your animation.[/quote:xvspf1ir]
I'm afraid I was misunderstood completely. Maybe I'm explaining it wrong or my language skills are not sufficient. Sorry for that.

The music engine has its own timing, independent of the UI one.

I don't care about or need timing precision with the user interface of my app. On the contrary, I rely on the fact that I can change a sprite's animation frame whenever I want to, not at a specific time. It doesn't need to be changed on a special tick, it can be updated a few ticks later, even updating it a second later is ok. But I need it to be changed at all

I still see no logic in the circumstance that one calls a function and the sprite's frames are changed within this function, and just because your project grows in size you have to delay the very same function a week later to make it work again. Besides, it is still working without delaying it, just the sprite's frames are not changed. Text boxes changed within this function work, as an example.

According to that logic, I guess I need to raise the delay time as soon as my project grows by a certain size again. IMHO that's not acceptable.

Last but not least: The problems occur with whatever you do or use. It doesn't matter if you use v-synced or unlimited mode (delaying it by TimeDelta makes the Time Display work under both modes and not delaying it makes it not working under both modes) Also, order of events don't count for this particular problem.
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Wed Apr 28, 2010 5:20 pm

[quote:1efw3har]According to that logic, I guess I need to raise the delay time as soon as my project grows by a certain size again. IMHO that's not acceptable.[/quote:1efw3har]

I think you kind of answered yourself there. As a project grows, or with more stuff you have going on, you have a greater chance of frame skip. That means that even though the music stuff is being preformed correctly, there's a chance that if it does get bogged down the graphics side may not get updated. Of course in unlimited mode, or with proper use of timedelta that shouldn't happen. Once I figure out which S your using I'll see if there's not some sort of solution.
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Wed Apr 28, 2010 7:19 pm

Thank you.

I sent you a pm, but I'm afraid you're thinking too complex. The frames are not updated every Construct tick but only in certain situations and only once then. Would be a remarkable coincidence if the processor load would be too high at exactly those moments repeatingly. But I am fond letting you proof me wrong :D
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Wed Apr 28, 2010 8:38 pm

Perhaps its something to do with frames?
Frames are 1 based so if you use 0 it wont work, now you have +1 on the end of your action, and int()to ensure a whole number, but I haven't found where your assigning the return value for the function yet, and I have no idea what mid()means.
[code:21pwo90d]+ Font: Value 'Digit' Equal to 1
-> Font: Set animation frame to int(mid(Function.CurrentUITick, 2, 1)) + 1
[/code:21pwo90d]
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Wed Apr 28, 2010 9:21 pm

[quote="newt":dbxoganm]Perhaps its something to do with frames?
Frames are 1 based so if you use 0 it wont work, now you have +1 on the end of your action, and int()to ensure a whole number, but I haven't found where your assigning the return value for the function yet, and I have no idea what mid()means.
[code:dbxoganm]+ Font: Value 'Digit' Equal to 1
-> Font: Set animation frame to int(mid(Function.CurrentUITick, 2, 1)) + 1
[/code:dbxoganm][/quote:dbxoganm]
Yes they are 1 based and I make sure not to call zero :)

The trick is easy but effective. The musical tick is a value in different ranges, depending on the time signature the user selects. With 4/4 it's a value from 0 to 3, with 16/16 it's from 0 to 15.

To represent this value I use two sprite instances, one for the ten's place and one for the unit place. To get these the number is converted to a zero-padded string, thus getting "01" instead of 1 or "16" instead of 16.

CurrentUITick returns this string. the mid function looks at a string and creates a substring beginning at position with length number of letters. So mid(string, 2, 1) returns the substring with a length of 1 beginning at position 2. If CurrentUITick returns "08" then mid("08", 2, 1) returns "8".

This is converted to a number (int) and the frame number representing the number 8 is 9, so +1 is added (if the returned value were "0" the frame number would be set to 1 etc.)

EDIT: You don't need to create a variable to hold the return value of the function. You are allowed to call the function directly within an expression. Have a look at the wiki:
[url:dbxoganm]http://sourceforge.net/apps/mediawiki/construct/index.php?title=Function_Object[/url:dbxoganm]
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Thu Apr 29, 2010 5:37 am

From looking at your screenshots you are using functions for all your changes. Functions are triggers outside of the eventsheet so they shouldn't be affected by tick speed issued. Every time a trigger is called is should work every time instantly perfectly, but maybe newt is right that because the functions work this way, the function is called and mid event execution the frames might be going out of sync. Is your cpu to gpu ratio low?. Functions haven't been explored by the community enough so people are bound to expereience there issuess. I always found functions calling ofther functions buggy in the past with crashes and such so at least the new builds aren't crashing on you.

Either way, I agree you definately need more information to be able to avoid this. It looks like the type of app you want to make would combersome without more info.
B
2
S
2
G
4
Posts: 259
Reputation: 1,968

Next

Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 0 guests