• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
BlueSin

Isometric Mapping Issues

0 posts in this topic

Been reading around various articles for several weeks now. Been trying to get isometic mapping to work for months, but no matter how it is explained to me, I just cannot grasp it. But, I think I am getting close. I put up my Map.cs class which contains my isometric algorithm in my constructor. Also put up the Tile class for a reference. Default tile texture & map results are below the code.


What is really weird is that if I use a flat tile...like grass, it shows up fine...although it does look a little squashed. But my game will be using isometric cube based/shaped textures. So I need it to work with the cubes, but as you can see from the screenshot...its all staggered. I am not very good at math, and it seems like no matter what I change, I just cannot get it.

Also, since I am very bad with math, I might have my Height & Depth might be mixed up. For my code reference...depth refers to stacking cubes on top of each other (terrain height), whereas height refers to how deep the cubes go (on the Y) plane. Right now I am just testing with a depth of 1, so 1 map layer to create a nice flat diamond. Height of 10 and Width of 10. Even still I don't think that is what is wrong with it, I have no idea and would like an outside perspective, thanks.


[b]Map.cs Class[/b]
[CODE]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace IsometricMapping
{
public class Map
{
// Width, height and depth of the map (X, Y, Z)
private int width, height, depth;
// Accessor for width
public int GetWidth
{
get { return this.width; }
}
// Accessor for height
public int GetHeight
{
get { return this.height; }
}
// Accessor for depth
public int GetDepth
{
get { return this.depth; }
}
// Array of arrays of tiles used by this map [depth][width,height]
private Tile[][,] tiles;
// Accessor for the tile array
public Tile[][,] GetTiles
{
get { return this.tiles; }
}
// The default texture assigned to tiles
private Texture2D defaultTexture;
// Accessor for the default texture
public Texture2D GetDefaultTexture
{
get { return this.defaultTexture; }
}
// Default constructor for the Map class
public Map(Texture2D defaultTexture, int width, int height, int depth)
{
// Assign values to fields
this.defaultTexture = defaultTexture;
this.width = width;
this.height = height;
this.depth = depth;
// Initialize the Tile array
this.tiles = new Tile[this.depth][,];
// Set up tile positions
for (int z = 0; z < this.depth; z++)
{
// Initialize tile array by Z-layer
this.tiles[z] = new Tile[this.width, this.height];
for (int y = 0; y < this.height; y++)
{
for (int x = this.width - 1; x >= 0; x--)
{
// Initialize tile at the specified position
this.tiles[z][x, y] = new Tile(this.defaultTexture, new Vector2(
(x * this.defaultTexture.Width / 2) + (y * this.defaultTexture.Width / 2),
(y * this.defaultTexture.Height / 2) - (x * this.defaultTexture.Height / 2)));
}
}
}
}
// Draws the map
public void Render(SpriteBatch spriteBatch)
{
for (int z = 0; z < this.depth; z++)
{
for (int y = 0; y < this.height; y++)
{
for (int x = this.width - 1; x >= 0; x--)
{
spriteBatch.Draw(
this.tiles[z][x, y].GetTexture,
this.tiles[z][x, y].GetPosition,
Color.White);
}
}
}
}
}
}
[/CODE]

[b]Tile.cs Class[/b]
[CODE]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace IsometricMapping
{
public class Tile
{
private Texture2D texture;
public Texture2D GetTexture
{
get { return this.texture; }
}
public Texture2D SetTexture
{
set
{
if (value != null)
this.texture = value;
}
}
public int GetWidth
{
get { return this.texture.Width; }
}
public int GetHeight
{
get { return this.texture.Height; }
}
private Vector2 position;
public Vector2 GetPosition
{
get { return this.position; }
}
public Tile(Texture2D texture, Vector2 position)
{
this.texture = texture;
this.position = position;
}
}
}
[/CODE]


[b]Default Tile Texture:[/b]
[img]http://i806.photobucket.com/albums/yy341/BlueSin2009/XNA%20Development/sampleblock.png[/img]

[b]Map Result:[/b]
[b][img]http://i806.photobucket.com/albums/yy341/BlueSin2009/XNA%20Development/IsoIssues.png[/img][/b]

By the way, I have gotten isometric mapping to work from the guides I have read. However, they are really just a jumping off point, and don't help me write the code the way I want it, similar to the way the code is written above. Also, they usually miss an important step such as terrain height, or are jagged as opposed to diamond, etc.
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0