How do I lock frame rate

Just started using Construct 2? Post your questions here

Post » Mon Apr 11, 2016 12:55 am

so its not possible with a repeat loop to eat up time then huh?

I figured it had to do with the every x seconds event
I just didn't want to have to use it in every piece of code
B
13
S
6
G
1
Posts: 150
Reputation: 1,962

Post » Mon Apr 11, 2016 6:44 pm

If the loop is big enough it will eat up time. The idea I posted is a possible way to tune the length of it. Changing the numbers could give better results. In the end it's just a random idea. I probably would never use it, instead i'd go for the every x seconds idea.
B
94
S
33
G
114
Posts: 5,359
Reputation: 73,779

Post » Wed Apr 27, 2016 1:25 am

@R0J0hound can you explain more on how to tune the loop so that it eats the perfect amount of time and doesn't cause lag?
B
13
S
6
G
1
Posts: 150
Reputation: 1,962

Post » Wed Apr 27, 2016 2:31 am

I've never tried it but it should be like what I typed, just tweak the numbers I suppose. However from the sound of it it doesn't work, but no matter, it was something to try.
B
94
S
33
G
114
Posts: 5,359
Reputation: 73,779

Post » Wed Apr 27, 2016 2:47 am

maybe @Ashley or @Tom would know how something like this could be done?
B
13
S
6
G
1
Posts: 150
Reputation: 1,962

Post » Wed Apr 27, 2016 5:02 pm

It needs support from the browser to do it properly. Star this issue for support in Chrome: https://bugs.chromium.org/p/chromium/issues/detail?id=522983

I would *strongly* discourage you from spin-looping with an event. This is the very most obnoxious waste of battery life, spins up fans loudly on laptops, and will bog down the whole system unnecessarily.

BTW, even if properly supported, it wouldn't target specific framerates like 15 FPS - it would be "quarter v-sync mode" instead. If you're on an 80 Hz display it would go 20 FPS instead of 15, which is probably better anyway, since if the framerate isn't an integer fraction of the refresh rate you'll get an uneven refresh pattern which usually looks pretty bad.
Scirra Founder
B
399
S
236
G
89
Posts: 24,546
Reputation: 195,436

Post » Thu Apr 28, 2016 1:17 am

hmm well what I'm trying to accomplish is choppyish movement, kinda like a grid.
I know I can wrap all my movement code in a wait statement but this wouldn't work with behaviors like path finding
also how do I star the issue?
B
13
S
6
G
1
Posts: 150
Reputation: 1,962

Post » Tue May 03, 2016 11:44 am

I can't help but feel that there may be another way to do what you want, since capping to a lower framerate is either impossible or very difficult to accomplish without an enormous amount of nonsense. What exactly do you mean by "choppyish movement, kinda like a grid"? Exactly why do you need the game to look 15fps? Do you have any example videos of something you'd like it to look like? I'm wondering if we might be able to come up with some kind of completely different method that doesn't involve framerates at all.
Image



Coming soon on Steam!
B
16
S
9
G
3
Posts: 209
Reputation: 3,476

Post » Wed May 04, 2016 6:06 am

I recommend you just roll up your sleeves and do the work of remaking the behaviors you need as events, with the every x seconds condition.

That said, a workaround is to use an invisible placeholder sprite (seems to apply to a lot of problems). Have this invisible sprite run behaviors as normal, smoothly. Set your visible sprite to the placeholders sprite's position every 0.25 seconds.
Mistakes were made.
B
53
S
27
G
114
Posts: 1,699
Reputation: 64,446

Previous

Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest