Skip to content

jess-hammer/dual-grid-tilemap-system-unity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

✨👯 Dual-grid tilemap system in Unity 👯✨

This is a demo of how I implemented a dual-grid tilemap system in Unity 2023.1.11f1

Run the project, then use the mouse buttons to place or remove dirt.

2024-06-08.15-50-02.mp4

It does NOT use RuleTiles directly, but does act similarly to them. It uses a custom script with hard-coded "rules" to control the placement of regular tiles.

The main reasons I love the dual-grid approach as opposed to RuleTiles is because:

  • it allows the tiles to have perfectly rounded corners
  • a maximum of only 16 tiles are required in the tileset, as opposed to 47 (and you could cut that number further down to just 6 if your tiles have symmetry)
  • the tiles are not ambiguous for the player, in that each "dirt" or "grass" aligns with the world grid

One could also argue it's more efficient, since each tile only checks 4 neighbours as opposed to 8. But I haven't done any performance testing so no promises.

I also made a Godot version which you can check out here

It is possible to get a dual-grid system working using custom RuleTiles too, however it did become quite convoluted when I tried. I made a post about it a while ago here if you are curious though.

References

See Oskar Stålberg's original proposition of a dual-grid system: https://x.com/OskSta/status/1448248658865049605

Regular tile cut:

On-the-dual tile cut:

The dual-grid system is also mentioned in ThinMatrix's video, which is what inspired me in the first place!

If you have any questions or ideas for improvements feel free to contact me at jesscodesyt@gmail.com

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages