Making big games on C2

0 favourites
From the Asset Store
Make your own platformer for both the web and mobile easy with this Santas Platformer Template, FULLY DOCUMENTED
  • Um, collisions would still be checked every tick, so thats a nope.

    Also "for each" with distance() is contrary to most optimizations, even done sparingly, as its a loop, and the filtering method of "is on screen" should do all of that.

    If you need to check a bigger area than the viewport check the objects xy's, like objectx< scrollx- n, and objectx> scrollx x+n, and objecty < scrolly-n, and objecty> scrolly+n.

    Perhaps a better method would be in a behavior similar to the Line of Sight. Ashley ?

    In fact that behavior may serve better in some situations.

  • Construct 2 already has a very efficient collision engine using collision cells. Read the link for more info.

    Putting conditions after a collision test does not change the number of collisions tested, and putting conditions before a collision test can disable the collision cells optimisation and actually result in more work. So I'd just trust the collision cells system to do its job and make collisions fast, you can't really beat that by events (other than not testing collisions at all). Also if you don't test any collisions, then disabling collisions has exactly zero performance impact.

    Also note "For each object" obviously does per-instance work, so will not scale well with very large numbers of objects, even if it's ostensibly to make things faster by turning off features.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ashley

    so what approach would be the best for i.e. big platformer level,

    with i.e. 100 enemies, each with "Platformer behavior"?

  • Also note "For each object" obviously does per-instance work, so will not scale well with very large numbers of objects, even if it's ostensibly to make things faster by turning off features.

    do you have any advice how to work around "For each object" ? i have the feeling that in many cases you cant circumvent "For each object" events. For example in a turn based game im working on i have to pick the NPCs whos next, for that i needed an "for each object"-(UID=Turn) event.

  • so what approach would be the best for i.e. big platformer level,

    with i.e. 100 enemies, each with "Platformer behavior"?

    I have no specific advice. It should work OK whatever you do.

    do you have any advice how to work around "For each object" ?

    The only way to avoid per-instance work when picking objects in events is to start the condition with a 'On collision' or 'Is overlapping' condition, which uses the collision cells optimisation. All other conditions will pick from the full instance list (across the entire layout). Alternatively, completely destroy objects that are far away instead of trying to deactivate them with events (since you will need per-instance work to figure out if you need to reactivate them yet).

  • Thanks!

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