Chowdren: Fast Construct runtime for consoles/desktop

  • I know of Chowdren from Fusion 2.5 . I've tested it when it was open source and the performance was better then default exporters and it had plugin support for more platforms.

    While more performance is always better, the most important feature is the support for ALL major consoles.

    Is not just a wrapper, it basically translates your game into native (C++)

    And the fact that it even get better performance in HTML5 then the default C2 is something

    I'm curious how it will compare with the new C3 runtime.

    Keep up the good work.

  • Well, you repeat the same complex formula 14 times in the events for what appears to only produce a varying Y offset, and it's bottlenecked on that. Those are super inefficient events. You should be able to easily optimise that to do one expensive calculation for the base, then simply offset the other slices vertically.

    @Ashley. I took a look at the example and it's actually pretty well optimized as he's taking advantage of containers. If you do it any other way you are forced to use For each loops and that becomes the bottleneck if you have many moving objects. In order to do what you're suggesting more efficiently there needs to be a way to associate multiple objects like container works, without using for each loops.

    Here's my attempt at optimizing, and it just gets more heavy since you are forced to use for each loop.

    https://www.dropbox.com/s/ej6xwj4qwi672 ... D.c3p?dl=1

    Using containers is a nifty trick but it will make the project messy and hard to work with in this case.

    By the way.. I think i found a bug as well... Changing to C3 runtime for the project and layout rotation doesn't work with A & D keys.

  • I actually played around with the Fake 3D project whole day yesterday trying to optimize it. As mentioned the biggest performance sink seems to be for each loops, unless you do like SnipG did in the latest example, seperate all frames to seperate objects and add them to a container. Although it works it's a very cumbersome way to work if you have many slices and objects.

    I think Construct is definitely missing some form of group/parent/hierarchy node that would make these kind of things a breeze. Just attach instances to to the parent, with an Y offset. Currently not possible. But i think it's being considered: https://construct3.ideas.aha.io/ideas/C3-I-12

    Even an updated pin behaviour could do the trick, but not in this case since it's very limited in it's current form as it doesn't take any inputs at all. If you could pin to a object with an offset controlled by an expression, Pin would work fine, and would probably be the most effective way, since behaviours in general are a lot faster than events.

  • Here's an optimised version: https://www.dropbox.com/s/ps1bfsng4fvl8vt/test007-opt.c3p?dl=0

    This only supports middle click to spawn and then A & D to rotate (it's quite a big project and I don't have time to go through it all). The key is:

    • use family instead of a container, with family variables for the base position and "sliceframe"
    • pick using IIDs upon creation to make sure the family variables have the right base position set (this is a little awkward especially since it has to use a next-top-level-event after creation, but it only needs to be done once in this demo)
    • save unchanging parts of the expression in to local variables

    Then updating the position can be reduced to a single 'Set position' on the family with:

    X: Self.FBaseX + (Self.FSliceFrame + zmultiplied) * cosLayoutAngle

    Y: Self.FBaseY + (Self.FSliceFrame * zmultiplied) * sinLayoutAngle

    Testing with 3000 car objects - which is a total of 36,000 objects to update - my results are:

    Original project:

    C2 runtime: 17 FPS

    C3 runtime: 34 FPS

    Optimised project:

    C2 runtime: 23 FPS

    C3 runtime: 60 FPS

    So despite there being tens of thousands of objects to update, the optimised project + C3 runtime can hit 60 FPS (on my system, at least).

  • Ashley I checked your example, and it runs fine here, but the problem arises when you need to set Family:Self.FBaseX & Y for every moving car. It's one thing to do it one time on a click, but when you have to update all of the slice positions to the base, you have to use For Each, and there's no other way around it.

    Your example works great for static objects, but when those objects are moving for each becomes the bottleneck. The Container approach actually performs better for many moving objects, but is a mess to work with.

    https://www.dropbox.com/s/7rumquk5ufj0b ... t.c3p?dl=1

    Container example: C2 runtime - 200 moving objects. 45% CPU usage (60fps)

    Container example: C2 runtime - 200 static objects (just rotating scene) 33% CPU usage. (60fps)

    Ashley Optimized example: C3 runtime - 200 moving objects. 100% CPU usage. (15fps)

    Ashley Optimized example: C3 runtime - 200 static objects (just rotating scene) 15% CPU usage. (60fps)

    Maybe there's some features I'm not aware of, but I can't figure out any sensible and cheap way to move a lot of cars in this example without using containers. Disabling the for each loop, and the events no longer work.

    If C3 had some feature to reduce the reliance on for each loops so you could pick or associate several objects much like how containers work, that would be the biggest performance boost in my opinion. There's so many times I got stuck and wish I knew how to create plugins and behaviours so I could get around those high level for each loops.

    Don't get me wrong. What you're doing with the C3 runtime is Amazing. But in this case I think this is not really a performance issue, but rather a lack of feature issue. In those cases it's better to rely on Behaviours (and Container workarounds) because they loop instances a lot faster, but there's not behaviours for everything, or the built in ones are overly simplified, and not very flexible.

    Crossing my fingers on some nice new features to get around using for each loops in events. Keep up the good work!

    Edit: Updated numbers with some higher count.

  • tunepunk I 100% agree with what you are saying, you've said pretty much what I would said

    update: felt there were too many compromises made in the project, that it would be prove to be unreliable.

    this was recorded from just previewing the same project

    most of the slices in the cars end up being ordered on top of each other

    and then getting misplaced when the cars stop or start moving

  • I was just messing around to see what can be done without families containers or for-each loops.

    Here is 1000 transparent boxes rotating and individually moving in X and Y.

    60FPS on my surface pro 4 with its crappy integrated graphics.

    https://drive.google.com/file/d/1j-YplM ... sp=sharing

    not a fair test but interesting.

    I think most of these "how many objects" performance tests so pointless.

    1) because how many objects to you really need?

    2) add all the game logic behind the scenes in the form of events to make an actual game and that is where you see the real performance hit.

    From my experience with C2/3 it is how all those events compile into JS when you have that whole game engine running is where you get the hit.

    And that appears to be where Ashley is making the optimizations for C3.

    Which is awesome.

    Anyway I am rambling and a little sozzled so I will shut up.

    Chowdren tho !

    construct games on PS4 tho.... OMG !

    Now If I could only make a game good enough.....

  • I tried out some versions with family and container. Family version on my pc had 1000 obj ran 48-50fps, container ~40, i mean just rotate. After last C3 update it sure does run faster on C3.

    My test could had mistakes, but maybe if container had own variable, could it run same fast as family or it makes no difference?

    Btw thous example projects in this post have disabled solid on base sprite, which doubles you cpu usage vs if you remove it, only if you enable car movement.

    Anyway could someone with Chowdren do some optimized test to?

  • I think most of these "how many objects" performance tests so pointless.

    Well. Pointless in one sense but extremely useful when finding bottlenecks. You might never push any real project to move 200 objects with slices at once, but it's pretty obvious that in scenarios like this you do stumble across some odd stuff that might lower the overall performance of your game, so you find ways to use those things sparsely, or work around it to have your game perform at it's best. Who wanna play a slow laggy game? If your games runs well on lower spec hardware, that's more $$$ because more people can play it.

    When it comes to game design in general, games often tend to push the limit of what the hardware can handle, even if you're targeting Mobile or desktop. Either some are more gpu heavy with breathtaking graphics and effects, or other awesome features. It depend on the idea. I would rather have my idea limited by the code rather the hardware. Code can always be optimized, but with hardware you have to wait for the next new tech.

  • I sent an email over. Looking forward to getting a response

  • NotionGames Thanks! I'll be in touch.

    I've updated the main post after the recent forum move.

    Also, a bit of news: I have 3 major Construct 2 games running on the Nintendo Switch using Chowdren. If you'd like more details, you can get in touch :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • matpow2 Impressive list of plugins which are supported, keep up the fire!

  • matpow2 OMG I didn't know you were working with C2 now Mathias! I sent you an email, and I hope to stay in touch.

  • matpow2WoW! Nice work boys!

    We, too, wrote you and waiting for answer!

    Thank you!

  • Since some developers have asked me about it, I've looked at what it would take to support C3 under Chowdren. Luckily, it turns out that supporting C3 when used with the C2 runtime is trivial. Here is Bunnymark, exported from C3 using the C2 runtime, and running under Chowdren:

    (video)

    Supporting the C3 runtime is a different matter, but it should still be doable. The C3 runtime uses a very nice and exciting expression compiler, but this will require some extra work for Chowdren to support. If someone has a use for Chowdren using the C3 runtime, please let me know!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)