Tile Engine Series’ New Home
Since the tile engine series is still the most popular content I’ve ever made, it definitely has made its way to the new site. The tile engine series can now be found at http://blog.nickgravelyn.com/archive/#tileengine.
That archive page is where I will keep links to all of the downloadable content I put on this site in the future as well, so you can also find the Alien Aggressors tutorial as well as my Visual Studio templates.
On another note, it seems that my second episode of the tile engine series has a corrupted ZIP file (not sure how that happened). If anyone has a copy of the second episode lying around that isn’t corrupted, let me know.
Possibly Related Posts
(Automatically Generated)Tile Engine Episode 8?
Tile Engine Updates
Tile engine videos on YouTube!
New Minimalist Templates
Editing The Default XNA Game Studio Project Templates

Hey Nick,
I have TileEnginePt2.avi, is that what you’re looking for? I’m listening to it now just to make sure it’s OK. Where would you want me to send it?
Bob
I doubt you can email something that large, but try zipping it up and email it to nick@gravelyn.com. If that doesn’t work, see if there’s anywhere you can upload a file that big and give me a link. Then I can put it back up on the server.
Thanks.
I also have it, I had to ZIP it again though. I used WinRar, and if you didn’t get rscharen’s file, here is a link:
http://cid-c0adb6f0f9176682.skydrive.live.com/self.aspx/Public/TileEnginePt2.rar
Hope that helps!
I sent you the link to the above email through rapidshare.
Bob
Nick, would you consider a forum for discussing code? For example, I’d like to get your input on this method.
public void FillCell(int fillx, int filly, int desiredIndex)
{
int oldIndex = currentLayer.GetCellIndex(fillx, filly);
if (desiredIndex == oldIndex)
return;
fillCells.Add(new Vector2(fillx, filly));
while (fillCells.Count > 0)
{
int x = (int)fillCells[0].X;
int y = (int)fillCells[0].Y;
currentLayer.SetCellIndex(x, y, desiredIndex);
fillCells.Remove(fillCells[0]);
if (x > 0 && currentLayer.GetCellIndex(x – 1, y) == oldIndex && !fillCells.Contains(new Vector2(x – 1, y)))
fillCells.Add(new Vector2(x – 1, y));
if (x 0 && currentLayer.GetCellIndex(x, y – 1) == oldIndex && !fillCells.Contains(new Vector2(x, y – 1)))
fillCells.Add(new Vector2(x, y – 1));
if (y < currentLayer.Height – 1 && currentLayer.GetCellIndex(x, y + 1) == oldIndex && !fillCells.Contains(new Vector2(x, y + 1)))
fillCells.Add(new Vector2(x, y + 1));
}
}
I’d really prefer not posting code directly into the comments. If you must post code, use a pastebin like http://www.ziggyware.com/codepaste.php and then link it.
As for that code, I’m not sure exactly what you’re going for or how it’s different than what is in the tutorials, so I’m not sure what I am supposed to be critiquing.
I’m just going through these tutorials (tile engine) for the first time in March of 2009. As a result, I’m unclear as to where I should be posting questions. Also, as a result of my entering the game a little late, I’m having a problem on the first tile editor section that I believe is a result of working with XNA Game Studio 3.0 instead of 2.0.
I’ve searched the internet quite a bit to find that others have been getting the exact same errors as I have however have found no answers. Is it still possible to ask about this stuff on here somewhere?
Hey Nick. Great tutorials so far. I just needed a basic introduction and yours was great. I do have one question (and I don’t know if this has been covered in one of your tutorials yet) but how would I specify whether a tile is passable or not? For example, if I’m rendering a wall tile that a character cannot pass through or bullets cannot go through, how do I specify that attribute?
Thanks.
I was wondering if you could help me with a problem, Nick.
After going through Episode 3B, I encountered the following error:
Could not load file or assembly ‘TileEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’ or one of its dependencies. An attempt was made to load a program with an incorrect format.
Would you happen to know how I can fix it? It is referring to the Application.Run(new Form1()); in the Program.cs file.
Thanks in advance,
Dave1005
Hi Nick, i have been looking for a tutorial to make sense of the tile engine (the ones on the xna related sites have made things really messy as they just keep hacking previous engines to bits). i have however hit a small problem, when downloading episode 2 video and 3 videoA the zip files seem to be empty although the download size is massize for an empty zip file. I did knotice from above that you had issues with no2 but have you had the chance to resolve them at all.
all in all really helpful thanks
Hi Nick,
Came across your TileEngine and editor tutorials several weks ago. I watched all the videos and recently started to actually do the coding in XNA. Everything has gone well, except for one problem in the editor. The editor works as expected as far as the UI components (buttons,checkboxes,etc.) but the tile textures do not actually draw on the grid of the layer. The white boxes dissapear as if something was drawn there, but no texture appears. Have you heard of this before? Any idea what might be wrong? For your info, I tried the unmodified solution in both VS2005 and VS2008(with the help of the conversion wizard) and get the same results in both cases. Any suggestions would be appreciated. As a side note I have used your tutorials as a basis for an isometric game engine. I will check back with you when I get it more complete if you are interested. So far it only draws the tiles and allows scrolling. Thanks again.
Hi Nick!
I am from China and your Tile Engine Tutorial Series is doing a great help for me.I found “TileEngineProject04.zip” is missing ,so I was wondering if you could check and fix the error;
just Thank you!
Hey Nick, I’ve been following through your tutorial and I’m getting an error trying to run the TileEditor windows form using my project or the one available from you.
I’m using XNA 3.0 and Visual Studio 2008. Any ideas where the problem might be?
Same issues as Dave1005
Could not load file or assembly ‘TileEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’ or one of its dependencies. An attempt was made to load a program with an incorrect format.
thanks in advance
Hey Nick, I’ve got an error while following your Tile-Engine-Tutorial and I was hoping you could help me. I have watched the *a+b* tutorials a couple of times but i can’t seem to find whats wrong.
I receive the error 17.00 minutes in the *TileEngine3b* part.
public void AddTextures(Texture2D texture)
{
tileTextures.Add(texture); // <– this line
}
ArrayTypeMismatchException was unhandled:
Attempted to access an element as a type incompatible with the array.
I was reading the code for TileLayer.LoadTileTextures methods. I liked how you used the ‘params string[] textureNames’ and the second parameter however, I thought (because I prefer to separate logic from game runtime) it would be best to write the method as such
LoadTileTextures(ContentManager content)
{
string tilePath = “Tiles/se_free_”;
string tileEnd = “_texture”;
string[] textureNames = new string[]
{
“grass”,….
};
foreach (string name in textureNames)
tileTexture.Add(content.Load(tilePath + name + tileEnd);
}
This allow changes to only be made in the library (or if one prefer to store textures in a database so nobody can actually get to the textures from a folder which is another topic but not hard to due just more coding but great when you do not want to hard code the textures but rather loop throw the table of images)
without having to do anything but instantiate classes and call functions inside
Game1 class.
}
slayernine
I use XNA 3.0 on VS Pro 2008 and have no error compiling the library. Check to make sure that you first have referenced TileEngine in TileGame and have called the using statement to it.
If you have and can access the public class inside Game1 there should be no problem.
slayernine
One more thing about using WinForms which does not naturally use a timer (but easy to do), you have to make sure to do the same with it as well. I have went through all of the TileEditor tutorials from Nick and have found it functions well (of course, I made it more robust because I do a lot of WinForm programming even for DirectX). There is something is you referencing the library to the winform project.
Reject you code and references. It should compile the library at runtime.
slayernine
Recheck your code and references. Excuse me for the error.
If we make error in writing, we make error in code. All of us do.
sinyester,
I had the same problem as you, but found the solution.
In your references, click on the Microsoft.Xna.Framework reference, and look at the version. If it is not 3.0.0.0 you need to reload the proper reference.
(Mine was 3.0.0.1, funny how a single version increment can bug your code).