Those heavy Polygon collision points

0 favourites
  • 4 posts
From the Asset Store
Connect the dots in the correct order and draw happy animals!
  • Hello guys ! You've probably heard of Dolly, a beautiful little indie game available recently (otherwise, you should). As an amateur working on a platform game, I wonder how can I have something like that on C2 with some physic in it, and I'm curious to hear your opinions about that, and your opinions about my opinion. Indeed, this one involves (eventually) some memory issues, and as we know, memory is sacred.

    More precisions. Here's a pic from the game, we'll use it as our example for this whole topic.

    Now some statements :

    • Everything on the Foreground is physic (let's pretend you have to dodge the leaves. I love being cruel)
    • We can, of course, have as many layers as we want
    • We can use whatever physic behavior we want (if your prefer Box2D or Chipmunk or Crayon...doesn't matter)
    • We can use Tile Maps and Tiled Background (personally, I will not)
    • Every platforms is a new different object, not the instance of another (just to treat that as an extreme case)

    So now, here's how I'll try to make it runs :

    number of layers : 3

    • Background (contains the drawing of the sky and its clouds. This drawing is a sprite that I use as background).
    • Intermediate (contains the drawing of the moutains and the sun. Once again, it's declarated as sprite).
    • Foreground (contains the others sprites, which are physics platforms and character).

    number of families : 1

    • Phys, family which contains every single sprite supposed to be physical. This family has a physic behavior. As you may understand, she contains 8 objects (the player, the leaves and 6 platforms). They're all immovable, except the player.

    Okay. The simpler platforms have "bounding box" as collision shape. But for the more developed structures like the one on the left, I'll use Polygon Shape and end up with a beautiful but heavypolygon of 20 points or more. I'll use Polygon Shape for the column too, even if I could use bounding box for them as well. Now, I have my physical objects. I just have to make some controls in the event sheet to move my dude and it will be ok I guess. It should looks great with some parallaxes.

    But is it clever to proceed this way ? When I read something like this :

    https://www.scirra.com/blog/112/remember-not-to-waste-your-memory

    I suppose the answer is no, but then how to deal with complex objects when we're on a physic project ? And is it so problematic if we have one or two objects with more than 8 collision points somewhere ? I really question my approach. Even the background for example, you can't use a tiled background for such a detailed drawing, can you ? I really wonder

    Well, here we are. I'm curious to know your own approach, and especially know if mine is correct or if it's a total mess of logic and/or memory. I always did my little games (when they use physic with a detailed background, I mean) with a similar method, so I wonder if it's finally worth or not. How to optimise it if I have a bunch of objects like the one on the left for example ?

    I wait your comments, advices, and opinions folks, thanks !

  • Hey,

    Simply, for mobile it might be an issue, but for desktop no.

    This is unclear to me thought:

    • Every platforms it's a new different object, not the instance of another

    You just make objects and you should reuse them as often as possible.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks ! I'll take note. I'll wait for other's opinions too !

    [quote:1686wrsg]You just make objects and you should reuse them as often as possible.

    Yeah don't worry I know ! This is just another difficulty to cover another extreme situation. Just a Test !

  • The collision point thing is mainly a recommendation, and mainly relates to C2's collision detection system. The physics behaviors use their own collision detection system if that's of any concern. Overall I'd just test it and see if it works fast enough for your liking. If not simplify your collision polygons.

    The other aspect you're testing with big backgrounds and one instance per Sprite will just use more video memory. You can leave it as is and if it works, great, but the memory requirements for your game will be higher which limits what systems can run it.

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