I'm looking for best way to make Dungeon Keeper style terrain (or better map, I don't want to use Unity terrain editor). For those who don't know this old great game:
I'm looking for best way to script it and a nice way to build such maps after scripting.
PS I'm new to Unity. I know some programming in C/C++/Obj-C and I'm not afraid of complicated answers but please provide some links to the documentation which I should read if your answer is very complicated.
I recently whipped up a 2D grid game. I believe that "the best way" is fairly subjective when it comes to project design, but this approach worked well enough for me. I've assumed you know very little about Unity, but linking the manual/documentation/scripting-reference where possible, and you can hopefully fill in the gaps.
For my game, I worked under the premise that every tile (square) is a separate GameObject.
To start, you'll need a grid to play around with. I wrote a quick script to build me a 20x20 board of tiles, but you can modify it as necessary.
Add the script to an empty GameObject, hook up the appropriate base tile prefab, set the x and z dimension variables, and run the game (click Play) - your board will be created. Then, while the game is still running, create a new prefab in your Project window, and drag the 'Board' object down to it. Then, stop running the game (click Play again). Drag the prefab from your Project window back up to the Hierarchy and you have yourself a board! With this approach, any changes you make to your base prefabs will echo through to the instances in your Hierarchy.
You can read up on the documentation for Transform and Instantiate on the Scripting Reference. One other thing to note is that C# scripts must have the same name as the class contained within. i.e. the script should be named GenerateTiles.cs
Now you have a board, and a means to edit it, you can move onto the player perspective. You could use the built-in OnMouseEnter and OnMouseExit MonoBehaviours, which are called every frame while the mouse is over the Collider (on each tile / unit). You could enable and disable a gameObject or GUI element over the tile from these events.
While working on this prototype, I asked a question on 'finding adjacent tiles in a grid', which I imagine will come in handy when you get to creating some sort of pathfinding logic (as you'll need to know which tiles are adjacent).
You'll also find plenty of other answers about adding components, which you can use to create traps and buildings on a specific tile.
This is mostly a broad overview, giving specific details where possible. Hopefully it'll give you a good start on your project. In future, I'd encourage you to ask smaller, more specific questions, as the answers will generally be a lot easier to digest. Welcome to UnityAnswers!
P.S. Please forgive any typos - I have the flu and a splitting headache to go with!
Will someone be willing to show me a screenshot of their project layout and script variable assignments who were able to get this to work?
When i create a prefab tile object from a generic cube should i name the object i drop into the prefab container the same as the prefab container name?