Author Topic: SET File Questions  (Read 330 times)

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
SET File Questions
« on: April 03, 2013, 04:28:25 am »


               I am working on a project in another engine, and want to use tiles to create the game environment. Before I roll my own system of rules which define which tiles are allowed to be placed adjacent one another, I'd like to understand how NWN's set files work.

Did Bioware release developer documentation for the SET file?
I was looking through the Aurora developer docs but I am not seeing anything relevant to NWN's tilesets.

What about path node documentation?
Does pathnode have any influence on the rules of placing tiles?

So I opened up a SET file from _six's Spectral Woods tileset and started looking at a tile description. 

[TILE5]
Model=foe03_a02_01
WalkMesh=msb01
TopLeft=Wood
TopLeftHeight=1
TopRight=Wood
TopRightHeight=1
BottomLeft=Wood
BottomLeftHeight=0
BottomRight=Wood
BottomRightHeight=0
Top=
Right=
Bottom=
Left=
MainLight1=0
MainLight2=0
SourceLight1=0
SourceLight2=0
AnimLoop1=0
AnimLoop2=0
AnimLoop3=0
Doors=0
Sounds=0
PathNode=A
Orientation=0
ImageMap2D=mi_foe03_a02_01

The lines with terms like top, bottom, left, and right appear to describe rules for which tiles can be placed adjacent one another. And the rules are related to height and terrain for the corners or crosser for the cardinal directions.

Is that all there is to this? Or are there other rules as well? Does Path Node define any rules for tile placement?

Next i am wondering if anyone knows the algorythm that the toolset uses when looking at a SET file for determining which tile to place when painting terrain.
               
               

               
            

Legacy_Bannor Bloodfist

  • Hero Member
  • *****
  • Posts: 1578
  • Karma: +0/-0
SET File Questions
« Reply #1 on: April 03, 2013, 05:41:38 am »


               First off, get rid of 'six'es' tileset, and work or learn strictly from a Bioware tileset, with no addons from anyone else.  This is necessary so that you get the FULL set of rules etc for a given tileset.  And one that has proper path nodes etc...

The engine creates an area as defined by the size you choose 4x4, 8x8 12x16 or whatever size you chose.  It starts painting from upper left to lower right and fills in as it goes.  So first tile will always be a corner tile, with flat terrain or whatever you have chosen as the default terrain type.  For outdoors this is typically grass, and typically a flat tile, type "A" pathnode..  It will continure across that top row filling in with the edge tile of that set.  (Not actually the REAL edge tile, but whatever flat tile that the set has available, it will automatically rotate through any tile that meats the specifications for that position.  This means top left is grass, top rioght is grass, bottom left if grass and bottom right is grass.  The crossers will by default be set to nothing by default.

Now, the reason I had you work with a Bioware set verses anyone elses, is that 95% or more of the custom tilesets created by the community, don't bother with the actual rules section of the .set file.  The rules help the engine to more quickly find a tile that matches, they sort the tiles into section according to the rules, IE all grass tiles will be together in ram, all sand tiles etc, as whatever terrains you have defined in the .set file. You need a set of rules for each terrain type that you tileset has.  They have to be defined in a specific order as well.  If you look closely at the bioware grass tileset.set file, and read through the rules, you can start to figure out how the rules work.  Note that before you can create a rule that combines two different types of terrain, you must first define the primary rule for eacb of those terrains.... IE you need a single primary rule for grass, and one for sand, before you can create a rule that would alllow those two terrain types to meet.  Rules drive me nuts as there are so many thiings you have to keep track of.

Now, a huge number of folks will tell you that the "rules" are not absolutely  necessary, and those folks are right, the game WILL work without having the rules defined, it just won't work as quickly and as efficiently as it can work.  The rules help the toolset to autochoose what tiles to paint when you drag say a crosser over several different terrains and/or heights in one swoop.  IE click and drag a fence from one side of the area to the other, deliberately laying that fence across any streams, roads, or various terrains you may have.

The rules will allow the toolset to find the tiles it needs and paint them automatically.  You can always force a tile to paint by continuing to click on the same position and the engine will rotate through all variatioins that fit, but that can take a while and the engine finds them randomly so you may end up with the same tile painting several times before the engine finds the variant you are looking for.

You may have also noticed while building, typeicallly with the click-drag across type of painting, that sometimes the cursor will turn red, and a tile won't paint for a specific location... this is either because A) there is no proper rule setup for that location, or 'B)' there is no tile that fits that location.  The missing rule you can get around by just choosing to keep painting alternates down... the missing alternate tile, well that tile is just missing and you have to create it and add it to your .set file.

So, each tile has 4 possible sides that can match to a different or same terrain, AND 4 different crosser postions that also can match or not another tiles crosser settings.  Each terrain type has a set of rules for all OTHER terrains that it might butt up against, AND for each crosser positions it might run across.  That is why they drive me nuts... trying to remember all the possible combinations.  Thrikreen was working on a program or some sort of util, batch file, script or something that would automatically tell you what tile names are reuiqred to get different terrains to work together... however I never heard anymore from him on that, so I have no idea whether or not he got it working.

