R0J0hound's Recent Forum Activity

  • I think your first post is mainly due to how the time of collision will vary according to the framerate. With a low framerate the objects can be overlapping a fair bit when a collision is triggered. With a high framerate the collision will be triggered closer to when the object just come into contact.

    Framerate independence mainly just ensures the motion is consistent between collisions for any framerate.

    Here's a test of different ways to do the integration for projectile motion, aka jumping. It also tests what they do at some different timesteps. The first method undershoots at lower fps, the second overshoots, the third is perfect at all fps, and the last is wrong.

    I also compared it with the platform behavior, and it is using the perfect method when jumping off the ground, and actually is improved over how it was in C2.

    The difference between jumping in the air, and jumping on the ground could have something to do with the logic to handle moving platforms but that's just a guess.

    Actually looks like it's using method 3 when on the ground and method 4 when in the air.

    ucf683f86ba8ece860b1d723d134.dl.dropboxusercontent.com/cd/0/get/CiCo96lL5jhMeHwXsgfuquP8_cndmHy2oyvnLVNryVMGXu-V98VWZj7TWeLVsWXjoppqHLPZd2yTlfI565u4tq5_swIfpBsC8PpZzJdojJBr21w__32JVSb7EqyvLlhm_LMMfgJJ-4Xvlg2yzsD97INs/file

  • The blocks are in contact with each other so they count as overlapping.

    The triple loop isn’t bad since the amount of iteration get lower rather fast.

  • You can do a flood fill on the grey blocks. Start at a random block, then flood to the connected. Repeat until you have each group of blocks marked. Then It's mostly the matter of picking that group, and using picked count for the factor.

    There may be other ways to do it too.

    uce49610dba1d392b853fc86e450.dl.dropboxusercontent.com/cd/0/get/Ch7AUgjTyiNzYlVov7fkD4YjsUjP0JKV9x-68hP2wzY0v6u2pRJbhwWj6VAkI8xYI-PIbRhkss9wQCnWCfz1Da9IeEnPu4TVjJFYqRZA9LNKEK-sCLmrGr6NQYcA07XH_UuJL8LIWnvXaydlnVHFBjiv/file

  • It seems to work. It renders half as many frames per second in a consistent manner, and according to the task manager the cpu usage is cut in half more or less as well. It was made completely separate from construct though. But render loops are often similarly done, so it was meant as a possible reference if the devs should want to revisit the idea. If not, it's no worry, I'll likely use it later.

  • I do remember the jank encountered in previous attempts, but I think it might be possible to avoid that. Dt seems to vary a bit per frame. At 60fps it should be 0.0166 but I've seen it lower to around 0.0163 in my tests as an example. My idea is we can skip frames if dt is less than some target framerate, but instead of checking if dt<1/30, we let it be approximate with say dt<0.3. I coded up a complete test to check my idea and on my 60hz screen I was able to get this. Super janky with dt<1/30, but smooth with an approximate value for 1/30 like dt<0.03.

    It gives the high and low dt, the average dt of the last 128 drawn frames, and a little graph of the dt times for the drawn frames.

    And here's the relevant animation loop. The only remarkable part is the frame skip.

    let prevTime=0;
    function gameLoop(newTime)
    {
    	requestAnimationFrame(gameLoop);
    	newTime/=1000;
    	let dt = Math.min(0.05, newTime-prevTime); //20fps min to account for tabbing away
    	if (dt<0.3) // skip frame if dt isn't at least approximately 1/30.
    		return;
    	prevTime=newTime;
    	tick(dt);
    	draw();
    }
    requestAnimationFrame(gameLoop);

    It should work the same when cpu/gpu load causes frames to be skipped. The only thing that would need testing is how it would behave with other screens with higher refresh rates. Anyways, just an idea.

    Edit:

    0.3 is fairly arbitrary as a lower value than 1/30. dt<1/maxFPS-1/480 may work better, at least should work for refresh rates up to 240.

    dt<1/30-1/480

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The only place I’ve seen anything to limit the fps is on the construct discord the user mikal made something to do that. Haven’t used it and not sure if there’s any limitations with that plug-in.

    Officially I think the devs tried to do that before but weren’t able to get anything that worked well. Maybe they will revisit it since it seems to be requested more as of late.

    I don’t think there’s anything that can be done with scripting to limit the fps. The render loop is controlled by the construct runtime and that part isn’t exposed to the scripting api as far as I can tell.

    I can think of one roundabout way to limit the fps but it’s more of a trick and doesn’t work with most of construct. The idea is the screen will only redraw if things change, so you could only move or change things every other frame or so. But as stated above that won’t work with most behaviors or other things that normally update every frame.

  • Here are some ideas:

    construct.net/en/forum/construct-3/general-discussion-7/better-text-input-170179/page-2

    One is to just use a bit of JavaScript to get keyboard input. It gives a bit more than what construct offers.

    A second idea is to use a textbox with 0 opacity. It will act just like a normal edit box but you draw manually.

  • What doesn’t work about it? Doesn’t this work?

    On f key pressed
    Control key is down
    — do something. 
  • You could do a timer with a variable. Something like this. It adds 1 when you click but makes a timer 0.2 sec later. After that it will add 1 quickly. There’s probably a more refined way. Basically you could just have a timer count how long the mouse button is down.

    On sprite click
    — add one to value
    — set sprite timer to time+0.2
    
    Left mouse is down
    Mouse over sprite
    Sprite timer >time
    — add 1 to value
  • You probably could do it with just the text using find(), but since you want to remove words once they are found it could get slow to replace stuff. We want to do it in a reasonably efficient way. Like dop said, it's useful to first parse the words out of the text and add them into a dictionary. You can even store the number of times each word occurs in the dictionary.

    1. parse the text to get all the words. Each word and the number of times that word is seen is added to a dictionary. This can be done over multiple frames.

    2. Random letters are typed. We only need to keep track of no more than the length of the longest word in characters.

    3. Then just use right(keys, 1), right(keys, 2), right(keys, 3), ...etc. to get a possible word and see if it's in a dictionary.

    uc963dc3e329a847946df11922b1.dl.dropboxusercontent.com/cd/0/get/Ch8YXmVmO5BRNeFkfvEGXBWrKFCT7Jfpw66zUxA2qqDL7pmzUiVsz9WXdS-4_ypOkLE-_Rp5mBVQfvwSviAgqn2bnaQbsNnvpyi-xkzI_O3Fg7Eq5cOH-LfRe2DncoAibygE1YDR_4mpmcknADS0xV-Z/file

    Seems words longer than four letters long are seldom found, but that lines up with the probability.

  • Move to changes the position and the other sets the velocity but you can set the speed at an angle with this:

    A=angle of motion

    Vector X = -20*cos(a)

    Vector Y = -20*sin(a)

    Add it to the previous xy to be more like an impulse.

R0J0hound's avatar

R0J0hound

Member since 15 Jun, 2009

Twitter
R0J0hound has 155 followers

Connect with R0J0hound