Tile Map System - JR 01

Tile Map System

image

Flowlab Game Creator - Tilemap Test

I’m back with another complex system that will hopefully be useful for anyone that can use it. This isn’t my first time making a tilemap, but this is my first successful 8-way check tilemap system. Before, I use to use Raycasts to detect 4-way checks, but Raycast would never work for 8-way checks and can cause a lot of lag from the physics engine. So after a Pizza asked if there is a way to tilemap without Raycasts, I had an idea and went to work. I’m pretty satisfied with the results.

I have 2 examples to show off this system. The link above shows the sprite system that will automatically set up when you play the game. But a huge drawback is that the animation plays only after all the objects have been registered which takes a few frames and looks ugly.

The second example is an export setup for this system, this will make it where the tilemap as soon as the game starts and also has more features. The export system is explained below with a video and steps, but I only suggest using the export after you finished with your game setup.


4-way check vs. 8-way check

image

When I made tilemap systems, I’ve always used the 4-way check which allows up to 16 total combinations and 12 animations set in this example. Now with this new system, we can do an 8-way check which allows up to 256 total combinations that I have set to 20 animations. Both bundles are available in the example.

8-way checks allow up to more customization such as ledges, platforms, columns, and other possibilities with changing the expression. I’ll probably make an update later for several different expressions to allow different/more animations that are sorted from the 256 possibilities.

With the Type option, I can have different objects/maps that help separate or blend maps together. I may later make an update that allows using a mix of several types together.


Animation

Tilemap preview

The Animations here is actually a single animation called “Tilemap”, and we choose which frame to use with the frame input on the animation behavior. With this system, it’s important that the animation frame is in a specific order.

When making your own tilemap, make sure the animation order matches the object you are using (4-way or 8-way object).


Exporting the System

Exporting has a separate example link:

Flowlab Game Creator - Tilemap Export

  1. Import the Tileset, Tilemap, and Animation bundle into your tilemap object.

  2. In your game, make a new object and call it Export and place it in every level you have. Then Copy the List Export and Map Export into it.

  3. In your tilemap object, go into your tileset bundle to set the type for the map (leave 1 to map with other mapped objects). Set the same Type value in the Tilemap bundle where it says “type Search”.

  4. Go to the Export object on every level and run the level, then press “Space” to get the level list in you clipboard. On every level, you will import the level list in the “Map Export”. You will have many lists.

  5. After getting a list from every level, connect the join inputs and outputs as shown already. Then run the game and press Enter to put the Master List in your clipboard.

  6. Now into your tilemap object and go into the tilemap bundle, import and replace the list in that bundle. And then the Tilemap should be working if you set up the animation like I have.

  7. You can delete the “Export” object from your game, and the “tileset” bundle in the tilemap object.


How it works (long)

Each mappable object saves its x and y value as a single value that gets put into a list. I can also edit this value to say what level these objects are on, or what type these objects can be/check.

Then after all objects are in the list, I can make checks to see if there are objects anywhere around the object. By using the same setup as above, I can use the current location ±32 for a new value and check the list if it’s there.

Each check uses binary values that add up a total that is used to set the animation of the block. I can check these values and create rule sets by which bit is being used (I learned bitwise operations).
So now the 8-way check is using all 256 values for the 20 animations (frames).

For the export to work, I need to set the list to include every level in the Master List. To do this, you would export a list behavior for every level, and then combine those to export a Master List that is used in the tilemap bundle.

Setting Types will help separate different object maps from merging because these types are added to the list. I would like to be able to allow several types at the same time that would be better to control. Look out for updates to these examples.


If you have any questions, feedback, or what you think on this, leave a comment below!

10 Likes

Flowlab has been needing one of these for a while lol great addition, and fantastic work!

7 Likes

Can you make open world games with this?

1 Like

It’s an animation mapper, you can do this for any game if you want to add a tilemap to it.

4 Likes

Ok, thanks.

2 Likes