realbasic-games
[Top] [All Lists]

Re: Dynamic 2D Isometric Terrain

To: REALbasic Games <realbasic-games at lists dot realsoftware dot com>
Subject: Re: Dynamic 2D Isometric Terrain
From: Mike Woodworth <mike at divergentmedia dot com>
Date: Fri, 24 Jun 2005 11:29:23 -0400
Delivered-to: realbasic-games at lists dot realsoftware dot com
References: <BEE19255 dot 8EEA%seth at johnfinley dot com>
if you raise the center tile to n height, i would set the tiles in the next ring out to MAX(n-1, their original value)...


mike



On Jun 24, 2005, at 10:35 AM, Seth Duke wrote:

I have been working on a 2D Isometric Terrain system that mimics the old
SimCity 2000 terrain system.

Getting pieces to line up and connect properly has not really been a
problem.

The issue I am trying to iron out know, is making the terrain editable in
real-time.

I settled on a Matrix that represents the level of any tile on the board,
where the lowest possible tile is 1.

Example - 7x7 tile grid:

1 1 1 1 1 1 1
1 1 1 1 1 1 1
1 1 1 1 1 1 1
1 1 1 1 1 1 1
1 1 1 1 1 1 1
1 1 1 1 1 1 1
1 1 1 1 1 1 1

When say the center tile is raised to level 4, the output should become

1 1 1 1 1 1 1
1 2 2 2 2 2 1
1 2 3 3 3 2 1
1 2 3 4 3 2 1
1 2 3 3 3 2 1
1 2 2 2 2 2 1
1 1 1 1 1 1 1

So far, I have achieved this "slinky" effect by taking the raised tile and setting the heights of each outer ring to one less than the raised tile,
etc, etc.

What I can't seem to layout mathematically is taking in to account other
tiles in the area that may have already been raised.

ex: Given the previous raised state, I raise the tile to the right of the
center one to 4 as well. Its output should look like this:

1 1 1 1 1 1 1
1 2 2 2 2 2 2
1 2 3 3 3 3 2
1 2 3 4 4 3 2
1 2 3 3 3 3 2
1 2 2 2 2 2 2
1 1 1 1 1 1 1

Is there a known formula for this kind of matrix transformation? Where every matrix(x,y)'s value directly effects all surrounding values do produce a
smooth transition/staircase effect?

Doing google searches for various matrix types and examples have not turned up much. It just seems like this would be a formula that is sitting in the matrix section of some math book. I would like to rule out the possible availability of such a formula before I go beating my head against the wall
calculating it myself.

Thanks,
-Seth
--
<http://realopen.org>


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


--
Mike Woodworth
mike at divergentmedia dot com


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>