Patterns

Discuss the creation and scripting of new fan-made games and mods for the Fallout series of games.
Post Reply
User avatar
Roi de Janeiro
SDF!
SDF!
Posts: 4
Joined: Tue Mar 02, 2004 2:00 am
Location: Düsseldorf
Contact:

Patterns

Post by Roi de Janeiro »

im pretty intrested in using more patterns or editing the old ones used in the "Fallout 2 Mapper". Is there any way to use the "create pattern" option or any tool doing something similar?

It seems relatively easy to me to understand the files that contain the patterns so if there isn't any tool yet i'd try to make one...
SDMVersion3
Vault Veteran
Vault Veteran
Posts: 278
Joined: Tue Feb 17, 2004 11:04 pm

Post by SDMVersion3 »

Go nuts.

I believe Red! said that it was broken, so if you want to fix it, we'd love ya for it.
Image
Error! I suck balls.
Duck and Cover doesn't... always.
User avatar
Roi de Janeiro
SDF!
SDF!
Posts: 4
Joined: Tue Mar 02, 2004 2:00 am
Location: Düsseldorf
Contact:

Post by Roi de Janeiro »

Ok!

Thats what I found out so far:

I extracted the master.dat to find the patterns.

The patterns are stored in:

..\fallout 2\master\proto\TILES\PATTERNS

There are 26 files called
00000001
to
00000026

and one file called patterns.lst.

if you open the patterns.lst in wordpad you'll find the the 26 files listed.

My next step was to open some of the 000000xx files (from here on called pattern-files) in an hex-editor. Compairing the files I found out how the files are structured.

Every pattern-file is 5771 bytes long. The files are dividet in two parts.
The first and major part stored from #0000 to #167F contains information about which tiles should appear where. The second, much smaller part, from #1680 to #168B contains information about the size and the number of the pattern.

the second part is stuctured like this:

#1680 | XX00 0000 YY00 0000 ZZ00 0000

XX determins the number of tiles for the x-axis of the matrix.
YY determins the number of tiles for the y-axis of the matrix.
ZZ determins the number of the pattern. (if your edit pattern-file 00000026 you got to set ZZ to 1A which is hex for 26.)

I also understand most of the first part, but more about this later.

For now lets run throuh an exemle how to create a completely new, working pattern using only wordpad and an hex-editor.

Im pretty shoure you got wordpad or something similar so i skip this point.
If you don't have an hex-editor download hex workshop at
http://www.bpsoft.com/

At first we need an empty pattern-file
We can easily make one by opening an existing file in the hex-editor and replace evry byte whith 00. Its a little bit of tip-tapping yet and after i've don it, I see no reason why you should do it again. So skipp it and just download this one I made:


http://home.pages.at/flsne/stuff/empty.pat

Open the file in your hex-editor.

The first thing to do now is to set the number of your pattern. In this example i choose the number 27, for its the firts unused one. To do it scroll down to the end of the file und set the offset #1688 (ZZ) to 1B which is hex for 27.

Now save the file as 00000027.

Next we want to set the size of the matrix. I decidet to take a 3 x 2 matrix so we can see how the xy-thing works. To set the size change the offset #1680 to 03 (XX) and the offset #1664 to 02 (XX).

For the next step we need to now more about the first part of the file:

The tiles are kinda numerated starting at the upper right to the lower left corner of the pattern. In our example that would look like this:

3 2 1
6 5 4

The information about a particular tile uses 16 bytes of the file. The informationes for our example will be placed in the file like this:

tilenumber offset range
1 #0000 - #000F
2 #0010 - #001F
3 #0020 - #002F
4 #0030 - #003F
5 #0040 - #004F
6 #0050 - #005F

The info about a single tile is stuctured like this:

#offset | PPQQ 00RR 0000 0000 0000 0000 0000 0000

PP determins the tile used.

