in reply to Re: OT: Tile maps
in thread OT: Tile maps

If you have say something along the lines of a bitmap describing what the area should look like

This is really my main problem. I don't have anything along the lines of a bitmap or anything else describing how my over all map looks. And I really have no clue as to how I could/should develop one.

At the moment I'm kind of thinking about just defining tiles at the beginning of the map in a header, then just having a list, like:
##header## name: foo.map author: baz size: 250x300 tileset: forest 0=ground1.jpg 1=ground2.jpg 2=trees1.jpg 3=trees2.jpg //etc etc ##endheader## 0 0 0 0 1 1 1 0 0 0 1 2 2 3 3 2 3 3 //etc
So first I would read the header (uh, some how), go through all of the 'terrain tile definitions' and generate an array with array[0]=grass1.jpg and so forth. That way i wouldn't have to do hash look ups on every tile. Then from there maybe I could apply further optimizations, such as chunking them into areas and having rows already generated off screen and so forth.

Replies are listed 'Best First'.
Re: Re: Re: OT: Tile maps
by Mr. Muskrat (Canon) on Feb 14, 2003 at 17:02 UTC
    I was thinking more along the lines of a hash:
    my %map = ( name => 'foo.map', author => 'baz', width => 250, height => 300, tileset => 'forest', tiles => [ 'dirt1.jpg', # half dirt, half grass 'mud1.jpg', # half dirt, half mud 'grass1.jpg', # grass with a few shrubs 'trees1.jpg', # sparsely populated with trees and many + shrubs 'trees2.jpg', # moderatly populated with trees, less s +hrubs 'trees3.jpg', # heavily populated with trees, sparse s +hrubs 'stream1.jpg', # stream running north/south (variation +1) 'stream2.jpg', # stream running north/south (variation +2) 'stream3.jpg', # stream running northeast/southwest 'stream4.jpg', # stream starts in northeast but winds a +way to the west ], layout => [ [ 1 6 1 0 2 2 3 ], [ 1 7 1 0 2 3 3 ], [ 1 8 1 0 2 3 4 ], [ 6 1 0 2 3 4 5 ], [ 7 1 0 2 3 4 5 ], [ 9 1 0 2 3 4 5 ], [ 1 0 2 3 4 5 5 ], [ 0 2 3 4 5 5 5 ], ], );
Re3: OT: Tile maps
by dragonchild (Archbishop) on Feb 14, 2003 at 16:59 UTC
    I would go about describing in English how it is you should be able to describe your map. For example, is there going to be a hard-coded set of N areas each with a set 16x16 tiles? Or, are you going to be more dynamic (allowing a player to build a city, thus changing the tile)? Obviously, the solution is different in each case. Once you've determined the parameters for what your map-description needs to be able to do, then the solution should be relatively obvious.

    Almost always, design is driven by requirements concerns. More than that, it's often discovered as a logical conclusion from the requirements. Sometimes, the only logical conclusion from the requirements. If you're casting about for a good design, make sure your requirements are solid first. If they're not (and they usually won't be), fixing them will help solve your design problems.

    ------
    We are the carpenters and bricklayers of the Information Age.

    Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.

Re: Re: Re: OT: Tile maps
by l2kashe (Deacon) on Feb 14, 2003 at 17:31 UTC
    Again talking about your area of "view", and tilesets. Lets say you define a 100x100 area as being forest. Heres what I am thinking.

    Now what you can do with this is start testing if present_pos <= some_val_from_next_area then start mapping that area before they actually encounter it. Also with this approach you can generate "random" dungeons of differing sizes to explore, and they should all have a slightly different look and feel, depending on how many tiles you add to each tileset. Also you can gen an area once, print out the map to a file, then tweak to add doors, etc via a simple editor which you can create to work with this data structure. Then save again, in edited form. That way if you have say a main castle, which is pivitol in your quest, all that needs to be done, is to map the def to tiles, and print, as opposed to generating the area then mapping then printing. {l2kashe}.o O ( maybe even do the mapping via the editor to avoid the mapping cost completly at run time?)

    Hope this helps and that the readmore tag works like I hope it does :P