Outpost Universe Forums

Projects & Development => Outpost 2 Programming & Development => Topic started by: Sirbomber on September 16, 2009, 02:52:41 PM

Title: Tile Id List?
Post by: Sirbomber on September 16, 2009, 02:52:41 PM
Does anyone have a list of each tile's hex ID?  I want to automate the process of recording tubes for my AI, but if I try doing it by celltype the AI tries to build tubes under buildings because it's stupid.  Anyways, I've tried looking around with no luck.  I figure this is exactly the sort of thing Hooman would keep lying around "just in case" though.
Title: Tile Id List?
Post by: Hooman on September 17, 2009, 12:23:11 AM
I'm not sure I understand. You want to record tubes that are pre-existing? I'm guessing you tried using the cell type, and found that buildings have tube cell types, which has foiled that plan, so now you want to examine tile indexes?

I believe the tube tiles are consecutive, so if you get the index to the first one, you'll have a range of 16 tiles to check for. I assume you want to limit the search to some smaller region though, so you don't record tubes from an enemy base. You know, attack of the earthworkers and such if they ever lose a tube.



Ok, so... the starting indexes of tubes tiles, by terrain type are:
Code: [Select]
Rock: 929
Mud: 417
Sand: 1678
Each one is consecutive for 16 tiles.

Ex: [929..(929+16-1)]  <- Endpoint inclusive
Ex: [929...(929+16)]  <- Endpoint exclusive

In case you need to know the directionality, I'll release a VB project that lets you view the tile groups found at the end of .map files.

 
Title: Tile Id List?
Post by: Sirbomber on September 17, 2009, 08:14:23 AM
Yes, that was my plan: rather than manually record all of the tubes that the AI needs to rebuild, I wanted to automate the process.  I did however know that underneath buildings was also considered "tube 0."  I thought this would actually be neato as the AI would build tubes where destroyed structures used to be, meaning that even if the structure took awhile to get rebuilt, a tube would be built so things wouldn't disabled for extended periods of time.  Of course, the plan didn't quite work as I had hoped, as the AI awkwardly tubed under the entire structure...

Anyways, back to what I'm looking for.  In this code, tile IDs are used to determine lava possible tiles:
Code: [Select]
// SetAllLava:
// light lavarock: 1C7-1D6
// dark lavarock:  1D7-1F8
// edges:          22F-25E  (between light & dark lavarock)

void SetAllLava()
{
  int x,y,tile;
  LOCATION mapsize(1024,1024);                         // create a point wayoff the map

  mapsize.Clip();                                      // clip it, so we have the mapsize

  for (y=0; y<mapsize.y; ++y)                          // run through all rows
  {
    for (x=31; x<mapsize.x+32; ++x)                    // check every tile on each row
    {
      tile=GameMap::GetTile(LOCATION(x,y));            // get the tile on that position
      if ( ((tile>=0x1C7) && (tile<=0x1F8))            // is this one a lavarock...
        || ((tile>=0x22F) && (tile<=0x25E)) )          // ...or an edge ?
      {
        GameMap::SetLavaPossible(LOCATION(x,y),true);  // -> then set it to LavaPossible
      }
    }
  }
}

I want something that does the exact same thing, except instead of finding black rock tiles and setting them lava possible, it finds tube tiles and records them to a build group.  All I need from you is a list of tile IDs, and I can do the rest myself.
Title: Tile Id List?
Post by: CK9 on September 17, 2009, 11:31:00 AM
well, bomber, if that doesn't work out, you can always have the AI do what I did in multiplayer before rushing became just about the onbly tactic ever used:

surround each building with tubing.
Title: Tile Id List?
Post by: Sirbomber on September 21, 2009, 07:48:47 AM
Really?  Nobody has this information?

Maybe I'll try PMing BB, he might have this info since he worked on the mapper.
Title: Tile Id List?
Post by: Hooman on September 22, 2009, 12:41:46 AM
... You read my post, right?

Quote
Rock: 929
Mud: 417
Sand: 1678

Each one of those is the start of a run of 16 consecutive tube tiles.
 
Title: Tile Id List?
Post by: Sirbomber on September 22, 2009, 07:16:27 AM
Oh, I thought that was the starting index of the tilesets, which wouldn't have helped me at all.
Title: Tile Id List?
Post by: CK9 on September 23, 2009, 12:06:31 AM
speaking of tile ID's, is there any way to just have the tile mode associated with the tile type?  It would be a lot easier than placing them in the mapper, especially on larger maps.
Title: Tile Id List?
Post by: Hooman on September 23, 2009, 12:26:06 AM
Yes, it would be. However, there are some issues with that idea which prevented it from being used in practice.

First, a given tile will have different cell types in the original maps, so there is no clear way to automatically assign the correct cell type. The tile group information would be helpful, and I had thoughts of manually adding that information, but as it's a manual process, I just never got around to it. Also, when a lot of the map editor code was written, cell types were perhaps partially forgotten about, and only really remembered after most of the tile pasting code was done. There is also the issue that since Outpost 2 can allow the two to be set independently, it's sort of nice to be able to do so. But yes, even in that case, a good default would have been nice.


Come to think of it, that VB project I posted a few days ago was probably what I was going to use to add the cell type information. But like I said in that post, the project was never really finished, and contains a bit of odds and ends from various tests and ideas that never quite led to the original idea.
 
Title: Tile Id List?
Post by: Hidiot on September 23, 2009, 04:22:43 AM
Yes, the mapper needn't make cell types perfect, but a default, the most commonly used cell type for that tile, would help mapping a lot.
Title: Tile Id List?
Post by: Sirbomber on September 23, 2009, 06:42:04 AM
Why not make the "defaults" user-determined either the first time the mapper is loaded or whenever a new map is made?
Title: Tile Id List?
Post by: CK9 on September 24, 2009, 01:02:21 PM
I like that idea myself...now if only hacker would give us the source code, lol
Title: Tile Id List?
Post by: Sirbomber on September 24, 2009, 01:34:45 PM
He doesn't like giving out source code, unless it's for something broken and useless, like PCW.  :P  
Title: Tile Id List?
Post by: CK9 on September 24, 2009, 01:48:55 PM
yea, but he's busy and he needs to let us have it so he doesn't take time away from stuff for it.