Handling My Game Board

Board Game Development Help

Sorry for the long post, I tried to keep it tight, while still including all pertinent information.

I’m working on a sort of board game and I’m planning out how I’m going to handle everything behind the scenes. I’m a pretty experienced programmer but this is one of my first real Unity projects, so I figured I’d come here to see if anyone more experienced with the engine could add any insight to what I have planned.

The board game doesn’t actually exist but, for our purposes, let’s call it chess. It’s a game with different kinds of pieces on a grid-like playing field. Right now I’m working out how to handle a player select their piece and then select the place for it to move to. Here are the issues I’m tackling:

The Board (!)

I plan to do much more with the board once I have everything working but right now all I need is a standard 10x10 board. Right now, it’s built out of a prefab I made called BoardSquare. I then put them in a 10x10 arrangement and created a prefab out of that called GameBoard.

The beginning of the game allows the custom placement of pieces so the board will start empty, but each BoardSquare has a var which keeps track of which GamePiece (another prefab representing a player’s piece) is occupying it.

If someone has a better suggestion for this, they’re welcome to chime in but the main thing hanging over me right now is the relation between the different BoardSquares. Right now, I have an easy way to get at the BoardSquare’s GamePiece and vice versa, because they store one another as variables. What I need is an easy way to get at surrounding BoardSquares for things like checking where a piece can move.

I have an idea for this but I’m not confident in its efficiency. For the BoardSquare prefabs, I’d like to store variables for ‘up’, ‘right’, ‘down’, and ‘left’ BoardSquares, so that if I have my hands on a BoardSquare, I can easily ‘traverse’ the board by simply accessing its variables.

I had a similar idea where I could simply store references to the BoardSquares in a GameBoard array(100), so that if I wanted to get at (3, 4), I could just access GameBoard.boardArray((3*10) + 4 - 1).

Finally, I considered naming the BoardSquares based on their board coordinates, so a name would be ‘BoardSquare_3-4’ and then I could just locate them using ‘.find’. I am convinced this is not the best way, haha.

So those are my options at the moment. The first idea seems kind of intense but it would be very convenient, and shouldn’t cost an excessive amount beyond the initial storage of the references. The second idea involves storing fewer references but each time I want information, I need to get at the BoardSquare’s parent GameBoard then access a potentially huge array.

Player Selection (!)

NOTE: This game will initially be constructed for use with a controller, so the player will be navigating with arrows and/or a control stick.

For player selection, I plan for the GameBoard to keep track of whose turn it is, as well as the BoardSquare that has already been selected, if any, and which square is highlighted for selection. If no square is selected already, any valid square is fair game (a square occupied by a movable piece, some pieces can’t move). I’ll start the highlighted square somewhere and then if they try to ‘move’ the selection left, I’ll check the squares to the left for another valid square. If it finds one, I switch the highlighted square to that one, etc. (everything will be handled at the square level because they will probably be linked in some way and they always exist, even if they are not occupied by any piece)

