Polygon: whats better?

0 favourites
  • 11 posts
  • What is more cpu-intensive: 100 objects with 4 polygon points, or one object with 400 points?

  • It depends on what you are doing with the objects.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just simple non-physics collision between the player and the objects

  • Presumably the 100 objects, but again it depends on what they are doing, before and after the collisions.

    Likewise if you have the one sprite with all the poly's moving around, that could add up as well.

  • The object is static, but the layout is rotating

  • I guess that if it's static you are probably planning to use it as ground/walls, so in this case I think it would be better to use invisible tilled-backgrounds as collision. Lots of objects with bounding-box collision are probably faster than one giant collision polygon.

  • It's for my rotary compo game, the level is made on photoshop, and is round. Here's a picture of a level:

    <img src="http://i.imgur.com/h9b6N.png" border="0" />

    Left: the level

    Right: what I'm doing now

    I have to create a sprite for each shape, import into construct, set the polygons and cover the level with them.

    So, right now I have 32 collision objects on a level (12 unique, the rest are instances) and each has 4~8 vertices

  • Consider making the level off-screen and not wrapped around, which handles all the physics. Therfore it would only require one rectangular sprite for all objects.

    Then, take the coordinates of the object your simulating, and bend that around a central point, giving the appearance shown, in a dummy level on-screen.

  • Consider making the level off-screen and not wrapped around, which handles all the physics.

    There are no physics in my game

    And, is there such way to bend objects?

  • What is more cpu-intensive: 100 objects with 4 polygon points, or one object with 400 points?

    It's probably more CPU intensive to use one object with 400 points. It's best to use more objects with fewer collision points.

    If an object is overlapping an object with 400 collision points, it will probably check all 400 collision points in that object. If it is overlapping an object with 4 collision points, it will check just those 4 collision points (100 times less!) and it will skip checking any of the other objects.

    Of course using more objects has its own performance impact, but using lots of collision points isn't very efficient in the engine at the moment, so it's probably better to avoid that. This can probably be optimised in future, but this is how it is at the moment.

  • Alright then, thanks for the help everybody

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