If you have specific questions about a line in the .set, ask.  Otherwise, you may want to browse the different tutorials from my signature as there are several regarding .set files, edge tiles, etc, spread out on the old CTP forums.  Just because you think you have read them all, well, doesn't mean you were ready to absorb that information back then.  Now that you have specific interest in a .set file etc, the data in those tutorials will have more meaning for you.
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
SET File Questions
« Reply #2 on: April 03, 2013, 06:17:46 am »


               thanks for the primer, Bannor, I appreciate it.

At present I am thinking big picture, and then will drill down to more details. The big picture question I am contemplating is whether to pursue an object oriented approach in which each tile is a game object containing its rules, and the various other assets like meshes needed for the tile to work in game versus the way NWN does it which is to have a SET file that defines the rules, and then a bunch of different art assets that work with those rules.

I like the object oriented approach as it would be much more flexible and extensible than the way NWN works, but need to consider whether I am capable of implementing such a thing. My hunch is that it would work much better for end users than the NWN way. As they would be able to simply add tiles to their game on an as needed basis.

Anyhow... I'll play with some NWN tilesets to get a better idea about this.
               
               

               
            

Legacy_Zwerkules

  • Hero Member
  • *****
  • Posts: 1997
  • Karma: +0/-0
SET File Questions
« Reply #3 on: April 03, 2013, 03:49:45 pm »


               

henesua wrote...

[TILE5]                                                       Tile number starts counting at 0
Model=foe03_a02_01                            Name of the model
WalkMesh=msb01                                 unused
TopLeft=Wood                                         Terrain type of the top left corner of the tile
TopLeftHeight=1                                      Height of the top left corner
TopRight=Wood                                      Terrain type of the top right corner of the tile
TopRightHeight=1                                   Height of the top right corner
BottomLeft=Wood                                   Terrain type of the bottom left corner of the tile
BottomLeftHeight=0                                Height of the bottom left corner
BottomRight=Wood                                 Terrain type of the bottom right corner of the tile
BottomRightHeight=0                            Height of the bottom right corner
Top=                                                           Crosser coming from the top
Right=                                                        Crosser coming from the right
Bottom=                                                     Crosser coming from the bottom
Left=                                                           Crosser coming from the left
MainLight1=0                                            Main light 1 available/not available
MainLight2=0                                            Main light 2 available/not available
SourceLight1=0                                        Source light 1 available/not available
SourceLight2=0                                        Source light 2 available/not available
AnimLoop1=0                                           Animation loop 1 on/off
AnimLoop2=0                                           Animation loop 2 on/off
AnimLoop3=0                                           Animation loop 3 on/off
Doors=0                                                     Number of doors
Sounds=0                                                  unused
PathNode=A                                              For path finding, not for placing of tiles
Orientation=0                                             Orientation of the path node (counter clockwise)
ImageMap2D=mi_foe03_a02_01         Mini map filename


You have a description of the terrain types and crossers on the tile in a tile entry. Those are used to find out which tile fits next to which other tile, but there are also rules which can do a little more than that. For example if you have a tileset with height differences but no tiles with water next to raised grass, you can make a rule that will change the height of a tile next to water to 0 if you place the water next to a tile with height 1. Without this rule you'll have to lower that adjacent tile manually to be able to place water next to it.
The rules help making the placement of tiles faster. Many people don't use any rules though and I'd say that you won't notice any difference in how fast tiles are placed if you have no set of rules as long as your tileset has no height differences.  If however you have one or more height differences, you should really make use of the rules.

The anim loop entries define if an animation loop is turned on or off by default. If you set an animation loop to 1 and there is no such animation on the tile it is no problem, it will just be ignored.
One thing that is important here is that ALL the tiles of a tile group share the same three animation loops.
So if you have a tile group with four tiles and turn on the animloop 1 of one of those tiles in the toolset, it will
be turned on on all the tiles, even if the animation loop 1 of tile xxx does something else than the loop of tile yyy.

Pathnodes have no effect on the placement of tiles. They are just for path finding.

BTW if you want to go through all the tiles possible at one place of an area, don't left click on the tile because that also changes adjacent tiles. If you hold the shift key and right click on the tile only the tile itself will get changed.

I know you don't need to know a lot of this for your project, I just thought it might help to share this information because some of it is not mentioned in any tutorials.'<img'>
               
               

               


                     Modifié par Zwerkules, 03 avril 2013 - 04:40 .
                     
                  


            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
SET File Questions
« Reply #4 on: April 03, 2013, 05:29:45 pm »


               Thanks, Zwerkules. The information is helpful.

And while I will not necessarily need all of the information that people give me, it is still useful to share it as others will likely refer to this thread when looking for information.



Now I have got work to do. I need to create my own tileset system....
               
               

               
            

Legacy_Michael DarkAngel

  • Hero Member
  • *****
  • Posts: 627
  • Karma: +0/-0
SET File Questions
« Reply #5 on: April 03, 2013, 11:06:55 pm »


               From the Wayback Machine -->> .SET Explained by Velmar

HTH

'Posted
 MDA
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
SET File Questions
« Reply #6 on: April 03, 2013, 11:14:23 pm »


               thank you very much, MDA. I'm gonna take that whole thing and store it in a file.