ID:154058
 
Subtile management is the term I use to refer to squares that are divided up into four different "subtiles" using objects. That way, it's as if the whole game were run using 16x16 tiles instead of 32x32 tiles, because each tile contains 4 subtiles. Now, I know a few games that use this (Minesweeper and Fourtris for example), and I'm wondering if anyone has thought up some nifty ways to organize this.

My current system isn't one I'm too happy with. Basically, each turf has four variables, room1, room2, room3 and room4, which it uses to refer to the subtiles contained within itself. At turf/New(), each of those variables becomes a new subtile, which then gets its pixel_x/y modified so that it fits into the turf properly. Each subtile is then given a proper tag based on it's location inside the turf. Something like this:

tag = "[(turf.x*2)+1],[(turf.y*2)]"

...which basically allows it to work like a normal grid coordinates using tags. Each subtile is also given new X and Y coordinates, so they can find the subtile north of them using their coordinates, with +1 to the Y. Basically locate("[X],[Y+1]") would return north from that subtile.

All in all though, it tends to be rather ugly. I'm wondering if anyone else has thought up some colorful ways to organize subtiles. Or if you just want to share the way you organize them, they'd be good too.
Subtiles are a pain in the butt to work with. Some of Incursion's oldest code--much of which is now out of use but so ingrained that I'm afraid to remove it--deals with handling subtiles. So far I like your system better than mine, anyway.

The extent I've worked with subtiles has convinced me that I started the whole thing out half-baked and really could have done better.

Lummox JR
My system in SweepMiner isn't quite so flexible, but I do almost the exact same thing with tags. I don't use pixel_x and pixel_y for offsets, though--all of the icons are shifted to the four locations whenever a skin is loaded, and stored in a big associated list for retrieval.

-AbyssDragon
I can think of another way using a two dimensional array or associative list but it probably wouldn't be much different than using your tag system. It would create a very large list/array but it could eliminate many of the calls to locate(). Anyway, what are your plans for the room1, room2, room3, and room4 variables? I can see you using them to look in the imediate area with only a few locates (for the surrounding turfs) but it seems that could almost as easily be done using the tags. It just seems like a lot of extra variables, and I'm not sure how much extra flexibility they will provide.

You probably have some planned use, I'm probably just being a little dense :p
My only big subtile project was Ballistic. I found out that 64 subtiles per turf with a viewscreen of 21x21 tiles makes BYOND very unhappy. I guess keeping track of 30,000 independant objects on screen would be messy for any system.

Tanks also has a subtile system for the satellite map. It came out before the current pixel offsets though.

Both my systems have a large 2 dimensional list to track which element goes where, then just maps them to a particular turf (or screen_loc) depending on the index values. (1 to 8 is turf 1, 9 to 16 is turf 2, and so on).