#### Archived

This topic is now archived and is closed to further replies.

# And the walls...

This topic is 5332 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello, I''ve spend time to read about all the introduction/tutorial on gamedev.net about isometric/axonometric tile based games but I found that no one deals with the walls... I mean, how to handle the walls? Separately or with the ground? And what about wall''s width? Moreover, I would like to build ''objects'' that would group ground/roof tiles and walls/sides tiles. Has anyone a data structure to advise about it? Wonder Sonic (more and more questions are coming...)

##### Share on other sites
Typically, walls are handled separately from floors. Imagine each tile in a tile-based world as a cube or box. Each box has a floor, a roof, and 4 walls. Typically, only two of the walls will be used; the other, opposite, two are considered to be the walls of adjacent tiles.

In some games, the back-side walls are used, while in others the front-side walls are used. Each wall is simply a bitmap, which is drawn in the proper perspective. Here are a couple of examples:

This first shows a wall handled as a back wall:

and this one shows a wall handled as a front wall:

It is merely a matter of personal preference. I do my walls using the front 2, while Diablo handles walls as back walls.

Each wall is represented in the map by a handle referencing a graphical bitmap. Drawing order is important. If you are handling walls as back walls, you need to draw the walls before drawing anything inside the tile. If the walls are front walls, you need to draw the walls after drawing any tile contents.

When drawing the artwork, it is important to consider what type of terrain the wall will be sitting on, and create the "interface" (the edge where the wall meets the ground) appropriately.

Josh
vertexnormal AT linuxmail DOT org

Check out Golem: Lands of Shadow, an isometrically rendered hack-and-slash inspired equally by Nethack and Diablo.

##### Share on other sites
Okay, it is a little more clear now but...

1/ If you use front walls, how do you do when you are inside
an house for the background walls? Do you have tiles where
the player can't go?

in ASCII:

                    oo  oo             ooo/\ooo            aao/OO\oaa           aaa/OOOO\aaa          ooa/AAOOAA\aoo         ooo/AAAAAAAA\ooo          o/OOAAOOAAOO\o

legend:
- upper case letters: ground where player can go
- lower case letters: ground where player can't go
- a/o and A/O: different bitmaps
- / and \: front walls

On the other hand front walls are cool for foreground walls...
One optimization would be to use front and back walls together

2/ For my engine, I have got wall tiles. Those tiles are one
unit/block high. If I want to make a wall higher than one tile,
how do you do? In the way you handle your walls, you must have
wall tiles that exactly match the height of the wall you want.
But in mine, I can build a wall by using several wall tiles.

In ASCII:

             |\              |1\              |\|             |2\              o\|            ooo\              oo

legend:
- 1: one wall tile (with a window)
- 2: one simple wall tile
- o: ground tile
(here I use a back wall)

What do you think about it?

WS

[edited by - wondersonic on November 14, 2003 7:03:19 AM]

##### Share on other sites
Have spent time programming a tile engine? Your approach strongly reminds of one.
In isometric it''s not necessary to have a tile with a wall blocked from entry (as it is with a tile engine). The character can walk onto the tile and be rendered, the walls are either rendered at the top or bottom; either over or under.
There is more than one way to handle the height of walls. You could have a height attribute for each wall. That way, you could have half-sized walls, walls that are twice the normal height, etc.

##### Share on other sites
quote:
Original post by JNewt
Have spent time programming a tile engine? Your approach strongly reminds of one.

Well not really, this is my first try but my work is based on the (great) video game LandStalker. In fact, I'm currently using
the tiles of this game to:
1/ understand how it work (I've had surprises)
2/ create an XML schema to define a world.

quote:

In isometric it's not necessary to have a tile with a wall blocked from entry (as it is with a tile engine). The character can walk onto the tile and be rendered, the walls are either rendered at the top or bottom; either over or under.
There is more than one way to handle the height of walls. You could have a height attribute for each wall. That way, you could have half-sized walls, walls that are twice the normal height, etc.

Okay Could you just detail what you mean by "a wall blocked from entry...with a tile engine"?

In fact, I'm beginning to understand that I'm trying to define a world structure according to the tiles I'm using... If I put a ground tile plus a two-blocks-height-back-wall tile then I define one unit where the player can go and a wall of 2 units height... don't think this is a good idea.

To understand it, here is what I have for now:

<?xml version="1.0" encoding="ISO-8859-1"?><object-library name="MyRPGObjectLibrary">    <!--        Object definition        - length: /        - width:  \         - height: |    -->    <object id="gamedev.net-wall-sample" length="1" width="1" height="2">        <block-list>            <block x="0" y="0" z="0">                <ground sprite-id="simple-ground"/>                <!-- <left-back-wall sprite-id=""/> -->                <right-back-wall sprite-id="wall"/>                <!-- <left-front-wall sprite-id=""/> -->                <!-- <right-front-wall sprite-id=""/> -->            </block>            <block-ref x="0" y="0" z="1" id="wall-window"/>        </block-list>    </object>    <!-- List of block definition (like legos) -->    <block-definition-list>        <!-- One block definition -->        <block id="wall-window">            <!-- <ground sprite-id=""/> -->            <!-- <left-back-wall sprite-id=""/> -->            <right-back-wall sprite-id="window"/>            <!-- <left-front-wall sprite-id=""/> -->            <!-- <right-front-wall sprite-id=""/> -->        </block>    </block-definition-list></object-library>

The question is: if I just want to define a barrier, must I define a ground tile too? I'm beginning to think that it could be easier...

WS

[edited by - wondersonic on November 14, 2003 9:27:15 AM]

##### Share on other sites
My iso engine that I''m working on at the moment allows all ground tiles to be walkable / non walkable with a flag for the base tile, and then any number of walls / objects / whatever drawn on top. Movement is dependable on the flag. If I was to do walk blockable walking (next version of the engine will have this) then all I need to do is change the flag to hold 5 values (ground tile, and the four major directions - NE, SE, SW, NW ) or 9 if I''m going to stop all 8 walking directions.

Once thing I would not use is XML to describe my world map, as it is adding too much wasted space to your datafiles. keeping your datafiles small is better as having a large XML file that is 99% waste is, well erm, waste.

Look at using the datastructures that you are using inside of your game engine as the disk based storage, that way you do not need to write complex conversion routines.

When I find my code in tons of trouble,
Friends and colleages come to me,
Speaking words of wisdom:
"Write in C."

##### Share on other sites
Personnaly, I don''t mind with too big XML data structure, because this will be zipped

Moreover, such XML files are easily converted into engine data structure thanks to JAXB (a Java API).

And now, it''s time to... redesign from the beginning

##### Share on other sites
Let me explain what I meant. In a tile engine (like the old DOS RPGs), walls were a simply a tile where the player could not walk. I thought that you were asking whether the same idea had to be carried into isometric and the answer is no. Isometric allows you to move and place things in 3D. Isometric can be used to represent a true 3D enviroment using 2D graphics; the limitation being camera rotation.

##### Share on other sites
quote:
Original post by wondersonic
Okay, it is a little more clear now but...

1/ If you use front walls, how do you do when you are inside
an house for the background walls? Do you have tiles where
the player can't go?

*snip*

On the other hand front walls are cool for foreground walls...
One optimization would be to use front and back walls together

You could implement both front and back walls, but that seems unnecessary to me, and could bloat the size of your map tile structure. Remember, the back wall of one tile is the front wall of another tile. Whenever I construct a building, I have the building's back wall reside on the next tiles back, making use of their front wall reference.
quote:

2/ For my engine, I have got wall tiles. Those tiles are one
unit/block high. If I want to make a wall higher than one tile,
how do you do? In the way you handle your walls, you must have
wall tiles that exactly match the height of the wall you want.
But in mine, I can build a wall by using several wall tiles.

*sniperoo*

Sounds good to me. The biggest problem with that approach that I can see is in the asset creation department. You have to make your wall pieces tileable both horizontally and vertically. It is not too large of a problem, however, once you get the hang of making graphics tileable in general.

EDIT: You may want to consider using something such as a linked list of wall references, sorted in ascending order (lowest wall piece first, highest wall piece last), in order to conserve memory, rather than hardwiring in an array or somesuch of wall layers. When drawing the wall, just iterate through the list and draw each piece in turn, incrementing an appropriate offset as the drawing proceeds upward.

In my game (see link in sig), I organize each tile as a structure with a reference to a Roof, a Floor, a FrontLeft wall and a FrontRight wall. Each tile is additionally subdivided into a grid of 4x4 subtiles, each of which consists of lighting information, and three flags for LightBlock, Walk and Fly. There are additional flags for other properties (currently unused; these flags are stored as a 4x4 array of unsigned char for each tile). Therefore, each tile has a grid of places where the player can and can not walk or fly or both. Typically, walls will set subtiles along the front edges to non-walk, non-fly. (And light blocking as well, though currently shadows and line-of-sight are disabled in the engine.) This allows only partial blockage of tiles, and makes it easy to implement smaller blocking objects such as torches, rocks, trees, etc... without blocking an entire tile.

As far as your XML plan, if it interests you to try it, go for it. In Golem, my maps are described using Lua scripts, which have access to a rich interface of high, mid, and low level calls for random placement of terrain, terrain features, objects, and so on.

Josh
vertexnormal AT linuxmail DOT org

Check out Golem: Lands of Shadow, an isometrically rendered hack-and-slash inspired equally by Nethack and Diablo.

[edited by - VertexNormal on November 14, 2003 2:55:47 PM]

• 48
• 12
• 10
• 10
• 9
• ### Forum Statistics

• Total Topics
631380
• Total Posts
2999672
×