nikolatesla20's Forum Posts

  • Ok I found some a "nickname" plugin that will probably work for what I need, better control over random item generation:

  • Hi,

    See this capX for what I mean.

    It should spawn the same object over and over but it doesn't.

    What am I not understanding here?

    https://s3-us-west-2.amazonaws.com/nikotwenty/TestObstacleSpawn.capx

    -niko

  • I really hate having to push W to fly up. Can you change that to space bar?

    Otherwise, good work so far!

    Needs some sound fx for when you get hit from a blue guy

  • Lol. Not bad!

    It would be awesome if you added some kicking in there too!

  • Help the Chiwawa escape bathtime!

    Run through the yard hitting mud puddles leaf piles, and bones (some as power ups) to get dirtier. Watch out for your owner though! He's right behind you!

    http://nikotwenty.itch.io/chiwawa-escape

  • Hi all

    So for now I fixed this problem by just using a constant every frame and ignoring dt altogether. Yes this means if the framerate slows down the game will too. That's fine IMO. (that's how all old school 2d games worked)

    IMO many people use the whole multiply by delta time wrong. It is parroted over and over on the internet that you need to use it, but it causes more problems then it solves.

    For one, you won't have determinism at all (you need a fixed time step for that - something that construct 2 can't really do at all...well, you can do it if you want to sacrifice some frames)

    Secondly, ANY small change in framerate will cause "jerks" in motion because even though you *think* that multiplying by delta time will make your object maintain a constant speed, that's now how it works in the real world. Human eyes are very sensitive to small changes in motion like that (not to mention floating point errors), and that is the jerkiness I was seeing.

    The best thing to do if you do want to use Delta time is to smooth it, don't use it directly! If you use it directly, and something causes a bunch of frames to drop, suddenly your objects will jump to a new position and the player has lost control (like I said, it's better to just slow down a bit rather than "jerk"). So if you want to stick with delta time then smooth it with the say, last 10 frames of dt, and use a running average as your dt, and not the instantaneous dt.

    I still argue that just coding the game to be framerate dependent is best for 2d games. Especially on the iPhone where you know it's going to be 60fps cap. And most android phones these days are too. You could code the PC version to be delta time , but mobile should just use frame dependent to look better (or better yet, it should have two threads, one is the "physics" constant time, the other is the renderer itself with interpolation)

    But seriously just multiplying everything by dt is only gonna cause problems in many, many cases

    two good articles (besides the traidtional "fix your timestep" article)

    http://www.learn-cocos2d.com/2013/10/game-engine-multiply-delta-time-or-not/

    http://bitsquid.blogspot.com/2010/10/time-step-smoothing.html

  • Hi Ashley, thanks for the response. Yep you're right, not much can be done about it right now. I'll just go with coding it all regular Thanks for the info

  • As an example,

    This code should lock to 30FPS.

    Anyone else every play with this type of thing?

    http://imgur.com/SeVqUyK

  • Ok..I really wish Construct 2 had a way for me to lock the FPS to something like 30.

    My problem right now is I have a game where the entire screen is scrolling pretty fast. On PC is is 100% smooth. However, on mobile it "janks". In other words, randomly, the mobile device will decide it needs to do something else, causing the game to miss a few frames. When it catches back up, the scrolling "jerks" to catch up of course (its based on delta time). This "variance" in FPS looks bad and causes the game to lose "flow".

    It's not the game that's the problem and in fact it's not really WebGL or HTML5 that is the problem. I also used to see this problem with OpenGL / C++ game I made a while back.

    The problem is on a mobile device it's hard to get a 100% consistent 60fps SOLID, and any change in framerate will cause "jank" (even if the movements of things are tied to delta time, they still won't appear to update in time visually).

    If I could somehow lock the game's FPS , or Tick, to 30 times a second, I think this would solve the problem, because any variance would be "covered" over by the lock - it could handle the variance by just subtracting or adding when it needed to, if you know what i mean.

    I did experiment a bit with putting my own event in that watched delta time and basically "divided" it down and used that for movement. It seemed to work, but I don't recall if it was very effective or not.

    Has anyone else seen this "jank" that I'm talking about? It's not due to the game I made nor due to how many objects there are. Because I can make a test game that is only one background image scrolling over and over, and you'll see the jank. Its more to do with the CPU of the device taking time to do other things while the game is running.

    A lower FPS lock would give a frame "buffer" of time that could make up for any slight variances. trying to play at 60FPS does not, and will be extremely senstive to any change in frame rate, visually. (Objects still move correctly, but you will see a "jerk" in the motion because the frames are either being drawn twice, or it skips frames for a a couple frames)

    -niko

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Purchased the plugin pack yesterday, waiting eagerly! I know it says will respond in 24 hours..but I realllly want to finish the leaderboard part of my game

    EDIT: I didn't know this was on the SCIRRA store, so I used the old paypal method that was on your original link

    PLEASE send me the URL link! I purchased under the name nikolatesla20

  • Ok, here's what seems to happen.

    If you reference the Function.Param AT ALL , BEFORE the wait, it will then remember it.

    So, this looks like some sort of reference count or object hold or something

    Here you can see, I still have the wait in the function , but I grab the Function.Param(0) before waiting. NOW the code works correctly again!

    Unexpected!

    Still getting used to the way Construct 2 does things, very different from traditional programming

    http://imgur.com/WwoII6p

  • Whoa,

    It looks like if I put a "Wait" at the beginning of a function, it loses its parameters. I didn't expect that...

    I tested this by putting two textboxes on the screen. The first text shows me the UID of the newly created object.

    Then after the "Wait" in the function, I set the second text box to "Function.Param(0)"...and I can see it is ZERO!

    So it lost the value that was passed in, after the Wait!

    Maybe I should store the value in a local varaible before a wait if I did this?

    I'm just curious on how things work and in what sequence in some cases. I would not have expected a function with a wait to lose it's parameters

  • Hi,

    I have a game which randomly generates some items and I'm working on trying to make sure the items don't ever overlap each other. Do do that I was calling some functions to do rectangle intersection testing (using BBoxLeft,BBoxRight, etc, in expressions)

    The bound box code seems to work, but sometimes the objects don't move like I would expect, I think its because they have "just been created", and I'm encountering the infamous "can't pick properly after creation" issue or something.

    (references:

    and

    )

    One thing I don't understand 100% is the "Wait 0 seconds"...."trick".

    I put together a small test capx essentially that creates a red sprite randomly anywhere on the screen, and keeps doing so. But after it creates it, it calls a function to take all the rest of the red sprites that already exist, which belong in a family, and tells them all to turn "black" essentially, *IF* their "ID" property does not equal the newly created red sprite's UID.

    The weird thing is, this works if you put the code in entirely straight as all sub events.

    And it also appears to work even if I call a function to do the for each, the new red box stays red, while all previous ones turn black.

    However, if you insert one single "wait 0" in the beginning of the function, now even the newly created red box turns black too! Which to me doesn't make sense..the "ID" property of the red box is set ..

    You know what..maybe it's because the function loses its parameters because a "wait 0" goes around for another tick? Maybe the parameter ends up being "empty" or zero? Thus making the condition true for ALL red boxes now?

    Screenshot below, of the setup, and the "Wait 0 " in place. If you take out the Wait 0 it works correctly.

    http://imgur.com/unYwp4H

  • Looks like I can also use BBoxLeft,BBoxRight, etc, in expressions too. But I didn't even think of your idea, good one!

  • Just curious if the event "is overlapping another object" uses collision bounds, or if it uses sprite box.

    I actually need to check sprite box, so I may have to handle that myself in an expression of overlapping only checks collision bounds