Ashley's Forum Posts

  • Why are tiledbackgrounds more efficient than sprites? Sounds like its best to use them for anything static.

    It's the same rules as Construct Classic. Grids of sprites are incredibly inefficient at two things: rendering, and collisions.

    For rendering, graphics cards are very good at repetitions and can draw a tiled background of any size in about the same time it takes to draw a single sprite. However, if you have a grid of sprites, they're all drawn separately (because it isn't aware that their positions and angles align to make a grid).

    So if you have a 20x20 grid of sprites on-screen, it draws 400 times slower than if you had a tiled background the same size. It could have rendered an entire tiled background by the time it's finished rendering the first sprite in the grid of 400. That's a pretty massive performance hit. So, always use tiled backgrounds wherever you can!

    Secondly, for collisions there is a similar case. To test if an object overlaps another one, it generally has to test if it overlaps any of its instances. A tiled background counts as one instance, and again a 20x20 grid of sprites counts as 400 instances. So instead of making 1 collision check, it makes 400. Again, 400 times slower.

    Imagine if your grid is bigger than 20x20! Even worse! Once more for luck: always use tiled backgrounds wherever you possibly can!

    However, it appears to be making a sprite for each and every value in the array.

    ceil(random(0, 1)) is almost always 1, because ceil(0.0000001) is still 1. It will only ever be 0 when random(0, 1) returns exactly 0, which is basically never, because there are a lot of possible values between 0 and 1!

    You should also know that 'for each element' also triggers once for every element in a 3D array, including repeating the event for each element down the Z axis. If you have a 128x128x32 array, For Each Element is repeating the event 32 times for each 2D cell, which you probably don't want...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • No worries about copyright! Looks good

  • You do not have permission to view this post

  • You do not have permission to view this post

  • Phobos - you're right it's possible to compensate for the time scale by dividing/multiplying all the speed, accelerations etc., but it's often inconvenient. It's also impossible when the time scale is 0, because your dts are all 0 so there's no way to recover any other time scale. With this release, though, you can pause the game by setting the time scale to 0, but still have an animated pause menu by setting a time scale of 1.0 for all the objects involved in the pause menu. I thought it was worth a dedicated feature, anyway.

  • Hey Ash. I can't seem to get the 'CurrentXYZ' expressions to work. Here's a cap... Should this make a grid of tiles, or am I missing something?

    You just made a little mistake, your 'update' event runs before the 'initialise' event, and the array defaults to all zero!

    Just a warning: creating grids of sprites is extremely inefficient! You should definitely use a tiled background as a base, and only create sprites for tiles which are different on top of that, and even then you should still use tiled backgrounds wherever possible.

  • I thought I'd just check, because I seem to have had the occasional problem with this my end.

    Does Construct 2 correctly associate .capx and .caproj files in Windows Explorer? It ought to set the file association when the editor starts up, but I'm not sure it always does. Once you've run the Construct 2 editor, double-clicking a .capx file should never ask you which program you want to launch - by then it should know to launch Construct 2.

    Is this working for everybody?

  • Adobe want to keep Flash alive and Microsoft want to keep Silverlight alive - they'll probably coexist with HTML5 for a couple of years (while declining) before the web catches up and makes them redundant.

  • There seems to be a lot of hacking going on these days - at least they're definitely proving the point everyone needs to batten down the hatches and make sure their websites and software are secure

  • - There is also no "change motion angle" action.

    Isn't that equivalent to the "Angle of motion: Set" action? I changed some terminology along the way to try and make it clearer. As for the other points, I'll see if I can add the omissions for the next release.

  • Edit: Thats weird, maybe i missundertood, but it doesnt work for me the clicks in paralax layers.

    I thought I fixed this, can you post a .capx where it doesn't seem to be working?

  • Download Construct 2 public preview 43

    Link to release 42

    New this build: time scaling and five new behaviors!

    Time scaling is as per Classic. If you haven't used it before, you can create slow motion effects by setting the time scale to 0.5 (half speed). It's also great for making a pause function - set the time scale to 0 and everything stops, but events are still running.

    A new time scaling feature for C2 is you can set individual object's time scales. For example, you can have the entire game go in to super-slo-mo (time scale 0.2), and keep your player on normal time (time scale 1.0). The whole world is going slow but you can run round at full speed!

    Four of the new behaviors are pretty straightforward, but there's also the custom movement. This is a fairly basic version of the Classic one but hopefully should cover essential features. I'm afraid it's also not well tested - Davo wrote the original in Classic so I'm not familiar with the code, and haven't tried everything out yet. Try it out and let me know if you have any problems or if there are glaring omissions.

    Here's a little demo using the custom movement to make an asteroids type space movement: custom movement demo.

    Image editor on the way, honest!

    Changelog

    • [Feature] Time scaling. New system actions: Set time scale, Set object time scale, Restore object time scale. New system expression 'wallclocktime', which is the game time unaffected by any time scaling that may have happened (the ordinary 'time' expression increments at a different rate if the time scale is not 1.0). New object expression 'dt' to return dt at the object's own time scale.
    • [Add] 'Custom movement' behavior. Trimmed down version of the Classic behavior.
    • [Add] 'Scroll To' behavior, which automatically scrolls to an object. If added to multiple objects, it scrolls to the mid-point of all those objects (the average of their positions). Also has a 'Shake screen' action.
    • [Add] 'Destroy outside layout' behavior, which simply destroys the object if it leaves the layout area.
    • [Add] 'Bound to layout' behavior, which stops the object leaving the layout area.
    • [Add] 'Wrap' behavior, as per Classic, makes objects reappear on the opposite side of a layout when they leave.
    • [Add] Array: 'For Each element', as per Classic
    • [Fix] Previewing with Firefox sometimes opened different tabs with "C:\Documents", "and", "settings\..."
    • [Fix] Error messageboxes during export/preview sometimes opened under the main window which was confusing - now they're always on top
    • [Fix] Mouse object: detecting clicks/mouseovers on objects on a parallaxing layer did not work
    • [Fix] Using shift+enter to write a multiline comment didn't expand the comment to be big enough to fit all the text
  • You do not have permission to view this post

  • If you can't do it by the ordinary IRenderer methods, the only thing I can think of to do is then call IRenderer::GetDevice() which returns a IDirect3DDevice9* (but returns a void* in the SDK so you don't need the headers). Then you'll need the full August 2008 DirectX SDK (IIRC). Using the device directly is tricky since the runtime expects to have full control over it - make sure you restore any settings you change.

  • Doesn't strike me as unusual! "Construct is a program that makes games", "We make games with Construct"...