Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 

 Home / General Programming / Tile-Based Brushes, and fringes Account Manager
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
GReYVee

August 29, 1999, 08:21 PM

Right now I am making a Tile-Based Engine for a RPG/WarStrategy game, and have recently
stumbled on a new problem to solve. While using the WarCraft2 Editor I realized that when
I, for instance, plotted a square of mud tile on a grass field, that the surrounding 8 tiles
are changed to a fringe that makes the transition from mud to grass look better, and not so
blocky. I have devised a method to do this, with an algorithim that decides which tiles to
replace and, if fringes overlap, which fringe to use instead. In most cases the algo worked
but not all.

The algo decided the changes by identifying the fringes by side and top owners. These are
just integers that are -1, 0, or 1 ( -1 : doesn't own this side or top) (0or1- side or top
it owns) ie. a northwest fringe, like topleft corner-peice of a 3x3 table of fringes,
own : side = 0, top = 0, or a eastern fringe(3,2 on 3x3) would own : side = 1, top = -1;

If your familiar with a method close to warcraft's editor, or one similar, and have advice
or some help, please email me at : grey@codenet.net

Thanx, GReYVee

 
Phil

September 18, 1999, 02:24 AM

One way to do it is to divide your tile or square bitmap
into four corners.

This is one tile:

+---+---+
| 0 | 1 |
+---+---+
| 2 | 3 |
+---+---+

You should have at least 2 complete tilesets or 32 tiles,
for this to work correctly. (16 tiles makeup a complete tileset)
To get a complete tileset, you would draw this in binary form.
Image that each corner represents a single bit from 0000 to 1111.
(replace the 1's and 0's with dirt,grass,water,etc.)

Let's say you place a dirt tile in the center of a bunch of
grass tiles. You would want to keep the dirt tile how it is,
but the 8 surrounding grass tiles should change to dirt-grass edges.

Each corner of the dirt tile could have a INT variable storing
what type of corner it represents (e.g. dirt,water,grass).
In this example, the corner types of the dirt tile will be
stored as dirt,dirt,dirt,dirt.

Now loop through all 8 of the surrounding tiles, and transfer
each of the centered tile's corner type to its corresponding
adjacent tile corner types.

When you are done, the 8 surrounding tiles should have their
corner types setup correctly.

Now, you need to loop through all 8 tiles again, but this time
you have to update the image of tile based on its new corner types.

For example, a tile will corner types dirt,dirt,dirt,grass should
have an image of some grass in the LR corner, and the rest of the
tile should be dirt.

So again, it goes like this:

1. Place your center tile
2. Transfer center tiles' corner types to adjacent tiles' corner types
3. Update adjacent tiles' images based on their new corner types

I hope that makes sense.

- Phil

 
Phil

September 18, 1999, 06:31 PM

I think I made some mistakes in my last post. I think you only need
1 tileset if you only have two different base types such as grass
and dirt to match-up any tile combination. The rest seems ok.

-Phil

 
This thread contains 3 messages.
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.