Need advice for my player movement :)

  • Hi all, I'm working on a side on WW1 trench game and I'm having trouble with the movement of the soldier sprites. At the moment the soldiers have a platform behavior and are using the 'simulate control' action. The problem is the collision checks go extremely high (>1000 PER TICK!) when only a few soldier sprites are present. In the attached image the red dotted line shows the collision polygons of the ground tilemap and the red squares are the Trench colliders that register when the soldiers are in a trench (there are only 2 on the layout).

    I was wondering if anyone could give tips on any potential alternatives to the platform behavior that accomplish the same movement (able to move in and out of trenches and horizontally on the flat parts), or any optimizations to the platform behavior that make it viable.

    At the moment I optimize by disabling the soldier's platform and collision behavior when they are stationary. This drops collision checks to 0 when applied to all soldier sprites. Obviously this isn't an effective solution because the sprites spend most of their time moving.

    Any advice would be greatly appreciated, also while you're here what do you think of the look of the game?

    :) Cheers

  • You can try one of these behaviors:

    construct.net/en/forum/extending-construct-2/addons-29/behavior-ground-follow-enhance-121813

    construct.net/en/forum/extending-construct-2/addons-29/box2d-platform-behavior-v1-08-130321

    It's odd that the collision checks count is that high. Are you sure it's 1000 per tick, not per second? Could you share your project?

  • Hi dop,

    Yea it really is that high (1621/tick) with only 6 total platformer sprites! The only 2 collision based events in the whole project are "GreenSoldier on collision with TrenchCollider" and "BlueSoldier on collision with TrenchCollider. I just realized i'm running a very old version of C2 (version 243) on this PC so I imagine that has something to do with it, I'll be updating in the coming days.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Try disabling events one by one and see which one is responsible for most collision checks. If you can't figure it out, please post your capx file.

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