The posts in this thread should get you rolling just fine. My question is have you defined how "far" the character can see? Will it be single or multiplayer? How often will you be reloading a "map".

1) One you know how far a given character can "see", then you can use the suggestions from above to define the area. Personally I would define tile set types, (i.e desert, plain, castle, dungeon, etc..) as well as (pulling from Blizzard's StarCraft map editors vocabulary) doodads (trees, broken pillars, staircases/ramps, etc...). Then assign particular doodads to type set types. Ie Stairs_up-4.jpg belongs in desert, whereas Stairs_up-1.jpg belongs in the castle set. Then the char enters a castle scene. If you have say something along the lines of a bitmap describing what the area should look like, you can load the tileset, assign random tiles for the floors, walls, (could be multiple tiles for floor design, wall design, etc to display difference in terrain, think Final Fantasy 2 for SNES), sprinkle doodads across the non door/stairs/special bitmap offsets, all with simple method calls, and a tile set definition.

2) If you are gonna do multiplayer, then I'm not sure what types of optimizations are gonna be needed in terms of location/surroundings updating you are gonna have to do. (Im presently working on a text based MUD, which is along the same lines, but I dont have to deal with graphics, so if I come across some decent insights there I can msg you with the thoughts)

3) If you are reloading a map fairly regularly you might want to actually build once, via whatever method, and then store that do mem/disk, so that it gets paged in and out at once. As opposed to rebuilding every reload. I don't know what kind of constraints you are placing on yourself in terms of memory usage, wether you are implementing this on a PC/workstation type platform, or a emulator/specialized hardware platform. So with that in mind, I don't know what type of optimizations you can perform to minimize performance hits.

If you have defined a 64x64 grid, and use the tileset idea from above, and lets say the character can actually see 60x60, then you have a 4 tile buffer in any given direction. If the char were to move north, then the southern tiles simply move outside of your buffer reagion, and you randomly generate a new row of tiles across the northen buffer zone. This way you are only ever "paying" to create one row of tiles, as opposed to updating the entire "map" every move of the character. (I think this is filtering up from reading about how the original doom and wolfenstein games were thought up, and how to limit performance hits while creating a 3D world. While you aren't necessarily dealing with 3D, the benefits of implementing this way can be fairly substantial). If you prefer that they "see" 64x64, and can determine how long it takes to generate a line of tiles, you can alter your "offscreen" buffer to suit.

I hope this is at least somewhat helpful, and happy hacking :)

/* And the Creator, against his better judgement, wrote man.c */

In reply to Re: OT: Tile maps by l2kashe
in thread OT: Tile maps by BUU

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.