If the player selects a highlighted square, the GameBoard stores that square as ‘squareSelected’ and then turns on a variable called ‘possibleMove’ or something like that (I’ll have to work out the difference in appearance and terminology between 'highlighted, ‘selected’, and ‘possible move’) in each square that the occupying piece could move to. Now if the player tries to ‘move’ their selection up, I’ll check if the square up has ‘possibleMove’ as true. If it does, I can change that to the highlighted square. If they select anything, the GameBoard will see that there is already a selection and it will therefore compute the movement of ‘selection’ to ‘highlighted’. Once the original selection is cancelled or a final move is made, I can reverse the highlighting of possible moves on the ‘selection’ so that they appear as they did before in preparation for the next turn.

One problem here I can see is trying to select possible moves to the right of your selected piece but you have an upwards square highlighted. The algorithm I describe would not be able to get to it. I could either change the logic or allow all squares to be highlighted still and just not allow them to be selected as a move. I could also allow the piece selected to be highlighted in addition to possible moves, providing a center point to pass through. It might be best to just always allow the player to highlight every square of the board and simply not allow invalid selections.

EDIT: I see now this same error could exist in my first paragraph of this section. If a player has only two pieces left, say, and they want to select the other one, they wouldn’t be able to if it’s on a diagonal from the currently selected one. Also, I should store a collection of each player’s pieces somewhere in the GameBoard for arbitrary initial selection if needed.

EDIT 2: I suppose I could also store possible moves in the same way I would store the player’s pieces. Then I could create some sort of algorithm so that if the player tries to select to the right and there is nothing there, it can find a best match to the right if any exists in the set.

Movement of the Pieces

This is not as big of a conundrum to me and I will only mention it briefly in case someone has some tips on it. For piece movement, when the player confirms a move, I plan on switching the relationships of the initial BoardSquare, the BoardSquare being moved to, and the GamePiece being moved to reflect the new position. This much is clear.

For the movement, I am simply inexperienced with games. I plan on tracking, within the GamePiece, something like ‘startTime’, and ‘destination’ and using those on each Update() to move the piece closer and closer to the destination until the destination and its location are the same. I’m sure I can work this out but if anyone wanted to throw me any advice on this now, I’d appreciate it.

The Multiplayer Aspect

I haven’t worked much with multiplayer, so once again just fishing for experience before I go exploring on my own. I obviously don’t want the opponent to see the moving player’s selection materials and such. Is there a way to change a material on an object only for one player. Once again, just figured I’d throw this out there, as well, before I start really looking into it on my own.

Also, I’m pretty sure I should try to do this peer-to-peer so I can having to host servers and since it will be a turn-based game. Is that going to be viable with Unity? (just having one player hosting and the other listening to them)

Anyways, thanks so much for taking the time to read! I’d appreciate any help you guys can lend me, especially if anyone’s done anything like this before. I’m just trying to make sure I won’t need to come back and completely overhaul the whole thing later. Cheers!

- Kyle

I will start off my response only to the first section. Creating and building a board. It’s fairly simple in the end run. The way I would do it is to have a “static” class and just simply add and remove from it. It would operate much like a global variable.

Here is some basic JS code in dealing with it. It would not be hard to change it over to C#

import System.Collections.Generic;

class Board{
	static var width : int;
	static var height : int;
	static var size : float;
	static var segments : List.<GameObject>;
	static var tiles : List.<GameObject>;
	
	static function Init(){
		Init(10, 10, 1);
	}
	
	static function Init(w : int, h : int, s : float){
		if(w < 0 || h < 0 || w > 100 || h > 100) return;
		width = w;
		height = h;
		size = s;
		segments = new List.<GameObject>(w*h);
		tiles = new List.<GameObject>();
	}
	
	static function segment(x : int, y : int){
		if(IsOutOfBounds(x, y)) return null;
		return segments[x + y * height];
	}
	
	static function segment(x : int, y : int, tile : int){
		if(tile >= tiles.Count) return;
		if(IsOutOfBounds(x, y)) return;
		tile.active = false;
		var myTile : GameObject = GameObject.Instantiate(tiles[tile],
			Vector3(size * x, 0, size * y),
			Quaternion.identity);
		myTile.active = true;
		segments[x + y * height] = myTile;
	}
	
	static function Clear(){
		for(var i = 0; i < segments.Count; i++){
			if(segments[i]){
				GameObject.Destroy(segments[i]);
				segments[i]=null;
			}
		}
	}
	
	static function IsOutOfBounds(x : int, y : int){
		return (x > width || y > height || x < 0 || y < 0);
	}
}

To top it, here is a basic GameController code that uses it. You would have to initialize the size, height and width of the map, then initialize the tile set. After that you would initiate the map creation (which I did not write, but it all revolves around “Board.segement( x , y, tilenum);”

var tiles : GameObject[];
var map : TextAsset;
function Start () {
	Board.Init();
	for(var tile : GameObject in tiles){
		Board.tiles.Add(tile);
	}
	
	// load the board from a text file.
	// Board.LoadMap(map.text);
}

Hope it helps some.

Thanks so much for the help, I’ll let you know what I end up doing but that helped a lot.

One more question just so I don’t need to start a new thread:

I am writing a script to generate a board for me. I have a GameObject called BoardSquare and I want to access a specific instance of BoardSquare and get at a variable in the script attached to it. I’m using GameObject.Find() to get at the object but adding .GetComponent(“BoardSquareScript.js”). doesn’t seem to work. Could anyone provide some insight into how this works? It seems confused that I’m trying to reference untyped or not specifically typed objects (which makes sense because BoardSquare isn’t a Unity type).

Thanks!

  • Kyle

GetComponent(BoardSquareScript) should work. You don’t even need quotation marks to get at components:

var bss : BoardSquareScript = go.GetComponent(BoardSquareScript) as BoardSquareScript;

That gets the script into a variable with a type, making sure you can access its public variables and functions without errors. I recommend dropping the “Script” part off the name of scripts, too. Sort of redundant, since when is a script anything but a script? :wink:

Depending on language and preference…

GetComponent(BoardSquareScript) or GetComponent(“BoardSquareScript”) or GetComponent()

Also I wouldn’t recommend using a static variable for your board; generally you would only use a static variable if there is a reason to. In this case a specific board seems like an instance of the Board class. This way you can (for example) have more than one board at once, compare boards, (more easily) send boards over the network, etc.

This is what I have right now:

bs = (BoardSquareScript)GameObject.Find("BoardSquare_" + (x + 1) + "-" + (z + 1));
bss : BoardSquareScript = bs.GetComponent(BoardSquareScript) as BoardSquareScript;

I’m getting this message:

Assets/Helpers/GenerateTiles.cs(26,31): error CS0246: The type or namespace name `BoardSquareScript' could not be found. Are you missing a using directive or an assembly reference?

Is the name of you script BoardSquareScript … or is it just BoardSquare.

You generally wouldn’t prefix Script on the end like that, but I assumed you had done so given your earlier attempt.

I think you’re close, but need to clarify something: first you get the GameObject, then you get your script component. So editing your code, the first line must cast to BoardSquare:

bsgo = (BoardSquare)GameObject.Find("BoardSquare_" + (x + 1) + "-" + (z + 1));
bss : BoardSquareScript = bsgo.GetComponent(BoardSquareScript) as BoardSquareScript;

I only did it to make it clear that there was an object called BoardSquare and a script attached to it called BoardSquare. I plan to change it back once I get it working.

Hm, not sure why I was trying to cast the GameObject to a script type. I did make that change, however, and am still getting this:

Assets/Helpers/GenerateTiles.cs(26,33): error CS0246: The type or namespace name `BoardSquare' could not be found. Are you missing a using directive or an assembly reference?

Yeah, I’m sorry, you’re finding a plain old GameObject. Untested again, but how about this?

bsgo : GameObject = GameObject.Find("BoardSquare_" + (x + 1) + "-" + (z + 1));
bss : BoardSquareScript = bsgo.GetComponent(BoardSquareScript) as BoardSquareScript;

Hm, that’s strange. For the line where “bsgo” is defined, it’s now reporting:

The left-hand side of an assignment must be a variable, a property or an indexer

Just for context, here’s what this is part of (GenerateTiles.js):

using UnityEngine;

using System.Collections;



public class GenerateTiles : MonoBehaviour {



   public int board_size_x_;

   public int board_size_z_;

   public Transform tile_prefab_;



   // Use this for initialization

   void Start () {

      GameObject board = new GameObject();

      board.name = "GameBoard";

	  board.tag = "GameBoard";

      for ( int x = 0; x < board_size_x_; x++ ) {

         for ( int z = 0; z < board_size_z_; z++ ) {

            Transform tile = (Transform)Instantiate(tile_prefab_,new Vector3(x,0,z),Quaternion.identity);

            tile.name = "BoardSquare_" + (x + 1) + "-" + (z + 1);

			tile.tag = "BoardSquare";

            tile.parent = board.transform;

         }

      }

		

	  for ( int x = 0; x < board_size_x_; x++ ) {

         for ( int z = 0; z < board_size_z_; z++ ) {

			bsgo : GameObject = GameObject.Find("BoardSquare_" + (x + 1) + "-" + (z + 1));

			bss : BoardSquareScript = bsgo.GetComponent(BoardSquareScript) as BoardSquareScript;

			if(z > 0){

				bss.neighborUp = GameObject.Find("BoardSquare_" + (x + 1) + "-" + (z + 2));

			}

			if(x < (board_size_x_ - 1)){

				bss.neighborRight = GameObject.Find("BoardSquare_" + (x + 2) + "-" + (z + 1));

			}

			if(x < (board_size_z_ - 1)){

				bss.neighborDown = GameObject.Find("BoardSquare_" + (x + 1) + "-" + z);

			}

			if(x > 0){

				bss.neighborLeft = GameObject.Find("BoardSquare_" + x + "-" + (z + 1));

			}

		  }

	  }

   }

}

I used this as a starting point. I was successfully generating a 10x10 board of BoardSquares but I have modified the script attached to BoardSquare to contain four variables called neighborUp, neighborRight, neighborDown, and neighborLeft, which reference neighbors of the BoardSquare, or nothing if none exist in the given direction. So after I generate the BoardSquares, I am going through the squares I made (getting them by their names, since I named them using grid coordinates) and trying to change those variables to reference the appropriate BoardSquare.

How does that even work? It’s a Javascript file, but the code looks like C# :slight_smile:

My bad, I meant GenerateTiles.cs :stuck_out_tongue:

OK, so lets look at the example I gave you vs what you are doing:

You are basically forcing all the data into the current object and using alot of resources to push the neighbors in. On top of that you are under utilizing the power of the List and Mathematics.

So here is some additions to the original Board.js that I wrote to help you compensate:

// Board.js
import System.Collections.Generic;

class Board{
	static var width : int;
	static var height : int;
	static var size : float;
	static var segments : List.<GameObject>;
	static var tiles : List.<GameObject>;
	
	static function Init(){
		Init(10, 10, 1);
	}
	
	static function Init(w : int, h : int, s : float){
		if(w < 0 || h < 0 || w > 100 || h > 100) return;
		width = w;
		height = h;
		size = s;
		segments = new List.<GameObject>(w*h);
		for(var i=0; i< w*h; i++) segments.Add(null);
		tiles = new List.<GameObject>();
	}
	
	static function segment(x : int, y : int) : GameObject{
		if(IsOutOfBounds(x, y)) return null;
		return segments[x + y * height];
	}
	
	static function segment(x : int, y : int, tile : int){
		if(tile >= tiles.Count) return;
		if(IsOutOfBounds(x, y)) return;
		var myTile : GameObject = GameObject.Instantiate(tiles[tile],
			Vector3(size * x, 0, size * y),
			Quaternion.identity);
		myTile.active = true;
		segments[x + y * height] = myTile;
	}
	
	static function Clear(){
		for(var i = 0; i < segments.Count; i++){
			if(segments[i]){
				GameObject.Destroy(segments[i]);
				segments[i]=null;
			}
		}
	}
	
	static function IsOutOfBounds(x : int, y : int){
		return (x > width || y > height || x < 0 || y < 0);
	}
	
	static function GetPosition(x : int, y : int) : Vector3{
		var tx : float = x * size + size / 2.0;
		var ty : float = y * size + size / 2.0;
		return new Vector3(tx, 0 , ty);
	}
	
	static function GetPosition(v : Vector2) : Vector3{
		return GetPosition(Mathf.Round(v.x), Mathf.Round(v.y));
	}
	
	static function GetPosition(v : Vector3) : Vector3{
		return GetPosition(Mathf.Round(v.x), Mathf.Round(v.z));
	}
	
	static function GetNeighbor(x : int, y : int, direction : int) : Vector2{
		// 1 == N, 2 == NE, 3 == E, 4 == SE, ...
		var tx = x;
		var ty = y;
		switch(direction){
			case 2: tx++; ty--; break;
			case 3: tx++; break;
			case 4: tx++; ty++; break;
			case 5: ty++; break;
			case 6: tx--; ty++; break;
			case 7: tx--; break;
			case 8: tx--; ty--; break;
			default: ty--; break;
		}
		
		if(Board.segment(tx, ty)) return Vector2(tx, ty);
		return Vector2(x, y);
	}
	
	static function GetNeighbor(v : Vector2, direction : int) : Vector2{
		return GetNeighbor(v.x, v.y, direction);
	}
	
	static function GetNeighbor(v : Vector3, direction : int) : Vector2{
		return GetNeighbor(v.x, v.z, direction);
	}
}

As you can see, I added in the GetNeighbor method. This will get the GameObject associated with the neighbor of the thing you are on. It’s quick and mathematical, so there isn’t alot of storing of unnecessary variables.

I also added in the GetPosition mathematics so that when you get a point in space it it the center of the available space. This assumes that all of your models lower left is at 0,0, if they are all centered then this code would not do the centering part.

Lastly, I added in some overloaded methods so that you arent forced to use integers all the time.

Now onto what you wrote:

//GameController.cs
using UnityEngine;
using System.Collections;

public class GameController : MonoBehaviour {

	public int board_size_x_ = 10;
	public int board_size_z_ = 10;
	public Transform tile_prefab_;
	
	// Use this for initialization
	void Start () {
		Board.Init(board_size_x_, board_size_z_, 10.0f);
		Board.tiles.Add(tile_prefab_.gameObject);
		for(var x=0; x<board_size_x_; x++)
			for(var z=0; z<board_size_z_; z++)
				Board.segment(x, z, 0);
		
		
		// How to Use this:
		
		// default position
		Vector2 pos = new Vector2(5,5);
		
		// player position is set by:
		Vector3 ppos = Board.GetPosition(pos);
		
		// Get a clicked position:
		Plane plane = new Plane(Vector3.up, Vector3.zero);
		Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
		float dist;
		if(plane.Raycast(ray, out dist)){
			Vector3 rpos = Board.GetPosition(ray.GetPoint(dist));
		}
		
		// press a key to move:
		int direction = 0;
		if(Input.GetKeyDown(KeyCode.UpArrow)) direction = 1;
		if(Input.GetKeyDown(KeyCode.RightArrow)) direction = 3;
		if(Input.GetKeyDown(KeyCode.DownArrow)) direction = 5;
		if(Input.GetKeyDown(KeyCode.LeftArrow)) direction = 7;
		bool didMove=false;
		if(direction > 0){
			Vector3 npos = Board.GetPosition(Board.GetNeighbor(pos, direction));
			if(npos != ppos){
				ppos = npos;
				didMove = true;
			}
		}
	}
}

Here is a cleanup of it, using the Board.js as a base. Instantly, you will notice that I removed all of the GetNeighbor stuff as it is imbedded in the Board controller.

I cleaned up the creation process as now all you would have to do is call the Board controller to handle the creation process. I left the single tile, but be aware that the Board controller can handle many different tiles.

The last part I added in was the “How to Use” this section. This hopefully will illustrate some different methods on how to implement the Board controller. It includes defining positions, converting that position into real world vectors, converting a screen click into the nearest point on the board and generic movement.

All of the mathematical handling is in the Board controller so you don’t have to do checks as you go. If you try to exceed the board it will clamp you back to it.

The only thing you need to understand is the direction features in the GetNeighbor. 1 == N, 2 == NE, 3 == E, 4 == SE, …

First off, thanks so much for taking the time to respond to my questions so thoughtfully.

The reason I was doing things the way I did (or tried to) is because I plan on having a lot of pieces on the board and I will need to access information about each BoardSquare as I go. In your code, it looks like the GetNeighbor returns a Vector for the board position. Here is my logic for the system I’d laid out for a typical player’s turn:

(selection is based on BoardSquares)
- player attempts to select a square

  • is that square occupied by one of that player’s pieces? if so, select it and highlight board squares that piece can move to
  • else ignore the attempt
    (after successful initial selection)
    - player attempts to select a square
  • is that square a possible move / highlighted? if so, move the selected piece to that square and change ownership of the piece to the new BoardSquare
  • else ignore the attempt

So with your system, it doesn’t seem like I could do things like this. Please correct me if I’m misinterpreting your code. I had also considered creating a list of the BoardSquares and using math to move around, so if it was 10x10 and I want the northern neighbor of list(19) I could just get list(19 - 10) = list(9). This may be a better route for me, especially if I want to generate different boards.

As a qualification for my original generation script, I’d initially planned on running this generation code and then creating a prefab out of the result, so I wasn’t going to go through these calculations for every new game, just to create the prefab. Although, it would likely be beneficial to be able to generate my board for expandability moving forward.

Actually, with a little more work, the Board controller can easily do this…

lol, now I caught myself building the entire thing for you, however, lets just say, that if you add enough features into it all of that is totally doable. My code is not meant to do everything for you. You need to program this yourself.

I programmed every bit of what you asked for, however it would not be the best solution for you. The point of the whole thing was that you understand that using Unity’s FindObject and stuff like that are far slower than math. This means that you can do things on the fly as opposed to “building a map”.

The second theory is that it is a static class. A static class is basically a global variable. So Board.something() does something. As opposed to having a bunch of lists that you need to search through and making a GameController that much more complicated.

Consider this code:

	static private var highlight : GameObject;
	// clear the highlight
	static function ClearHighlight(){
		if(highlight){
			var renderers : Component[] = highlight.GetComponentsInChildren(Renderer);
			for(var r : Renderer in renderers){
				r.material.color=new Color(0.8, 0.8, 0.8, 1.0);
				r.enabled=false;
			}
		}
		highlight = null;
	}
	
	// highlight a cell
	static function Highlight(x : int, y : int){
		ClearHighlight();
		highlight = segment(x,y);
		renderers = highlight.GetComponentsInChildren(Renderer);
		for(var r : Renderer in renderers){
			r.material.color=new Color(1.0, 1.0, 1.0, 1.0);
			r.enabled=false;
		}
	}
	
	static function Highlight(v : Vector2){
		Highlight(Mathf.Round(v.x), Mathf.Round(v.y));
	}
	
	static function Highlight(v : Vector3){
		Highlight(RevGetPosition(v));
	}

	static function RevGetPosition(v : Vector3) : Vector2{
		return new Vector3(Mathf.Round(v.x / size), Mathf.Round(v.z / size));
	}

So for your problems, assigning one person to a square and stuff like that. No, math is much faster. Bob moves from 5,4 to 5,5. This means that you simply move him from 50,0,40 to 50,0,50. in order to extract his position, all you need is position / size.

To maintain a list of units, you will of course need a list of units. If you want to see what position that unit is, get it’s RevGetPosition to convert game units to map units.

In order to maintain factions (who’s side is the unit on) you will need to maintain a list of factions that match the list of units. Any time you add a unit, you have to add it’s faction. Any time you remove a unit, you remove it’s faction. This is all powered by List.IndexOf().

Yes, the qualification for your original concept is correct, its all about execution now. What is the most efficient way to do what you are trying to do that makes programming it in the end easier. When it comes down to how you execute, you want to stay away from GameObject.Find and things of that nature. At worst, you would need to maintain a list of units and go through that list rather than Find them. This way you can get more done in less processing space.

So if I had a GamePiece and wanted to move it from 5,4 to 5,5, this system makes sense to me. It’s just a matter of math and conversions. At the same time, however, say I want Board.isOccupied(5,5) that tells me if there is already a piece at those board coordinates. It seems like it would be a waste to iterate over my entire list of pieces, checking if they are located at [5,5]. Do you think this is a good way to do it?

And sorry if it seemed like I wanted code for all of this. Towards the beginning I definitely wanted clarification on how to access a specific GameObject’s scripts and alter variables (which I’m still not clear on), but for the structural design of the board I would appreciate a more experienced Unity developer’s opinion on handling these things.

I agree that there’s clearly a better way than holding neighbor references within each and every BoardSquare. I had designed it this way because I pictured everything happening within that level of the hierarchy and they needed information about each other. You’ve helped me to realize that I can operate the game from the “Board level.” So, instead of having to call GamePiece.occupies().neighborNorth() to find the square one unit forward from a piece, I can call some function of Board and work it all from there.

I still wonder how exactly I should make this data quickly accessible. So, let’s say (in the instance of the Board class) I track the board coordinates of what square of the Board is highlighted for selection. Let’s say it’s [5,5]. The user presses up. I change the highlighted coordinate to [5,6]. I need to unhighlight other BoardSquares and highlight the selected one. Should I iterate through a list of all the squares until I find the one at [5,6] and go from there?

EDIT: If iteration through lists of my squares, pieces and such wouldn’t be too taxing, I think I’d have a decent handle on how to proceed. I just feel like it could get a little hairy with 40+ pieces in play and 100 squares.

Say you have a list of game objects. Each of these game objects has a transform, which has a position. What you would need is a way to reverse that position to put it on a square. So Mathf.Round(transform.position.x / tile size) and Mathf.Round(transform.position.z / tile size) would give you that. So now, instead of looking at every tile, you look at the units on the map. As soon as you find the unit, you exit the loop to save processing. And yes, that is actually very quick compared to GameObject.Find.

So using n * size and Mathf.Round(position.x / size), you create a grid from either normal numbers or vector positions. Then all you have to do is compare a Vector2 to see if the X/Y is the same. If it is, the piece is occupied. :wink:

Alright, thank you so much for all of your posts. I’m going to take another swing at this and I’m sure I’ll be back, hopefully with results. Cheers! :smile: