<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="/static/xsl/demos.xsl"?>
<demo title="Textured Walls" xmlns:xhtml="http://www.w3.org/1999/xhtml">

<wiki>
= Textured Walls =

I'm working on a tile based RPG. I had had some success using [http://jice.nospam.googlepages.com/basicdungeongeneration Dude's algoritm for random dungeons] and of course a [http://code.google.com/p/brianin3d-jaction/source/browse/trunk/apps/m69/js/MapM69.js second implementation] is always cleaner.

Once the digger was working, the initial result was pretty fugly:

/static/images/walls/plain.jane.png

Next, I identified the different wall bits, and broken them down into 9 types of wall pieces:

* up end
* right end
* left end
* left
* surround
* left/up corner
* down ending
* top crossing
* bottom corner

/static/images/walls/so.much.blue.png

You don't wanna know how long that took me to work out... it was brutal

= Almost there =

But.. I really wanted:

* different sized walls: 48x48 is ok, but I don't want to be married to it
* different wall thickness: my first walls looked really tall and skinny
* textured walls: I picked my colors for contrast, but the real deal needs textures

I wanted a way to generate wall tiles using the same '''floor''' tiles that are all over the place.

I'm sure there is already something out there like [http://code.google.com/p/brianin3d-misc/source/browse/trunk/random/java/Walls.java this] already out there. 

It has a bunch of options(see below), but now I could take tiles like: /static/images/walls/wall.textures.png , run them through something like:  ./Walls.java -x wall.textures.png -1 0,0 -2 1,0 -3 2,0

And produce:

/static/images/walls/wallz.test.png

To create:

/static/images/walls/fatty.png


</wiki>


<wiki>

= Getting it and Running it =

</wiki>

<code>
mkdir /tmp/wallz
cd ${_}
wget http://brianin3d-misc.googlecode.com/svn/trunk/random/java/Walls.java
wget http://brianin3d-demos.appspot.com/static/images/walls/wall.textures.png
chmod 755 Walls.java
./Walls.java -x wall.textures.png -1 0,0 -2 1,0 -3 2,0 -f tada.png
eog tada.png
</code>


<wiki>

I hope someone gets some use out of it. 
</wiki>

<code>
[java] Walls [options]
-f filename     filename to save to : default is wallz.test.png
-t thickness    thickness of walls  : default is 13
-s size         size of tiles       : default is 48x48
-x texture      image to use for textures
-1 column,row   texture offset to use for 'top'
-2 column,row   texture offset to use for 'up'
-3 column,row   texture offset to use for 'left'

The texture offsets (column,row) become (column*size,row*size)
x,y offset into the image used for the textures
</code>

<wiki>
= Protip =

Sorry, not going to really explain this.

* row 1: up end, right end, left end
* row 2: left, surround, left/up corner
* row 3: down ending, top crossing, bottom corner

See the code method "this.classify" 
</wiki><!-- http://www.rpgmakervx.net/index.php?showtopic=15162 -->
</demo>

