Using Tilemap For Turn-Based Tactics


#1

I’m very interested in making games like Fire Emblem or XCOM, so I’m doing a lot of research into finding the best way to implement such a system into Unity. I’ve seen quite a few tutorials and frameworks for doing this, but none of them use Unity’s Tilemap system. Instead, a custom system is created with the tiles individually added. Granted, these solutions exist on versions of Unity that don’t have Tilemap.

So here’s my question: Is there a way to use the current Tilemap system in Unity to implement a turn-based grid-system? If so, how?


#2

Yes, I’m curious about the same thing. I’m trying to do something similar, and would like some guidance on using the Tilemap feature in Unity specifically for top-down world-building, and top-down turn-based implementations, akin to XCom, Ultima, and the like. I’m at a point where I think I can handle learning the process, I’m just not sure exactly where to look for guidance. i’ve done the beginning tutorials on Unity3d. Just looking for some more.
Maybe Ben can teach a class specifically on Tilemap! (hint hint!)


#3

Tilevania gives you the essentials to create a top-down game. The player controls need to be edited, the physics turned off, and the “platform layer” can be reworked into a “buildings layer”, but a top-down game akin to Ultima should be viable. You’ll just need some sprite assets and tiles. As for the actual grid-based combat…

Until @ben and his team come around to this specific type of game, these are some of the resources I’ve been using in the meantime to slowly understand the process:


Unity TBS Framework
It’s only $15. A light investment for a very useful framework.
https://assetstore.unity.com/packages/templates/systems/turn-based-strategy-framework-50282


Unity Tactics Tutorial
Haven’t finished the series, but it’s been pretty useful in filling in some gaps in my knowledge.


#4

THANK YOU SO MUCH! This looks like a GREAT start for me. If I find anything world-shakingly interesting I’ll report back, in case it help you out too.


#5

No problem. I wish you the best of luck!

And thank you in advance. I’ll take all the help I can get.


#6

So I just completed this 1-hour course. The instructor does a great job explaining things. It doesn’t involved using Rule Tiles, but instead takes a more rudimentary approach, which honestly is a good thing. I figure once I get this down, I’ll figure out how to employ the Rule Tile system.

Unity 2017 - Tilemap tutorial


#7

I forgot to thank you for the Tilemap Tutorial. I learned quite a bit from it, so really. Thank you. Also, I found something I think might be useful if you ever want to implement a grid system using the existing Unity Tilemap system:

I already made quite a few modifications to the code, but if there’s any questions you might have, feel free to ask. You will definitely need to do some reading on A Star if you want to implement this. There are a couple of YouTube tutorials for it. Hope this helps!


#8

thank you so much!
you’re welcome too.
I’ve been trying to work up how to do a 2D tile-based game, and as of a few minutes ago, I was able to create a multi-tilemap, randomly generated world map. FINALLY. Thought I’d never work through the issues.

My next goal will be getting the colliders to work (so far, I can walk over mountains without issue GRRRR). Then, I imagine I’ll start on pathfinding.

I need to look into AStar… I’ve seen references, but I really don’t yet know what that is.
Thanks for the help, stay in touch


#9

Hmmm. For your collider issue, let’s assume you put all obstacle related tiles on one tilemap layer called ‘Obstacles.’

In that case, you can assign a Tilemap Collider2D. From there, you add a Composite Collider 2D and set the Tilemap Collider 2D to ‘Used by Composite.’ At this point, Unity should also have added a Rigidbody2D component as well. Set that to static.

Overall, assuming your player has a collider and rigidbody, the colliders should all work.


#10

Turns out the colliders are working… a little too well. I walked into the known issue of 2D Box Colliders “sticking” to each other. Haven’t found a way to make it work, but I went a different way with it.

Player has rigidbody, and 2d collider, and the mountain tilemap has a static Rigidbody2D, Tilemap Collider2D and a Composite Collider. when the player enters an adjoining tile, it just sticks to it. Wish I could make it work the way I feel it should. I tried several work-arounds (edge colliders instead of a box on the player, for ex), none of which worked.


#11

I’m not sure what the problem is. Can you send some screenshots and explain further?


#12

It turns out that this is a known issue. Say you have a square , with a box collider, that moves onto a similar square with a box collider, they will get stuck. Someone from Unity chimed in on a forum post about this, and said there is not currently a fix… only work-arounds. Doesn’t make sense to me why this would work this way, but oh well.

If you want, I can try to package up a reasonably-sized Unity package of what I’m working with, and you can play with it.

What I’ve done is create a set of random tilemap generation scripts, with the starts of biomes and such. The main skeleton of what I’ve created has the roots in Unity’s “Scavengers/RogueLike” game, with the exception that it uses the Tilemap system. I don’t know if it’s the best way, but it’s the way I came up with :slight_smile:


#13

Sure. I don’t mind messing with it. Send a package over if you get the chance.

Remind me again, what kind of gameplay are you going for in this package?