Jump to content


Photo

How Does Addtileset{} Work?


  • Please log in to reply
11 replies to this topic

#1 Llyr

Llyr

    Sergeant

  • Forum Members
  • PipPipPip
  • 83 posts

Posted 09 December 2005 - 06:36 AM

AddTileset {
    Name = "moonbase",
    Tiles = {
        [1] = {

everything clear so far... this starts the definition of a new tileset, gives it a name and then defines all the usable tiles.
each tile gets a number from [1] to [255] and then a description block.

IsometricImage = png_image("$(extension)/moonbase/32x40-001.png"),
that one's easy to. the game takes the png file, dividies it into sections of 32x40 pixels, and uses the the first of these sections as graphic for the tile.
count order ist from left to right, then from top to bottom (just the way you read text)

Shape = [[
                0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,
000,
                0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,
000,
                0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,
000,
                0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,
000,
                0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,
000,
                0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,
000,
                0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,
000,
                0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,
000,
                0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,
000,
                0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,
000,
                0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,0000,
000,
                FFFF,FFFF,FFFF,FFFF,FFFF,FFFF,FFFF,FFFF,FFFF,FFFF,FFFF,FFFF,FFFF,FFFF,FFFF,
FFF,
            ]],

so, thats now some sort of visibility chart for that tile. this is surely used to calculate such things as line of sight and to do collicion detection of shots flying around.

question one: is this just for line of sight, or is this also used to calculate wheter a soldier can step onto that tile, and how far above the ground he is shown when he does so?

the "cube" (yeah i now its not really a cube but a right parallelepiped but if-you-see-Kay... don't there exists some shorter word for "quader" in english? whats a cube called, that has not got all identical side lengths?)
so the "cube" (which is essentially the space that can contain one floor tile, one left and one right wall and one objekt or unit) is divided into smaller pieces (which i will call minicubes later on).
seems to be 16x16x12 minicubes, while the ground plate is 16 by 16 (length and width), and the height is 12.
this leaves us with an astounding number of 3072 small minicubes, each of which can be an obstacle to sight and prjectiles or not. this is representet by one bit for each of these minicubes. 0 = clear space and 1 = obstacle.

the code above is an 3dimensional matrix of bytes... with 3 axes: length x width x height

these axes are repesented the following way:

height = lines (first line means topmost minicube)
length = columns (left column means left minicube, right column means right minicube)
width = this is a bit more complicated now. width is represented by the hex number. every 4digit hex number equals one 16 digit (16 bits) binary number (this is where we get 16 units for width from) i think now the first bit of the hex number is the frontmost minicube, and the the last bit is the one minicube far behind.

question 2: is this right so far? is this a 3d matrix?

question 3: from which direction are we looking at the cube? from front left or front right? (or even from behind? <- then we would have to say las bit of the hex is frontmost minicube and we'd be looking at it from front again)


MinimapImage = [[
                408040,408040,408040,408040,
                408040,408040,408040,408040,
                408040,408040,408040,408040,
                408040,408040,408040,408040,
            ]],

thats easy again... a 4x4 pixel graphic for the minimap. RRGGBB hex numbers

 TU_Walk = 4,
        },

and now theres space for extra definitions. then this tile is done and the next one starts.
this example def says a soldier should need 4 time units to walk this place.
other examples (as seen in moonbase.lua) would be:

TU_Walk = -1, (this tile is not walkable)
Stop_LOS = 1, (this tile does stop line of sight)
HE_Strength = 20, (this tiles explodes when shot at)


question 4: can i get a list of all possible extra definitions and their allowed values?


       },
    }
}

thats it.


question 5: is there anything else that i don't know of, because it simply doesn't show up in this lua file? (only useful stuff for AddTileset of course... i don't expect to find the meaning of life in this lua file ROFL )


much thanx for any help B)

#2 Serge

Serge

    Project Leader: UFO 2000

  • Xenocide Programming Department
  • 785 posts

Posted 09 December 2005 - 07:22 AM

question one: is this just for line of sight, or is this also used to calculate wheter a soldier can step onto that tile, and how far above the ground he is shown when he does so?

It is only used for line of fire calculation (bullet collision detection). For line of sight it would consume too much resources to get such precision. So for line of sight only 'Stop_LOS' property is used which defines whether map cell blocks visibility or not.

question 2: is this right so far? is this a 3d matrix?

Yes, that's right.

question 3: from which direction are we looking at the cube? from front left or front right? (or even from behind? <- then we would have to say las bit of the hex is frontmost minicube and we'd be looking at it from front again)


question 4: can i get a list of all possible extra definitions and their allowed values?



question 5: is there anything else that i don't know of, because it simply doesn't show up in this lua file? (only useful stuff for AddTileset of course... i don't expect to find the meaning of life in this lua file  ROFL )

Try to add 'F_CONVERT_XCOM_DATA = 1' to the flags section of ufo2000.ini
With this option, the game will automatically export any x-com tileset which is used to a new ufo2000 format and store the results to 'converted_xcom_data' directory. So try to start a hotseat game, select some terrain and start mission. The game will run much slower on resources loading though. The game exports data not to lua format directly, but creates some html-files with the references to all the png pictures, so they are not directly usable, but are easier to examine.
ufo2000 development team
http://ufo2000.sourceforge.net

#3 Llyr

Llyr

    Sergeant

  • Forum Members
  • PipPipPip
  • 83 posts

Posted 09 December 2005 - 06:33 PM

thanks very much...

for everyone thats interested: (and to put some more useful info in this thread ^^)

first bit is the backmost tile, last bit is the frontmost.
you look at the cube from front right position.

special properties:

Armour (how much damage the tile can take befor destroyed. possible values from 0 to 255, while i didn't yet find actual values below 4. 10 = easy to destroy, 20=medium, 30= hard, 255=indestructible)

Stop_LOS (blocks sight, 0 or 1)

Block_Fire
Block_Smoke (self-explanatory? 0 or 1)

HE_Block (reduces damage from explosives for soldiers that have cover by this item, i guess. 0 to 255. if its a full wall with no window, HE_Block should be equal to Armour it seems)

Die_MCD (id-number of the tile which shall be shown if that one is destroyed)

Light_Block (how much it reduces the light radius on night maps. 0 to 255, while 10 is used for full walls, so i guess 10 already means total light block. windowed walls have light block 3)

Tile_Type ( type of the tile. 0= floor, 1 = left wall, 2 = right wall, 3 = object; doors count as walls, stairs count as objects, grass counts as object)

TU_Walk
TU_Fly
TU_Slide (tu requirements for movement. floors always have these, while all other tile types only have tu requirements if they are "walkable". if they don't it means you can't step on/through/past them. if they have a tu-cost, this is added to the cost of the floor benath, so its additional tu cost)

Fuel (only used if this tile can burn, and the value determines for how long this tile will burn, after beeing set on fire, i guess the number beeing the rounds)

T_Level (used for stairs and slopes, this is the height above the ground, where the units stands 0=ground, -24=full height. for any reasons this uses negative number, with -8 beeing the lower part of a stair, -16 beeing the higher part of a stair. angled terrain and other kind of slopes across 3 tiles use values of -4, -12 and -20. should be used on objects only, and objects nearly always should have a T_Level, since you can always possibly stand on them, if you drop in through the ceiling. maximum difference a soldier can climb is 8 or 10, i guess)

Door (set to 1 if its a door, which technically means a wall which can switch from left to right)

UFO_Door (set to 1 if this is a slide door. this always has references to 8 tile-images, even if the open-animation does not use 8 frames. in that case, the last frame of the animation is used several times. if you do set this you should also set an Alt_MCD. note: these doors don't work yet with ufo2000. should be used with walls only...)

Alt_MCD (is used together with UFO_Door and specifies what tile shall be shown, after the door has been opened. this is necessary since the new tile should allow units to walk through. the alternate tile itself should have this tile again as its Alt_MCD)

HE_Strength (this tile can explode. the fuel pumps in the gas station have a HE_Strength of 46)


i think that was all of them... if someone knows something additionall... please post :)

Edited by Llyr, 09 December 2005 - 06:34 PM.


#4 nachtwolf

nachtwolf

    UFO2000 Staff: Leader

  • Moderators
  • PipPipPipPip
  • 310 posts

Posted 10 December 2005 - 12:17 AM

first bit is the backmost tile, last bit is the frontmost.
you look at the cube from front right position.

<{POST_SNAPBACK}>


Just to make it easier for visual people :

Example : 792F (like FFFF or 0000)

|----7-----|-----9-----|-----2-----|----F----|
|8|4|2|1| |8|4|2|1| |8|4|2|1| |8|4|2|1| (bit power, see below)
|1|1|1|0| |1|0|0|1| |0|1|0|0| |1|1|1|1| (bit value, 0 = empty, 1 = matter is there)

Back -----------------------------> Front


1+2+4+8 = 0 to 15, it's a hex number so count: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F

EDIT : reversed bit order.

Edited by nachtwolf, 19 December 2005 - 11:46 PM.

Posted Image

#5 nachtwolf

nachtwolf

    UFO2000 Staff: Leader

  • Moderators
  • PipPipPipPip
  • 310 posts

Posted 19 December 2005 - 11:40 PM

Wouldn't 8x8x12 be enough for hitbox detection and actually easier to read/ use and edit? since we don't really see it, the difference between 16 and 8 is very hard to notice
but we do get this which simplifies and lightens the file a lot plus it's way more tile sized visually : each box would now be 2x2x2 pixels instead of the former 1x1x2.

Shape = [[
                00,00,00,00,00,00,00,00,
                00,00,00,00,00,00,00,00,
                00,00,00,00,00,00,00,00,
                00,00,00,00,00,00,00,00,
                00,00,00,00,00,00,00,00,
                00,00,00,00,00,00,00,00,
                00,00,00,00,00,00,00,00,
                00,00,00,00,00,00,00,00,
                00,00,00,00,00,00,00,00,
                00,00,00,00,00,00,00,00,
                00,00,00,00,00,00,00,00,
                00,00,00,00,00,00,00,00,
            ]],

Edited by nachtwolf, 19 December 2005 - 11:44 PM.

Posted Image

#6 nachtwolf

nachtwolf

    UFO2000 Staff: Leader

  • Moderators
  • PipPipPipPip
  • 310 posts

Posted 04 January 2006 - 11:32 PM

I would like to add a few property of the LUA I found in a few maps to the list Nappes submitted:

HE_Type (0 : HE, 1 : Smoke)
Used with HE_Strength to set damage type of explosion.

Gravlift (0 , 1)
Sets if tile is an elevator or not (tile above or under must be Gravlift too)

P_Level (0 to 24 I guess)
When the tile is drawn, this amount is subtracted from its y
(so (y position - P_Level) is where it's drawn)

Footstep (unknown)
The Sound Effect set to choose from when footsteps are on the tile

No_Floor (0 , 1)
If set to 1, a non-flying unit can't stand there

Also, properties of unknown purpose :

Flammable

Target_Type

Smoke_Blockage

Big_Wall

Edited by nachtwolf, 06 January 2006 - 01:29 AM.

Posted Image

#7 Kratos

Kratos

    UFO2000 Staff

  • Moderators
  • PipPipPipPipPip
  • 4,113 posts

Posted 10 January 2006 - 03:54 PM

It would be nice if there was some sort of damage system for tiles such as lava, electric tiles, etc. for each step to do a certain amount of random damage. I have been wanting to make a map full of lava...and a fortress with blockage of electric zapping if crossed...

Damage_tile(?)

Edited by Kratos, 10 January 2006 - 03:55 PM.


#8 nachtwolf

nachtwolf

    UFO2000 Staff: Leader

  • Moderators
  • PipPipPipPip
  • 310 posts

Posted 10 January 2006 - 06:04 PM

It would be nice if there was some sort of damage system for tiles such as lava, electric tiles, etc. for each step to do a certain amount of random damage. I have been wanting to make a map full of lava...and a fortress with blockage of electric zapping if crossed...

Damage_tile(?)

<{POST_SNAPBACK}>


WARNING : THE PROPERTIES DESCRIBED BELOW (along with Damage_tile) ARE NOT REAL PROPERTIES AND ARE ONLY SUGGESTIONS

This involves a bit of programming...

Damage_tile sounds like the tile is taking the damage.

What about :
Reduce_HP - Good, except this could be about cooking sauce.
Is_Threat - Sounds like a boolean.
Killer_Tile - Sounds trippy.
Pandora_Box - A bit mystical.
Land_Hurts - Sounds like a Lemmings game property.
Booby_Trapped - Why do I see a major explosion when I read this name?
No_Mans_Land - I just love this name.

No seriously, Harm_Soldier or Harm_Unit describes the property best.
Value would likely range from 0 to 255.

The only problem I see is that it would reduce under-armour... which is already quite weak. Hopefully, explosions power have been fixed. (Thanks Hobbes)

Still, that should be put up on mantis.

Edited by nachtwolf, 10 January 2006 - 06:19 PM.

Posted Image

#9 Exo2000

Exo2000

    Colonel

  • Moderators
  • PipPipPipPipPip
  • 1,009 posts

Posted 10 January 2006 - 06:55 PM

It would be nice if there was some sort of damage system for tiles such as lava, electric tiles, etc. for each step to do a certain amount of random damage. I have been wanting to make a map full of lava...and a fortress with blockage of electric zapping if crossed...

Damage_tile(?)

<{POST_SNAPBACK}>


WARNING : THE PROPERTIES DESCRIBED BELOW (along with Damage_tile) ARE NOT REAL PROPERTIES AND ARE ONLY SUGGESTIONS

This involves a bit of programming...

Damage_tile sounds like the tile is taking the damage.

What about :
Reduce_HP - Good, except this could be about cooking sauce.
Is_Threat - Sounds like a boolean.
Killer_Tile - Sounds trippy.
Pandora_Box - A bit mystical.
Land_Hurts - Sounds like a Lemmings game property.
Booby_Trapped - Why do I see a major explosion when I read this name?
No_Mans_Land - I just love this name.

No seriously, Harm_Soldier or Harm_Unit describes the property best.
Value would likely range from 0 to 255.

The only problem I see is that it would reduce under-armour... which is already quite weak. Hopefully, explosions power have been fixed. (Thanks Hobbes)

Still, that should be put up on mantis.

<{POST_SNAPBACK}>


Under-armour rarely gets hit as-is, so it'd mean you'd have to be a bit more careful. :D

Pandora_Box? Well, that'd detonate a random size, strength and type of weapon when stepped on.

Ex;

Soldier steps on, 5-radius, 10-power stun.

Soldier steps on later, 2-radius, 255-power explosion.

Or something. :D
Posted Image

#10 Blitzen

Blitzen

    Sergeant

  • Forum Members
  • PipPipPip
  • 80 posts

Posted 17 January 2006 - 06:22 PM

[quote name='Exo2000' date='Jan 10 2006, 07:55 PM']
[quote name='nachtwolf' date='Jan 11 2006, 01:04 AM'][quote name='Kratos' date='Jan 10 2006, 04:54 PM']It would be nice if there was some sort of damage system for tiles such as lava, electric tiles, etc. for each step to do a certain amount of random damage. I have been wanting to make a map full of lava...and a fortress with blockage of electric zapping if crossed...

Damage_tile(?)

<{POST_SNAPBACK}>

[/quote]

Pandora_Box? Well, that'd detonate a random size, strength and type of weapon when stepped on.

Ex;

Soldier steps on, 5-radius, 10-power stun.

Soldier steps on later, 2-radius, 255-power explosion.

Or something. :D

<{POST_SNAPBACK}>

[/quote]

youre plain evil.... I like it!
[MC]T_II_JudgmentDay
[MC]T_II_Judgment
[MC]TerminatorII
Blitzen

From:
Freelancer
Hyperiums

And Now UFO2000!

Detective: "He died from a drug overdose."
Officer: "Really? Which one?"
Detective: "Lead."

#11 bamb

bamb

    Captain

  • Forum Members
  • PipPipPipPip
  • 155 posts

Posted 24 April 2007 - 05:25 PM

I have problems creating new tiles, tried to add a few new tiles to the dawn city beta 101 tileset, but all sprites after 235 (industrial roof, gray wavy roof) are blank in the editor, although there is action going on in the png, there are graphics for walls after 235...

What Am I Doing Wrong?

I modified the industrial roof tile sprite just to see if it was loading the file and it did load the modification. So it is definitely loading this.

Here's the png file:
[img=http://img404.imageshack.us/img404/62/dawnmasterimagelist3vb5.th.png]

EDIT:
AH! It seems I have problems with the alpha channel, my image editor has all the graphics after 235 fully transparent... gotta fire up something more heavy then I guess.

Edited by bamb, 24 April 2007 - 05:29 PM.


#12 nachtwolf

nachtwolf

    UFO2000 Staff: Leader

  • Moderators
  • PipPipPipPip
  • 310 posts

Posted 26 April 2007 - 11:09 PM

I have problems creating new tiles, tried to add a few new tiles to the dawn city beta 101 tileset, but all sprites after 235 (industrial roof, gray wavy roof) are blank in the editor, although there is action going on in the png, there are graphics for walls after 235...

What Am I Doing Wrong?

I modified the industrial roof tile sprite just to see if it was loading the file and it did load the modification. So it is definitely loading this.

Here's the png file:
[img=http://img404.imageshack.us/img404/62/dawnmasterimagelist3vb5.th.png]

EDIT:
AH! It seems I have problems with the alpha channel, my image editor has all the graphics after 235 fully transparent... gotta fire up something more heavy then I guess.


As a general rule, keep values under 254. Getting 257 tiles in the same image could mean trouble with the game engine (not tested). Multiple images are fine.
Posted Image