Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Tile Ripping and Slanting.

This topic is 6796 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I noticed that TANSTAAFL is going to include a chapter for tile ripping and slanting in his book. I don''t think that I can wait that long. Is there any good resource on the net for doing this now? Reguards. --Chris

Share this post

Link to post
Share on other sites
unfortunately, i havent seen any articles on the topic, which was one of the motivating factors for including it in the laundry list of topics for my book.

here''s something to get you started in the right direction, at least:

in order to rip a repeating pattern, you must first(duh) have a pattern. this pattern should be in multiples of the tiles width and height, minimum multiple of 1

say, for example, that you are using a 64x32 iso tile, and your pattern(texture) is 128x128. out of this pattern, you will be getting 16 tiles. (128/64)*(128/32)*2 (the times two is because in any given 64x32 rectangle there is enough information to make two tiles.)

now, the order in which they are ripped is dependant on the type of iso map that you intend to use (staggered, slide, or diamond)

first thing we want to do tile the pattern 2 by 2(because we will be ripping out parts that arent actually on a single copy)

next thing is that we want a white tile cutter (its just the same size as a normal tile, but all white)

for the moment, lets assume that we''ll be using the diamond iso map

the equations for placing a tile in a diamond map(assuming the top corner is tile (0,0))


since we have 16 tile, and the pattern is 2 tiles wide, it is thus 8 tiles high(try not to worry about it too much,it''ll make sense later, it could similarly be 8 wide and 2 high, and it makes little difference)

so, we will have mapx go from 0 to 1, and mapy go from 0 to 7, and calculate the tilex and tiley for each of these, and take the modulus of those numbers and the pattern width and pattern height respectively. (make certain that you adjust for negative moduli)

now, blit a 64x32 rectangle from the image onto a temporary area, then blit the iso cutter using SRCAND to chop off the parts that arent ON the tile.

make any sense? i hope so. its hard to explain without pictures.

Share this post

Link to post
Share on other sites
for tile SLANTING:

for a 64x32 tile, you need a 16x16 bitmap, and you treat the 16x16 bitmap as a isomap in itself, as though it were a diamond tilemap with 0,0 at the far left corner.

you scan through the entire bitmap, and use these equations


(the 15 is because we want to have slanty=0 when x=15)

once you have slantx and slanty for each pixel, put the dot the same color as (x,y) on the 16x16 image onto the new slanted tile at (slantx,slanty) through (slantx+3,slanty)

and boom, you have a slanted tile

(again, this is probably confusing without pictures or some sort of programming example)

Share this post

Link to post
Share on other sites
Yah, I am curious as to what that is too. In my hex tile engine, i have each tile pic is a square with a hex drawn in it, and the remaining areas on the edge are a color like pure green or cyan, and when the image is blitted to secondary surface, any area of the image that is that color is not blitted. I believe this is called color keying. So I just draw one hex image after the other, with every other row shifted down by 1/2 the tile height, and basically the same thing can be done with iso tiles.

Maybe the question is refering to something else, and i will be interested to see what your book has to say about doing this stuff.

Also, if you want someone to proof read your book, I would love to do it. In some of the books I have read, they have had some grammatical and other errors. And errors in the code they provide on the CD. So, a word of caution, dont release any shit that hasnt been tested and that looks like half of it was slapted together at the last moment because the dead line was approaching.


Edited by - Possibility on 4/9/00 10:25:20 PM

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!