Grid map

This forum is currently in read-only mode.
From the Asset Store
Snap to visible grid - perfect solution for any game genre
  • If I were to use a grid (tiled) map, what would be the most efficient implementation?

    So far I've been experimenting with the array object. It is robust enough, within each element I can store specific tile data even on Z layer (sky/ground/underground). Fine and dandy.

    Now, the problem arises when I try to populate the layout with those tiles or their graphical counterparts. If I create an instance of tile graphic for each given tile, the number of instances quickly rises into hundreds! Soon you have thousand objects on the layout. I highly doubt this is the correct approach.

    For example, on 640x480 layout with 32x32 tile size there would be 20x15 tiles, which amounts to 300 instances. Now imagine I add flavors, such as transparent objects, terrain features, NPCs on top of all that.

    Surely there has to be a more elegant way? I intend to build a game map of 100x100 tiles, smooth scrollable and all that. Now that is a scary amount of instances...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can cut down a lot of instances by using tiled backgrounds. Things like grass, dirt, roads, etc., are generally made from repeatable textures. Just stretch them to fit, they tile automatically.

    And you don't have to, say, have a section of grass on one tile, then a section of road, then another section of grass on the other side... you can have one big area of grass and just lay a road on top of it down the middle.

    Just be smart about how you place your tiles and you should be fine. Especially since static tiles, by defenition, generally don't move around. You're not going to get much of a performance hit unless you have thousands of moving objects.

    My advice: just build a test level and see how it runs.

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