Jump to content


Terrain codes RA2/YR?

  • Please log in to reply
2 replies to this topic

#1 wesnoth

  • Members
  • 6 posts

Posted 04 June 2013 - 04:31 PM

I've decoded [IsoMappack5] and am trying to read the contents of the cells. To be explicit I can see these:

struct Iso_Map_Pack_Entry {
unsigned short x;
unsigned short y;
short tile;
unsigned char zero1;
unsigned char zero2;
unsigned char sub_tile;
unsigned char z;
unsigned char zero3;

I'm looking for a full listing of the tile variable (what code is what item), and the sub_tile if it works like that (it's never changed in my testing so far so I don't know anything about it). It's possible to work it out using final alert 2 to create examples of every tile, but it would take so long, is prone to errors, and things will be missed (a real pain I want to avoid).


[OverlayDataPack] and [OverlayPack] are next on my todo list, if anyone has hints to help me read them quicker I'd appreciate it.


edit: I've checked the 100 MO maps and there's 767 tile types and 57 sub tile types used, so it's not something I want to work out manually.

Edited by wesnoth, 04 June 2013 - 07:10 PM.

#2 Starkku


    Putting the Pro' in 'Procrastination'

  • Hosted
  • 433 posts
  • Location:Finland
  • Projects:Project Phantom
  •  Developer of Project Phantom mod for C&C: Yuri's Revenge.

Posted 04 June 2013 - 09:18 PM

I'll explain some of the terms I use before I'll delve any further into your problem. You might know atleast some of this but I am not sure about that so I'll go ahead anyways.


Tile set - Basically a collection of tile files declared in game's theater INI files The items in FinalAlert/FinalSun dropdown menu 'Terrain/Ground' are tile sets.


Tile file - Sometimes called TMP's by some. Every tile file that belongs to a tile set and all files belonging to same tileset have same base name, for an example 'clear', and two-digit numbering starting from 01 all way up to 99 (the actual maximum number is defined in tile set declaration in INI, but 99 is the maximum value you can use), and an optional additional prefix system where letters from a to g are appended at the end of the filename, i.e for an example you have clear01.tem, (.tem being temperate theater's file name extension), clear01a.tem, clear01b.tem and so on. These are used as additional variants for that particular file, except for certain cases like bridgeheads where they're used for damaged versions of that tile.


Tile - Each TMP format tile file consists of multiple tiles, which each occupy one in-game cell. Every tile in a TMP file has an index number, with indexing starting from 0.


In IsoMapPack5 format, the variable you listed as 'tile' is the number of the tile file/TMP in question in the theater, for an example if the first tile set in temperate theater has only 1 tile, this number for the first tile of the second tile set would be 1 (it's zero-based) and so on. On other hand, variable 'sub_tile' is the index/number of the tile in the TMP used for that particular map cell. The reason why you see lots of zero for this one is because all TMP tile files with only 1 tile, such as most of the grass, sand etc. tiles obviously always have it set to zero.


Thanks to the above fact of map format referring to specific tiles rather than tile sets, it would be very, very time consuming to figure out which number corresponds to which tile and create a comprehensive list of it. Then there's the fact that some mods add more terrain tiles, which ends up in extending the list and relying on some sort of hardcoded conversion table for any sort of tool in this case wouldn't really be a good idea. It could help a bit if you elaborated on what you're trying to accomplish, though.

Edited by Starkku, 04 June 2013 - 09:20 PM.


#3 wesnoth

  • Members
  • 6 posts

Posted 04 June 2013 - 10:21 PM

Thank you for the reply. I actually know very little so this is a very helpful post. Long time player, but very little modding experience.

Basically I'm playing with the idea of a map generator that copies part of an existing map and flips it to fill the rest of the map. Development has barely started, lots of problems need to be solved and it may not even be viable. So far the flip mechanic works, with [IsoMapPack5] only, on square maps. The tile and sub_tile are currently copied verbatim, which makes any boundaries wrong (boundaries which should be grass->sand are sand->grass, slopes are wrong etc). This is one of the hurdles to overcome and the reason for this topic.

I know it's a big project to get it to work flawlessly and I don't expect to get that far. Maybe one day it'll progress far enough to take some of the pain away from making tournament maps, maybe not. Note that I don't plan on implementing everything, things like map previews are a sidetrack that can be added easily by opening and saving in FA2.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users