Is it possible to create an infinite Tilemap from a single tile?

Not favoritedFavorited Favorited 0 favourites
  • 4 posts
From the Asset Store
Each tile 64 by 64 pixels - Ultimate Tile Set for your awesome games
  • Hi,

    I have a single 64×64 tile that I want to use as the background ("limbo") of my game.

    I'd like this tile to repeat infinitely in all directions (positive and negative X/Y), while still being able to use the Tilemap expressions and functions to read and modify tiles at any position.

    Is there a way to achieve this with the Tilemap object, or is there another recommended approach in Construct 3?

    Ideally, I'd like to avoid defining a huge fixed-size Tilemap beforehand and instead have something that can behave as if it were infinite.

    Thanks!

  • Probably one way to do it would be to create those 64x64tile tilemaps as needed, and make some functions to read/modify tiles. The functions would serve as a way to select the correct tilemap from an xy. They could also be a good place to create a new tilemap when accessing a tile from somewhere that there isn’t one.

    All that’s left is to create the missing tilemaps when scrolling around. But you probably could do that with some tile accessing.

    At least that’s a rough initial idea.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here's a demonstration of the idea. It takes any tile xy and in turn picks a tilemap chunk containing that tile. If there is no chunk there it creates one. Events have some particular picking rules in relation to newly created objects so I added a uid cache that's cleared every tick to fix that.

    dropbox.com/scl/fi/798zsobcdg72pt5cx8dcg/infiniteTileMap.c3p

    If you want to change the chunk size or tile size you'll need to change the 64 and 16 in the expressions. Also, you should clear the tiles in the editor if you want it to by default be empty.

    Anyways, that's the idea. There are many different ways you could tweak it. Or maybe someone else may have a different idea.

  • Hi.

    I used to do this through the usual "TileBackground", often checking if there was nothing in the field of view, then I spawned. Rarely checking if there were unnecessary ones, then I removed them.

    In this example, the field of view and the size of the tile map specifically have small values ​​so that it is visible how it spawns and is cleared when the player walks.

    fex.net/s/0tzfbfz

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