fisholith's Forum Posts

  • Hey McDonald,

    One way you might approach it, is to run a loop every tick, to simulate the next several frames of motion updates on a "ghost" copy of your ship, dropping dots or particles as it goes, to draw the predicted orbital path.

    How it would work

    Suppose you have your "real" ship, and you have event code that describes how its position and velocity will be updated each tick (C2 frame). I'll call this event code the "update formula".

    So, on a tick, you update the "real" ship position and velocity by running the update formula on it, once.

    Now, suppose you also have a "ghost" ship. (The ghost ship will be invisible to the player.)

    Right after you update the "real" ship's position and velocity, you set the ghost ship to the same position and velocity.

    Now you run a loop with 100 iterations,

    and in that loop, on each iteration you update the "ghost" ship, by running the update formula on it, and then you place a dot object at the ghost's current location.

    Result

    Each time you go through a loop iteration, you step the ghost forwards in time, exactly as if the real ship were continuing frame-by-frame on its trajectory.

    At the end of the loop's 100 iterations, you have 100 dots tracing a predicted trajectory 100 frames into the future.

    Pros & Cons

    As a possible concern, depending on the complexity of the update formula, and the specs of the platform you're targeting with this game, this loop could be a rather intensive spot in your code, though on a typical computer I think it shouldn't be a problem at all.

    That said, this method has the advantage of using the same update code you've already created for the "real" ship, and as a result, it will be an accurate simulation of the real ship's future motion, not including player control input, of course. :)

    Optimizations

    If you need to use fewer objects, you can always place a dot every other loop iteration, or every 5th iteration, etc.

    Or you could use a canvas object and paste dots (or trace lines) directly into it, which has the advantage of using 1 dot object no matter how many iterations you do.

  • Thanks for the replies everyone.

    And thanks for the suggestion ASHLEY. I'm going to try doing a kind of running average over time of the frame rate I think. When directly using 1/dt with no temporal averaging, I tend to get some sudden single-tick spikes where 1/dt = 1000+, which throws off the max frame rate a little. :)

    I think as long as the game isn't running stably at a strangely low fps, it should work for guessing the monitor refresh rate decently.

    Thanks again. :)

  • Thanks for the reply Kyatric,

    I was afraid that the monitor refresh rate might have been hidden beyond reach from within a browser.

    Hey Somebody, you might be able to get some optimization by placing large amounts of run every tick code inside a group that runs every other tick, or every forth tick, in effect making some of the more intensive code run at around 30 to 15 fps. It would probably depend on the code though.

    As for the frame cap, I may be wrong, but it looks to me like C2's frame draw rate and event sheet tick rate can both increase beyond 60 Hz, to match monitor refresh rates greater than 60 Hz. Though the monitor refresh rate must be set before the game is launched. I don't know if this is normal behavior, but it seems to work on my system pretty much the way I'd expect.

    I recently reworked the movement and animation math in one of my games to make it frame rate independent, specifically so it would run correctly at both 60 Hz (for my older monitor), and 144 Hz (for my newer monitor).

    Beyond 60, so far I've only tried 85, 120, and 144 Hz refresh rates, though I mainly work with C2 at 60 and 144. In each case, it seems that C2 is forced to run events and draw frames at a rate matching the monitor refresh rate.

    Again, I could be misinterpreting what I'm seeing, but just now as a simple test, with my monitor set to 144 Hz, I created a sprite, gave it the "Drag and drop" behavior and then dragged it around the layout in a preview.

    In the Node Webkit preview, I got a C2 frame update matching every draw update of the windows hardware mouse pointer. Albeit with a one frame delay, because it's the hardware pointer after all, but I appear to be getting 144 updates per second from C2 none the less. That is, the sprite steps exactly the same distance as the hardware pointer with every C2 frame draw. If the mouse pointer was updating at 144 Hz, and C2 was updating at 60 Hz, then the sprite would be getting updated less often, and would need to step over a larger distance to keep up with the mouse pointer.

    In the Chrome preview, I got pretty much the same thing. 144 Hz.

    In the Firefox preview, I got a choppy mess with very little matchup between C2 frame draws and hardware pointer updates. The frame rate repeatedly went well below 60 fps, but that's pretty much what I always get from Firefox. Maybe I have Firefox configured wrong, or maybe it just doesn't like HTML5, either way C2 seems fine on every other browser, so I don't think it's an issue with C2.

    Okay, I actually just went back and added an FPS read-out to that test, via "every second, set text to 1 / dt".

    Node Webkit and Chrome show an average of almost exactly 144, and Firefox is closer to 90 on average, but fluctuated wildly, going as low as 20 fps every few seconds.

    On the off chance my system specs are important, I have Win 7, a pretty good Nvidia card, and variable refresh monitor with a max of 144 Hz. I can provide more detail if needed. Though other than the monitor refresh rate, I'm not sure what might be especially important.

  • Is it possible to get the refresh rate of the monitor?

    From what I've seen C2's tick rate seems to match the monitor refresh rate.

    I'm building a real-time scrolling FPS graph, and I would like the max value on the graph to be the monitor refresh rate.

    Often the refresh rate will be 60, but there are also 120, and 144 Hz monitors (among others), and it would be nice if the graph could automatically adjust its max, to match the monitor refresh rate, when started.

    I know I might be able to guess the refresh rate by tracking the average frame rate, but I'm hoping to avoid that kind of solution if possible.

  • What if any command line options should I use with the new, separately downloaded, version of Node Webkit?

    In the last version of C2 that came with a bundled Node Webkit version, after exporting my game to an exe, I used two command line options that helped with performance and compatibility on several systems.

    --disable-threaded-compositing

    This fixed a Webkit issue that caused regular freezing and hitching that would stall a game for between 1 and 10 seconds, which would happen a few times a minute for as long as the game was running.

    --ignore-gpu-blacklist

    This allowed my games to run on Windows XP, in cases where the default exported game would show up as a blank screen.

    Ever since upgrading to the newer version of C2 for which Node Webkit is downloaded separately, using "--disable-threaded-compositing" results in a solid white screen.

    Just wondering if that means Webkit solved the problems I mentioned above, and the command options are no longer needed, or if I need different options now, or if I need to change some settings in C2.

    Any thoughts or suggestions are welcome. :)

  • Awesome thanks :)

    I figured it might be some kind of optimization.

  • Hi all, :)

    After updating Construct 2 to r190, several of my projects no longer show certain WebGL effects during runtime preview.

    I haven't investigated this very much yet, but so far this seems to occur in situations where I'm using an empty layer with an effect to post-process the underlying scene.

    It seems like, as of r190, a layer with an effect applied to it won't render unless there is also an object on that layer.

    Is that maybe what's going on?

    If so, it's not necessarily a problem. I'm just trying to figure out what I need to do to get everything back to the way it looked pre-r190.

    So far, I'm just putting an invisible stub object on every post-process layer to make sure it renders.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the replies Rayek and Embedding developer info is a good suggestion. I honestly wasn't expecting game jam entries to make it that far. Also thanks for the tutorial link, valdarko.

    Thanks for the Whois suggestion I'll look into that.

    And, thanks for the DMCA info Ashley and

    You guys are awesome. I really appreciate all the suggestions and advice. :)

    Weird update:

    When trying to get back to the AtomicGamer page, I inadvertently came across PlayerAttack.com, which also has a copy of one of my games, and it looks like they may have copied it directly from AtomicGamer. It's exactly the same outdated version found on AtomicGamer. Likewise, a third party on AtomicGamer had added a few lines of their own description to my game, and that third party description was copied word-for-word by PlayerAttack.com. PlayerAttack seems to differ from AtomicGamer in that they put my game behind embedded video commercials, instead of charging for download acceleration, like AtomicGamer.

  • Thanks for the advice

    I think I may contact GameJolt soon and see if they have any suggestions.

    Hey A0Nasser, :)

    I created distributions of my game for HTML5, Windows, OSX, Linux32, and Linux64. The Windows version is the one that was copied.

  • Very good point.

    Thanks again

  • Hey all,

    I'm not really sure what to do here. :/

    I recently created a few games for game jams, and I just found that one of them was taken from GameJolt (where I hosted the game) and uploaded to AtomicGamer.com (which I'd never heard of until minutes ago).

    No one contacted me to request permission, or even to just tell me that they were doing it, and my game is now being hosted on AtomicGamer.com, with no attribution to me. No developer is listed, and no credit is given. I don't know why that information wasn't simply copied from my GameJolt page, since my entire game description was copied verbatim from the same page that lists me as the developer.

    What concerns me even more is the considerable difference between how I released my game, and how AtomicGamer.com is hosting my game. I released my game for free, with no registration of any kind required to play it, and yet...

    AtomicGamer.com is offering a download of my work, without crediting me, and placing the download of my game behind a queue timer on their server, and in the download popup, AtomicGamer informs you that you can bypass the queue timer, to download my game immediately, if you pay them money.

    I don't want to assume there's any malicious intent here, it may just be a mistake on their part, and I try to give people the benefit of the doubt, but I haven't been releasing games for very long, so I don't know what to think.

    The whole thing makes me uncomfortable. :/

    Any thoughts or suggestions are welcome.

  • Thanks for the info <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

    Do you have any advice on which way to go if I want my list/tree interactions to be fast?

    1. I think arrays could work, if I link them together to form more complex structures. The first thing I was considering building was a plugin like the C2 Dictionary, but with each key linking to an array/list instead of a single value. That said, hash tables are actually closer to what I was looking for, so objects might be a good approach as far as performance goes.

    2. Good to know. Yeah, JQuery looked like it was mostly aimed at DOM traversal and other webpage-y stuff.

    3. JSON would be pretty nice if its not too slow.

    1a. Do you know off hand if deleting a property from an object is likely to change its performance?

    Quite a while back, I read about interpreter optimizations that assume that objects are usually used for OOP, for which property deletion is unlikely. With interpreters being optimized for that purpose, interaction with an object takes a permanent performance hit upon the first deletion of a property from that object.

    The only thing I could find about this was a discussion of the Chrome engine from 2009, so it may not be an issue any more:

    (see time 8:16) http://channel9.msdn.com/Shows/Going+De ... al-Machine

    3a. How fast is JSON compared to using objects for data structure purposes?

    For instance, with JSON, I'm not sure if the underlying code is moving between nodes by following references, or if it is actually parsing its way through large segments of JSON text. I would think that parsing text would be the slower method in general, but even if JSON is doing everything via text, for all I know it could be getting some kind of special treatment by the interpreter.

  • Hey all, <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

    I'm considering creating a plugin/behavior that provides linked-lists or tree-style data structures.

    I'm okay with building a list system from scratch if necessary, but if there's any list-type stuff natively accessible from within the C2 runtime, I'm also happy to just use that and avoid reinventing the wheel.

    So if anyone knows off hand...

    1. Does JavaScript have native data structure functionality or libraries?

    2. Does jQuery? (available from C2 runtime I think?)

    3. Should I consider using JSON?

    4. If "yes" to any of the above, are they usable in the C2 runtime?

    It looks to me like there may be generalized data structure tools available natively in JavaScript, and possibly JSON stuff in the standard library.

    (e.g. see "Keyed collections" https://developer.mozilla.org/en-US/doc ... structures)

    But I don't know if it's usable in the C2 runtime, as I'm not sure if there are any important support issues with different versions of JavaScript that I should be aware of.

    Any thoughts or advice welcome. <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

  • Awesome! Thanks for the info volkiller730 and ASHLEY.

  • Hi all,

    1. Does anyone know if an Xbox One controller will work with C2?

    2. If it does, are there any weird possible pitfalls I should be aware of?