## I need help with an algorythm...

### I need help with an algorythm...

Dear person-who-can-help-me,

About 3 months ago, someone posted a solution to this problem.
If anybody knows a good algorythm for placing a set of shorline tiles
around a body of water automatically (like in the Warcraft editor),
could you post it or fire it my way thanks.

Thanks,
Jordan

--
____________________________________________________
/                                                    \
|   Jordan Dennis                 "Yay Quake!"         |

|   Programmer - Bioware Corp.                         |
\____________________________________________________/

### I need help with an algorythm...

Sure thing.. I did a unique way of producing the same result as WC2's
editor... Since I had to model my TileMap editor after WC2's for
Disney Interactive, I had to get creative. ;)

Here's how it worked...
I had a map consisting of a particular ground type.

So... Each tile looked was built using what it's 4 corner ground types
were.
In the resource builder (Creating the list of tile bitmaps) I defined
what each corner type was... Then looked up the right tile, when
fitting it into the map... Need more help?  I'll give you a more
specific description if you haven't caught my drift yet. :)

Btw... Here's a little diagram.

1-------1-------2-------2
| . , , | . , O | O O O |
| , A O | , B O | O C * |
| , O O | O O O | O * * |
1-------2-------2-------3
| . , O | O O O | O O * |
| , B O | O C * | O D * |
| O O O | O * * | * * * |
2-------2-------3-------3

*Note the middle letters in each of the tiles... And how the
Top-Middle tile is the same as the Bottom-Left tile. :)

Do you see where the corners come into play?  Maybe the font will make
the diagram messed up, but that's easily fixable, just make sure it's
a fixed pitch font. :)

Well... Good luck! :)
Aaron.

>Dear person-who-can-help-me,

>About 3 months ago, someone posted a solution to this problem.
>If anybody knows a good algorythm for placing a set of shorline tiles
>around a body of water automatically (like in the Warcraft editor),
>could you post it or fire it my way thanks.

>Thanks,
>Jordan

>--
>  ____________________________________________________
> /                                                \
>|   Jordan Dennis                     "Yay Quake!"         |

>|   Programmer - Bioware Corp.                             |
> \____________________________________________________/

--------------------------------------------------------
This was a message from: Aaron Hilton
aka: Otri or Psyched

### I need help with an algorythm...

> About 3 months ago, someone posted a solution to this problem.

Then go to http://www.DejaNews.com/ and search for it.

### I need help with an algorythm...

begin 644 TileCode.c
<uuencoded_portion_removed>
024Y4('!O<VET:6]N*3L-"F%L
`
end

### I need help with an algorythm...

Hello!

Hehe... I really was talking about the same thing. :) Sorry for the
confusion.. I was only assuming you were encountering a similar
situation that you may have had only a scetchy idea of what to do. :)
But, it seems that my methods are a little unanicdotal. :)

O.k... First things first:
You need a basic kind of information for each (shoreline) tile, you
must collect a basic set of information:
A chunk of code is attached.

One thing I HAVE to note, is that It's a far better implementation in
C++... But since you may not be familiar with it, I rewrote the code
in the basic C syntax. (Well... Mostly) :)

O.k.. You've read the file, right?  And you are totally confused by
now.. :)

Well... Basically, once you fill in all the right info, all you have
to do is call the { SetTile( TileMap *map, POINT position, BYTE bTile
); } when the user clicks on a point in the tile map. :)  From there,
the program sets the tile, uses it's base info, to fill in the 4
surrounding corners of the BaseGrid, then from each of those Base grid
points, they continue validating their surrounding grid corners, and
so on, until there are no more validations performed, because all the
base tiles fit.

The only confusing part is where the {TileBase->m_bLevel} part comes
in.  That is the variable checked when validating a base grid point.
You pass the previouse Base, so that it can check to see if
{ThisBase->m_bLevel} is valid Ie, (+ or -) 1 from
{PrevBase->m_bLevel}.. If not, then you change the ThisBase equal to
the {PrevBase->m_HighBase} or {PrevBase->m_LowBase} depending on
whether the {ThisBase->m_bLevel} is >1 higher or lower than the
{PrevBase->m_bLevel}

Well.. I hope you catch on, because if you didn't, then I'll have to
finish writing the code FOR you... And next time I'll be writing it in
C++. (classes are FUN) ;)

Cya later!
Aaron.
--------------------------------------------------------
This was a message from: Aaron Hilton
aka: Otri or Psyched

----------

> Subject: tiling problem...
> Date: July 13, 1997 9:50 PM

> Dear Aaron,

> Thank you for your recent correspondence.  I'm not sure if I was clear
> about my problem in my first post.  Where I need help is the moment the
> user clicks the mouse and begins drawing (with say water for example).
> I have all the nessessary tiles (or shoreline tiles), I just need a good
> way to terraform the landscape as the user drags the mouse. Forgive me
> if this is what you where meaning (and I was just being dense).  Please
> clarify your procedure if possible.

> Friend and colleague,
> Jordan Dennis

> --
>   ____________________________________________________
>  /                                               \
> |   Jordan Dennis                    "Yay Quake!"         |

> |   Programmer - Bioware Corp.                            |
>  \____________________________________________________/

--------------------------------------------------------
This was a message from: Aaron Hilton
aka: Otri or Psyched