ID:173691
 
I was wondering how you would go about making and if it is possible to make the 32x32 size of a DMI act as 4 16x16 tiles so to speak. I am not sure if it is possible or not, but I am really curious of that. I am working on an RTS, and each mob takes up only 16x16 of a tile, so you can see the possible thought of that.

I think pixel movement may be a piece of that... I have gotten the 16x16 using pixel_y and pixel_x working somewhat, but I had problems when I attempted to transfer this to a click movement system. The mobs went back to the classic style of 32x32 tile based.

I have seen it done I think, although I'm not sure ( such as Ebonshadow's DrugCraft for example, oh and Ebon, I'm still waiting for that release! ;-) ). Thanks for any advice or help beforehand, and afterhand. =)
Well, first, you'll want to use MouseDown() (and possible MouseUp()) instead of Click(), because Click() does not give you the pixel-perfect click location.

Second, you'll want to look out for a few catches if you use walk_to() and such. For example: (in subtiles)
<code> X: unit T: dense turf TT..TT TT..TT X...TT ....TT TTTTTT TTTTTT </code>
Here, if the unit is trying to move to the northeast, as the walk_to() will tell it to, it will bump into the dense turfs. That should, however, be the only instance where it will get caught up, so as long as you put in a work-around for when units Bump() into turfs like that, you should be okay.

On to getting it to work, mainly you'll want a variable for the position in the tile the mob is in (1 for NE, 2 for SE, 3 for SW, 4 for NW). Use that to adjust the pixel_x and pixel_y values. You can use MouseDown() to get the subtile that you're clicking in with the second and third arguments. Override the Move() proc for the units, so that they will adjust their subtile position before actually moving. Setting animate_movement to 0 will probably be essential. And I'm done rambling.
In response to Garthor
For the thought of walk_to and the Bump()... would you recommend walk_to or a get_step style proc to control this? And I am going to end up having to code an AI so the units get pathfinding down slightly and hopefully know what combat it, since a large piece of combat will be automatic, seeing that a person cannot view all their units at once.

Placing vars to describe each position makes some sense, but could you clarify how this would work, it still confuses me somewhat. Mainly how would I go about the output of the variables, as text, number, or possibly pixel_x/y in text, and for some reason it in turn looks to need nearly the same variable for the mob as well? And with each of those, I can see the number and pixel_x/y possibly used with MouseDown()(Although I don't fully understand it.), but the text seems a little more elusive to my mind right now.

About MouseDown(), I either read it as it selects the direct pixels of a tile, or it selects a predetermined quadrant so-to-speak of the tile. Overriding the Move() proc for the units in turn detecting the decided quadrants/ x/y values so they move accordingly.

And the note of setting animate_movement to 0 is to make it so the individual mobs do not appear graphically to slide across a dense tile such as a mountain and instead switch themselves immediately to the next location? Do you think with proper pathfinding that the slide could be ignored, although it seems like it would need a high level of pathfinding in place... Although I haven't tested to see if the graphics look just as smooth without that slide.

Thanks for the help, glad to see we still have people out here over the years helping out the wee people. =)