- Home /
3D Tilemap
I am quite new to Unity, but I know (game-) programming for a few years now. Until now I only made 2D games with SFML. As a start I did a Tutorial from Unity3d.com and now I want to port one of my 2D games to 3D in Unity.
The game is a Tower Defense Game which is based on a tilemap. So I want to create a tilemap on wich the camera is pointed in an about 50-70 degree angle. The map has to have different heights, which means the path where creeps walk is lower than the area where you can build the towers. My main problem is how I can create this tilemap. I googled quite a bit for the right solution, but most of the hits where a tilemap in 2D. The other ones where a bit confusing, because they mentioned a bunch of different solutions. Some said I should use meshes, others told me to use a heightmap or other ways.
So was is the best approach?
To make it clear, the path should be something a canal for ships, but just for creeps. And really important is, that I can lower or raise different tiles while playing. Just imagine a flat area in minecraft and for the path, imagine the player can "dig" the path into the flat area. I hope you can understand what I want to create :)
I really appreciate any help :)
Answer by Cherno · Nov 06, 2014 at 08:37 PM
If your gameworld is rather small, you can get by with instantiating nad destroying prefabs to create your terrain. For more complex stuff, you will have to look into mesh generation by script. Also search for procedural generation (think Minecraft).
Thanks for the help. I am looking into mesh generation right now. But what should I do if I don't want my world to be angularly, but smoot and with "round edges"?
This is probably the definitive thread on all things Unity-$$anonymous$$inecraft-Clone-related. Try to look over it if you are serious, it has lots of bits of information scattered throughout.
As for your question: How your mesh looks is entirely up to you; $$anonymous$$ost simple generators go for the cubic look, but you can just as well create not faces with 4 vertices, but anything you want. You can even take the mesh data of an existing model and use it for our generated mesh. This will come in handy if you want more complex stuff like stairs or slopes where you would have trouble creating each vertex by script. Look into the thread linked above, one of the more recent posts by me deals with it.
Also look arond for other procedural (voxel) terrain engines, you will see that there are some that look very life-like with smooth ground etc. but with a voxel structure underneath.
Your answer
Follow this Question
Related Questions
What technique for tile-based 2D game 0 Answers
Import a 513x513 Texture2D (heightmap) 0 Answers
Getting multiple heights at same (x,y) coordinate 1 Answer
Lightmapping and Diablo3-style big-tile levels 1 Answer
Tilemap2017 Access position & sprite of specific Tile in new Grid System 2dGame 1 Answer