QQ also determins in some way which file is used. I didnt find the RR value set in any of the original patterns. What made me stumble over it was, that there are 3102 tiles to choose from in the mapper. There simpy had to be another value for this because in the two bytes of QQ is only room for 256 tiles. If there are four bytes we got room for 256 x 256 tiles which is enough.

RR seems to determine something for the preview in the mapper. Its in all the original patterns set to 04 so i think we should accept this as an dogma and alway set this value to 04.


I didn't find out which value sets which tile yet completely but we can create dummy-patterns using random values.
For our example lets use the following:

#0000 | EA00 0004 0000 0000 0000 0000 0000 0000
#0010 | EA00 0004 0000 0000 0000 0000 0000 0000
#0020 | EA00 0004 0000 0000 0000 0000 0000 0000
#0030 | EA00 0004 0000 0000 0000 0000 0000 0000
#0040 | EF01 0004 0000 0000 0000 0000 0000 0000
#0050 | EF01 0004 0000 0000 0000 0000 0000 0000

Save the file and open patterns.lst in wordpad.
Add 00000027 to the other files.

Start the mapper. There should be our new 26th pattern to choose. (The mapper starts counting the patterns whith 0 so 27 becomes 26.)

The only thing we got to figger out now is a list of the values for the tiles.


....
To make it better arranged, i changed all the 000000xx files to 000000xx.pat files und changed the names in the patterns.lst.
User avatar
ColJack
Vault Scion
Vault Scion
Posts: 175
Joined: Sat Apr 19, 2003 8:01 pm
Contact:

Post by ColJack »

the tile values should only be the tile prototype number...
User avatar
Roi de Janeiro
SDF!
SDF!
Posts: 4
Joined: Tue Mar 02, 2004 2:00 am
Location: Düsseldorf
Contact:

Post by Roi de Janeiro »

Ok.... I now also found out how the tile setting works:

As a first step, we should change the use_art_not_protos command in the mapper.cfg to 1

Now the tiles in the mapper are arranged in another way.

i made up a pattern containing a 16x16 square covering all the tiles possible to use if you use the PP offset only.
You can download it here:

http://home.pages.at/flsne/stuff/00-ff.pat

If you now watch this file, you'l soon find out, that the tiles in the patter match exactly the tiles 000 - 255 in the object bat. Even the order is perfekt if you accept , that its going from right to left.

Experimentig a little bit whith that I found out, that for the next 256 ones we simply have to change the QQ value of every tile to 01. (and to 02 for the third 256 ones and... and .... and)

This means we got everything we need to start working on a tool.

Im not a big programmer but I'll try my very best to make up a pattern-tool. I think "I'll get by whith a little help from my friends"
Ich habe keinen Bock auf diesen ganzen Umweltscheiss. Son bisschen Kühlschrank tut doch keinem Menschen weh.
Dumme Leute finde so wat völlig asozial, DOCH FÜR MICH GEHÖRT SO'N KÜHLSCHRANK IN DEN SEE!
User avatar
ColJack
Vault Scion
Vault Scion
Posts: 175
Joined: Sat Apr 19, 2003 8:01 pm
Contact:

Post by ColJack »

yes that is generally how hex works...

01 01 is 257
02 01 is 513 etc...
User avatar
Roi de Janeiro
SDF!
SDF!
Posts: 4
Joined: Tue Mar 02, 2004 2:00 am
Location: Düsseldorf
Contact:

Post by Roi de Janeiro »

ColJack wrote:yes that is generally how hex works...

01 01 is 257
02 01 is 513 etc...
thx... my hex-skills are a little rusty for the last thing I really did whith an hex-editor was changing the car stats in 4d sports driving aka. stunts about 7 years ago.
Ich habe keinen Bock auf diesen ganzen Umweltscheiss. Son bisschen Kühlschrank tut doch keinem Menschen weh.
Dumme Leute finde so wat völlig asozial, DOCH FÜR MICH GEHÖRT SO'N KÜHLSCHRANK IN DEN SEE!
Post Reply