3D Isometric Grid Based System, a feast of questions;

Hello community, earlier I asked in the IRC channel about one or two of my specific questions but I am a little stumped. I have done extensive searching on the subject and unfortunately have found nearly nothing relating to this. So my various questions are below, I appreciate any time you may spend reading these questions and would even greater appreciate some assistance.

Table of Contents

  1. 3D Isometric Camera
  2. Character Controller (Specific)
  3. Non-Playing-Character Interaction
  4. Basic Enemy AI / Path-finding
  5. Grid Based World
  6. Equipment Graphic Change

1. 3D Isometric Camera Character

I have seen multiple threads on this and the standard responce seem's to be along these lines;

For an Isometric camera: Create an empty GameObject called 'CameraTarget' at (0,0,0). Create a camera at (0,0,-10). Parent the Camera to the CameraTarget. Set the rotation of the Camera Target to (30,45,0) then check 'Orthographic' under the Camera settings. Adjust the > 'Orthographic Size' camera setting to change the amount of zoom. Move the CameraTarget around the world to change the focal point on the map.

Which is all well and good, however I need to make it so that the camera alway's focuses on one character; as in, when the character moves in a direction it follows, which will be mentioned later on when I get to my grid related questions, so the kicker here is; how do I make it so that the camera constantly focuses on the character who should alway's be in the center of the screen?

2. Character Controller (Specific)

Alright, seeing as how everything in the game will be running off a grid, I do not want to have eight-directional movement, I only wish for enemies and the player to be able to move in four directions;

  • Up
  • Down
  • Left
  • Right

The question and principle is simple, however I do not quite understand how I would limit the player to this system, following on from that I only want the player to be able to move in one direction at a time and at one grid-square per-move. I was told this has something to do with 'Lerpz' but I am unsure.

3. Non-Playing-Character Interaction

A very basic concepts of all game's is interaction with NPC's but I am unsure of how I should go about doing this, now; I want the player to be able to double click on the square that the NPC's sprite resides on and it to open a context menu that has various options as depicted in the bellow figure;

NPC Context Menu

The other issue here is limiting the distance between the player and the NPC that way you must approach the NPC, and be within one grid square of his/her current position before the NPC will respond. When a failure to communicate with the NPC occurs, I would like a small notification to pop up that says something along the lines of '(X) doesn't hear you.'

4. Basic Enemy AI / Path-finding

When it comes down to it, I do not need very much for this, each enemy will have two functions;

  1. Spell Cast (Range Limited to Enemy Sight)
  2. Melee Cast (Next to the player, Simple Assail or Skill Usage)

How would I make the enemy cast a spell if it has the required Energy and is within sight-range, and if that fails or the prerequisites are not met, it will venture to path-find via the grid system to you and then begin attacking with melee? The system doesn't have to be very intelligent, in fact a basic model would suit this project as it's nothing too hard-core strategy related. Ideas?

5. Grid Based World

To quickly recap, the entire world is mapped and played out on an invisible grid, using only one elevation level and two different tile functions;

  • Open (Can be walked on.)
  • Closed (Cannot be walked on.)

Simple enough for the most-part but it's gotten a little more complicated, how do I render a grid to design the world in beforehand, and when that is done, how would I make it so that when the cursor hovers over an open grid-square a small cursor icon appears similar to a move-to icon. The reason the world is grid-based is because I have a tile set of images I intend to / would like to use.

6. Equipment Graphic Change

This one is a quick one, how would I make it so that when an item is equipped using an inventory or character panel script the model of the player changes to reflect this, assuming I have all of the models needed for it to be changed?


Wow, that's a long list. If you're serious about getting answers for these, either try and split them into several questions here, or try and open a thread on the forum.

You can send me a message if you need help, and we'll schedule time to chat in Skype or IRC, since typing these answers in while covering all bases will take hours...

Really briefly:

  1. You're looking for Transform.LookAt() or a script called "SmoothLookAt.js". I think you can find it in the the 3rd person platformer tutorial (which has Lerpz - the character in it).

  2. You're not gonna limit the person since you're simply not going to use the standard controller. You'll need to write one much simpler that when you allow it (it's a player's turn or whatever) - will move the player a fixed distance in the direction selected, while playing an animation of walking.

  3. This is a simple Vector3.Distance() check between the player's and the NPC's positions when clicking the mouse on the NPC (which will be done by adding a collider to the NPC and using the mouse event OnMouseDown()). I won't go on about the GUI since it's a whole separate issue.

  4. If there are obstacles, you'll need some path finding library like AngryAnt's Path. If not - simple coroutines that will move the character to a desired direction for some amount of time. Check out Vector3.Lerp() for that.

  5. Way too many ways to do this, and no chance to explain any of them in one line.

  6. This is a simple method call from inside a GUI. You reference the game object of the character in the script that runs the GUI. When something changes, you call a method on a script that's on the same game object as the character with a parameter which says which model should be selected. The old model is destroyed, and a new one instantiated instead of it. Again, so many ways of doing it...