Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: 2D Mapping Methods (loading, etc.)  (Read 5036 times)

0 Members and 1 Guest are viewing this topic.
2D Mapping Methods (loading, etc.)
« on: May 04, 2006, 02:48:42 pm »
  • Minalien
  • *
  • Reputation: +10/-1
  • Offline Offline
  • Gender: Female
  • Posts: 2119
Okay, I'm working on a game engine that I'm planning on setting out to work similar to Final Fantasy or Dungeons & Dragons v3.5 (in terms of combat for both). That really isn't what matters, but it's a background of this project. Anyways, I was thinking during Geometry class about the system for maps, and I came up with a way that I think should work pretty well, but I wanted some other opinions on this.

My plan is to have the maps stored in a .aum format (Aura (the game engine's name) Map), which is just a ZIP archive with a different extension, along with XML files detailing the maps, such as where objects are, layers, etc.

My plan is to have something like the following code for MapInfo.xml:
Code: [Select]
<MapInfo>
     <Name>Beta Map</Name> <!-- Name of the map as it will appear in-game -->
     <North>0</North> <!-- What map (filename) the player will be warped to if he reaches the north border -->
     <South>Beta2.aum</South> <!-- What map (filename) the player will be warped to if he reaches the south border -->
     <East>0</East> <!-- What map (filename) the player will be warped to if he reaches the east border -->
     <West>0</West> <!-- What map (filename) the player will be warped to if he reaches the west border -->
     <Layer0 x=0 y=0 xspd=0.5 yspd=0.5>Water0.aul</Layer0> <!-- Filename for the layer 0 tile map. Drawn first, below player, non-transparent, mobile) -->
     <Layer1 x=0 y=0 xspd=0.5 yspd=0.5>Water1.aul</Layer1> <!-- Filename for the layer 1 tile map. Drawn after layer 0, below player, transparent, mobile) -->
     <Layer2 x=0 y=0>Land.aul</Layer2> <!-- Filename for the layer 2 tile map. Drawn after layer 1, below player, transparent, immobile -->
     <Layer3 x=0 y=0>Buildings_1.aul</Layer3> <!-- Filename for the layer 3 tile map. Drawn after layer 2, below player, transparent, immobile -->
     <Layer4 x=0 y=0>Buildings_2.aul</Layer4> <!-- Filename for the layer 4 tile map. Drawn after layer 3, above player, transparent, immobile -->
     <Layer5 x=0 y=0 xspd=0.5 yspd=0.5>Fog0.aul</Layer5> <!-- Filename for the layer 5 tile map. Drawn after layer 4, above player, transparent, mobile -->
     <Layer6 x=0 y=0 xspd=0 yspd=0>0</Layer6> <!-- Filename for the layer 6 tile map. Drawn after layer 5, above player, transparent, mobile -->
     <ObjectFile>Objects.aup</ObjectFile> <!-- Filename for object placement file -->
     <EventFile>Events.aup</EventFile> <!-- Filename for event placement file -->
     <NPCFile>NPCs.aup</NPCFile> <!-- Filename for NPC placement file -->
     <MonsterFile>0</MonsterFile> <!-- Filename for Monster placement file -->
     <DoorFile>Doors.aup</DoorFile> <!-- Filename for Door placement file -->
     <CollisionFile>Collisions.aup</CollisionFile> <!-- Filename for Collisions information file -->
</MapInfo>
Layers 0 and 1 can be used for things such as animated water (ie: draw two layers then have them move over each other), 2 for land (ie: if you have water, and you want to do a beach scene, or a boat scene, etc.) 3 for transparent objects drawn below the player (ie: a stone, boulder, etc), 4 for transparent objects above the player (tops of buildings, etc), 5 for things above every thing that are animated (similar to layer 0, but transparent and for things like fog), and 6 for a second sky-level animation.

The AUL files will just detail tiles by id, seperated by a space (though I am working to find another method for this), and AUP files are just renamed XML files that detail where things are placed.

If anybody has any suggestions or other ideas, tell me, I'd be happy to listen.
Logged
Quote
There's such a double standard about religion in the modern world. Catholics can gather, wear white robes, and say "In nomine Patris, et Filii, et Spiritus Sancti" and be considered normal.

But if my friends and I gather, wear black robes, and say  "Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn", we're considered cultists.
  • Development Blog

OcarinaBoy

Re: 2D Mapping Methods (loading, etc.)
« Reply #1 on: May 04, 2006, 02:52:26 pm »
Is a 2D map possible for a 3D game?, great job! i like XML
Logged

aab

^ Evolved from a Hobbit
Re: 2D Mapping Methods (loading, etc.)
« Reply #2 on: May 04, 2006, 03:13:05 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 992
If your using layers 0,1 etc, as specific things in the engine, then it might make more sense to name them meaningfully.
+ Make an optional 'binary' tile layer format if you plan on building an editor for the levels.
I see theres some nice options in thyere eg: "<Layer2 x=0 y=0>". I imagine you've shown them for example, but i may as well mention anyway, that it would be good for x,y, etc to be assumed 0 withought having to be explicitly mentioned, as would be a common case.
Same with the <North>0</North> things. Planning on having multiple layers of collision at all?

btw Is it just me or is xml hard to read?
Logged




I ♥ Sol
.... I ♥ Sol ? wtf how long has that been there? >_> *rrrrrrrrar*
  • MySpace
Re: 2D Mapping Methods (loading, etc.)
« Reply #3 on: May 04, 2006, 03:55:35 pm »
  • Minalien
  • *
  • Reputation: +10/-1
  • Offline Offline
  • Gender: Female
  • Posts: 2119
Is a 2D map possible for a 3D game?, great job! i like XML
Who said anything about it being a 3D game? I mean, I could make a 3D game, but I actually prefer to work with 2D for now. But yes, a 2D map is possible for a 3D game, especially if you do (like with Neverwinter Nights) a 3D-tile-based map.

If your using layers 0,1 etc, as specific things in the engine, then it might make more sense to name them meaningfully.
+ Make an optional 'binary' tile layer format if you plan on building an editor for the levels.
I see theres some nice options in thyere eg: "<Layer2 x=0 y=0>". I imagine you've shown them for example, but i may as well mention anyway, that it would be good for x,y, etc to be assumed 0 withought having to be explicitly mentioned, as would be a common case.
Same with the <North>0</North> things. Planning on having multiple layers of collision at all?

btw Is it just me or is xml hard to read?
No, the layers are only specific to the order they were drawn. The examples (water, fog, etc) are just that, examples Hell, if need be, I could even use this so I can have layer 0 be a planet or island or something, then have clouds for layer 1, then use that visual effect to make it seem like you're on a floating ship or island, etc, even making underwater scenes work easier with layers 5 & 6. And since I dont have Visual Basic anymore (I returned Visual Studio to the person I was borrowing it from), I really dont think I'm gonna bother with a level editor yet, it's not that much work to just place them myself. I'll probably come up with an editor after I've put the final touches on the engine. And the 0's were there just for examples, to show that I had support for those in this. If this were an actual map file I was going to use, I would just omit those. And the multiple collision layers idea does sound like a good idea (so I could have things like bridges, so the player could only go under if they were shorter or something). I'll think about that idea a bit. And I think it is just you, I dont find anything difficult about reading XML >.>
« Last Edit: May 04, 2006, 04:01:18 pm by MiNalien »
Logged
Quote
There's such a double standard about religion in the modern world. Catholics can gather, wear white robes, and say "In nomine Patris, et Filii, et Spiritus Sancti" and be considered normal.

But if my friends and I gather, wear black robes, and say  "Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn", we're considered cultists.
  • Development Blog
Re: 2D Mapping Methods (loading, etc.)
« Reply #4 on: May 04, 2006, 08:16:36 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 150
Why do you need so many layers? Two layers for water blending? Three layers for backgrounds?! Two layers for fog/smoke!?! What are you smoking?!

When you find yourself creating inefficient solutions such as these, you need to step back for a moment and look at professional games for inspiration. Games such as 'Golden Sun' have years of talent behind them, so its a great place to start. Now, the GBA only has four tile layers, and yet Golden Sun has all the effects you've listed: two-layer transparent water, multiple walk layers, smoke overhead...

This is done through dynamic use of layers: a bridge on one layer that is displayed over the head of your player character might be under your feet when you walk over it several moments later. Nothing in the tilemaps or graphics were changed; what happened was that the layer value of the player itself changed.

Another example: in one map, two layers might be used to show running water, and one layer might be used to display the background. In a different map, you might use three layers to display the background, giving you three seperate levels of walkability!

Anything that the GBA can do, you can do: your computer likely has fifty-hundred times more power than the GBA... so think a little, add dynamic layers, and pare your seven layers down to four, and by only using layers as neccesary.

In addition: why do you need seperate layers for water, land, and buildings? Look at any GBA game - Golden Sun, again, is a great example: all of these layers are combined into one layer that you can walk on. There may be a second layer for overhead stuff, such as treebranches. But everything from the flowers to the sidewalks and the tree trunks and fences and so on are on one layer.

Secondly: you can combine the 'objects', 'npcs', 'monsters', and 'doors' files. All of these types of actors have something in common: they're just objects of different types. You should add the ability to declare any object as any type, regardless of where the definition of the object is saved.

Again: there's no need for a collision file. A great idea would be to let every tile in your game have its own 'block map'. When you assemble the map in memory at runtime, all you need to do is add all the block maps for your tiles together. This will save you time, as you won't need to maintain a seperate block map outside of your actual tilemaps. Saving multiple collision layers into files would be even worse: you would have to maintain more than one block map = more waste of your time. A better solution, if you wanted multiple layers of walkability, would be to assemble your block maps per layer, and switch the player between layers at need.

Note that this 'block layer assemble' idea is utilized in Diablo 2. You would do well to emulate Blizzard, they're some of the best in the field.

More: what if you want to have a map where there's two north exits, each leading you to a different place. By your current map file definition, this is impossible. So, here's a better solution: create a 'location' system, allow your 'events' to access your locations, and start scripting all your exits:

IF (player.location = "northexit to town") THEN
    changemap "north town"
ELSEIF (player.location = "north exit to dungeon") THEN
    changemap "north dungeon"
END IF

This is how I manage the map exits in my game; an idea which I lifted right out of the starcraft editor. To reiterate my earlier point: if you find yourself creating inefficient solutions, you need to stop and look to professional games for inspiration.

...and now that you've added a scripting language, you can get rid of your eventfile, and make every event scripted. Kapish?

So, now that I've hacked my way through your format, what are we left with?
Code: [Select]
<MapInfo>
     <Name>Fish's map is more awesomer!</Name>
     <Layer0>BackgroundIncludingLandWaterAndBaseBuildings.aul</Layer0>
     <Layer1>OverheadBuildings.aul</Layer1>
     <Layer2>MoreBuildingsAndTreeBranches.aul</Layer2>
     <Layer3>SmokeFogEtc.aul</Layer3>
     <ObjectFile>Objects.aup</ObjectFile>
     <ScriptFile>Scripts.aup</ScriptFile>
     <LocationFile>Locations.aup</LocationFile>
</MapInfo>
Not only is mine smaller, more effecient, and awesome, but it will also be easier to read and maintain.

I sure hope you're actually planning to listen to the suggestions you get on this board; elsewise, I've just typed all that out for nothing. Some people just show off their latest creations just to show off to the newbs.
Logged
Re: 2D Mapping Methods (loading, etc.)
« Reply #5 on: May 04, 2006, 08:39:27 pm »
  • Minalien
  • *
  • Reputation: +10/-1
  • Offline Offline
  • Gender: Female
  • Posts: 2119
Dont take me for somebody who wont listen to suggestions. If I wouldn't listen to suggestions, I wouldn't have posted it it at all. However, dont take me for somebody who's new to this all or doesn't know what she's doing, either.

So let's see here, shall we?
The water, fog, etc. layers I posted were examples. They could be used for any multitude of things. The reason I have it using multiple layers is so that I can do somewhat randomized movement of the two layers so that it wouldn't be generic-looking animated 2D water that always loops the same. The layers ARE only used as necessary, I was just putting them all in so that I could show how I am planning this. And in your example of Golden Sun, yes, they have multi-layered water and multi-layered fog, but keep this in mind: their layers are different than mine. The layers for the GBA are DISPLAY layers, so they are limited to that for rendering their graphics. So they didn't necessarily stick to 4 layers, they just stuck to rendering in only 4 layers. The PC does not have this restriction. My layers are different in that this is how the layers are defined. I can dynamically change how the fog works, how thick it is, etc, just by editing one display layer. So, for example, if I had multi-layered fog, I could make the fog somewhat thinner just by removing the top layer. This goes as well for your walking example. The method they used there is probably having a third dimmension. Although they dont render a third dimmension, they probably use a third dimmension when it comes to collision checking. That is how they could do the bridges that would be overhead or below, based on the user's Z value, and I think I may use something similar to that method in my engine.

As for combining the objects, npcs, monsters, doors, and events files, I am still considering that (as I was before I posted this thread), but the way I have it right now would be easier in terms of organizing media, so I am still undecided.

As for the block-map based collisions, although I believe this is a good idea, the reason I am using a collisions file is so that I may change a tile's collision in one map while leaving it alone in another map, without having to do two entries for that same tile. This would help in terms of map editing until I get a map editor programmed, because at the moment I am basing position of tiles on a tile's ID. And I know who and what Blizzard is, thank you, I'd rather not be treated like an idiot by having you tell me their some of the best in the field. :/

As for the multiple-exits, I do like the idea you suggested, and I will consider it. And no, I will not add a scripting language to the system. That is more complicated than what I wish to make this engine. I will have a small tag-based system for events and such (ie: action="RESTORE HEALTH" value="50") for items, events, etc.
Logged
Quote
There's such a double standard about religion in the modern world. Catholics can gather, wear white robes, and say "In nomine Patris, et Filii, et Spiritus Sancti" and be considered normal.

But if my friends and I gather, wear black robes, and say  "Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn", we're considered cultists.
  • Development Blog

Dayjo

shut the fuck up donny.
Re: 2D Mapping Methods (loading, etc.)
« Reply #6 on: May 04, 2006, 10:08:06 pm »
  • hungry..
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3602
Funny, I just finished the first version of my Mapper.



Still thinking of the most productive way to read the map files though so I'll keep an eye on this topic. (I was originally just using ini files.)
Logged
  • My Blog
Re: 2D Mapping Methods (loading, etc.)
« Reply #7 on: May 04, 2006, 10:55:30 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 150
Wow Dayjo, lookin' good there!

Heh, yeah... my mapmaker is ugly, but it gets the job done:

Four layers: one for the tiles you walk on, two that can do double-duty as walls, trees, objects, you name it, and one that does double-duty as roofs and shadows.

The best way to store map files is in custom binary resources. Really, we could talk for hours about how to best store map files; the best way to learn, in this case, is through experimentation. =)

And, as an aside, I just finished a battery of tests that initialized 100 active objects on my test map and monitored the framerate. Ladies and gentlemen, I give you... zOmg Fallen Dance Party!!!

Yes, that would be over 300fps, even with 101 active objects (~20 onscreen at any given time, I think).
Logged

Dayjo

shut the fuck up donny.
Re: 2D Mapping Methods (loading, etc.)
« Reply #8 on: May 04, 2006, 11:26:43 pm »
  • hungry..
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3602
lol Nice frame rate! :D.

And awesome graphics ^_^, Good job!

Your map maker is a lot better than mine lol, mine's really simple and really uneffective lol.
It amounts to BitBlt and an array, and that's about it.

That game you're working on looks like an awesome project ^_^, can't wait to see some more of it!
Logged
  • My Blog
Re: 2D Mapping Methods (loading, etc.)
« Reply #9 on: May 05, 2006, 12:31:07 am »
  • Minalien
  • *
  • Reputation: +10/-1
  • Offline Offline
  • Gender: Female
  • Posts: 2119
And awesome graphics ^_^, Good job!
Umm... Dayjo, those graphics are from Diablo 2. Those creatures are Fallen Shamans <.<
Logged
Quote
There's such a double standard about religion in the modern world. Catholics can gather, wear white robes, and say "In nomine Patris, et Filii, et Spiritus Sancti" and be considered normal.

But if my friends and I gather, wear black robes, and say  "Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn", we're considered cultists.
  • Development Blog

Dayjo

shut the fuck up donny.
Re: 2D Mapping Methods (loading, etc.)
« Reply #10 on: May 05, 2006, 01:01:35 am »
  • hungry..
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3602
Yeah, just worked that out, I've never played it :P
Logged
  • My Blog
Re: 2D Mapping Methods (loading, etc.)
« Reply #11 on: May 05, 2006, 01:15:01 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 150
Yeah, just worked that out, I've never played it :P
Oh, that's a shame! I lost a summer playing that game. Tremendous amount of fun. Various and sundry things have happened in the interim that have rendered Diablo 2 not as enjoyable by comparison, but I still look back fondly on that summer...

Most engines on this board try to emulate one of the various Zelda games out there. I've done something very similar, in that my engine is designed to emulate Diablo 2 as closely as possible - and to that effect, it's doing quite nicely, don't you think? Sure, shadows are missing, but I'm working on that.

So yes, my engine is reasonably awesome. Shall we get back on topic?

This is how I store my maps in files: each map is composed of a number of 'cells', with each cell being comprised of 256 (16x16) tiles. Each tile is 160x80 pixels, isometric, and is divided into 25 (5x5) 'subtiles', which can individually be set to block line of site, movement, teleportation, or slow the player down (useful for snowdrifts and mud!).

Each tile is pulled from a tileset, and each tileset is comprised of up to 256 tiles. These tilesets can be switched in and out of use at runtime... there can be over 256 tilesets in the game, but no map can use more than 256 tilesets. Even for the biggest maps, this isn't a problem.

Each cell also has four 32bit flags that can be set to allow other awesome effects: by setting the appropriate flag, you can substitute one cell for another one - even in another map. This allows for a seemless world, or, with the appropriate scripts, an everchanging labryinth (these flags can be modified at runtime - imagine if cells were flipped in and out at random, allowing for a maze that was never the same twice - indeed, you couldn't even retrace your steps, since the maze would be continually changing. These flags also allow for a cell to be layered on top of or below any other cell... this allows for two-story houses and basements on the same map; once again allowing for a seemingly seemless world.

Code: [Select]
Private Type tMapHeaderInFile
    ID As Long
    width As Byte
    height As Byte
    data As Byte
    namelength As Byte
    mapname(0 To 31) As Byte

    ptrToFirstCell As Long
    ptrToTilesetList As Long
    ptrToLocationList As Long
    ptrToScripts As Long
End Type

Private Type tMapTileLayerInFile
    Tileset As Byte
    tile As Byte
End Type

Private Type tMapTileInFile
    layers(0 To 3) As tMapTileLayerInFile
End Type

Private Type tMapCellInFile
    data(0 To 3) As Long
    tiles(0 To 255) As tMapTileInFile
End Type
« Last Edit: May 05, 2006, 05:53:46 pm by FarFromHomeFish »
Logged

aab

^ Evolved from a Hobbit
Re: 2D Mapping Methods (loading, etc.)
« Reply #12 on: May 05, 2006, 05:05:19 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 992
Though you are very likely to know fish, for anyone else reading this topic (working on 2d zelda games): Lttp had a similar combined-tile system as Fish has used above in his Diablo-like engine:
ie the tile maps were [64*64] arrays of words (snes->2 bytes), each representing a unique 16*16 tile.
Each word was the index of that 16*16 tile in a list of 16*16 'virtual tiles';
Each 16*16 'virtual tile' was an array of four 8*8 tile indices;
Each 8*8 tile index is indexing an 8*8 image of the frame of that number in the image of all the tiles.
- This was only in the overworld.
[edit Trying to explain better ]:
64*64 words, each displaying a 16*16 tile;
Each of these words was an index in an array of 'virtual 16*16 tiles'.
Each virtual 16*16 tile in the array, was an array of 8*8 tile indices.
Each 8*8 tile index was the frame of that tile in the tile image (made up of 8*8 tiles)
[/edit]

....................................................................................................

Anyway, working with an 8*8 tileset is rather over-tedious, so this system would make it easier to produce the maps (though the purpose in zelda was to save memory) by hving larger 16*16 tiles to work with in a map editor.
You could work with, ie in a map editor even larger tiles still through, eg: 32*32, just to make it even easier to work with. You could even have various shaped tiles, that are pasted onto the tile map as 16*16 tiles/virtual tiles. IE the tilemap is stored as 16*16 tiles, but the tiles you select and paste can be used as if either 16*16, 32*32 etc.
 - Though a map making system isnt specifically the subject of the topic, ill hope its relevant enough to discuss in this topic :).
However the larger the tiles get, the more tiles that would have to be searched through when changing which tile type is being used in pasting onto the map, so a balance should be reached between the tilemaps tile count, and the domain tiles (Just what i call the ones being referenced: Domain-[Map]->Codomain..So Map is mapping from domain..So those tiles are the domain tiles).
It also depends on the type of game, which makes making a very general map editor more difficult eg: Fish's Game is very much suited to having much larger tiles like he used, wheras a zelda game would need the ability of working with 16*16 tiles at some stage.

....................................................................................................

Anyway, when getting down to having lots of larger 'domain' tiles in the map editor: There is a map which maps the initial tile image to those 'usable domain tiles' (eg: 16*16 tile
  • is composed of four 8*8 tiles {0,34,5,7} in clockwise or w/e). But they could also be organised into groups, so when looking for a tile, change the group and select from a smaller group of tiles: they would all still be mapped from the same tile image, just it would make it much easier to search through.

// By 'usable domain tiles' i mean the largest tiles to select and paste onto the tilemap.
And, if these 'useable domain tiles' are 'pasted' onto the tilemap as 8*8 or 16*16 tiles (indexing the domain tiles), rather than the tilemap storing indices of 32*32 or 64*64 indices from the groups, then the 'usable domain tiles' could have as much redundancy and spacing as you'd want with no loss to the games performance/efficiency, making it much easier to make maps. There could even be multiple objects of the same type in different groups, so that eg: Tree could exist in both the forest group, and overworld group, while still referencing the same tiles.

Misc pop-in ideas
{
 Additionally, it would be great to be able to select many tiles from the usable domain tiles,
   and paste them onto the tilemap as a rectangular or mutiple (holding Ctrl) selection of tiles.
 Would even be good to have multiple layered useable domain tiles, that paste the multiple
   tiles onto their respective layer on the tilemap, eg: Say you had a tree tile, with a green
   tile on one layer and a tree-top tile on a 'cover' layer. Though often you'd just have one
   tile for this anyway, with a composite meaning so...
}

....................................................................................................

The final sort of plan that this sums to for me (Hopefully you can see the evolution of this plan out of the previous crap), is to, eg: have an extra tab next to 'Tiles|Objects' in Davjos tile editor there.
Lets call this tab 'Groups'.
When in the group tab, the user could load different 'grouping' scripts. These wouldnt have to be made as scripts though: they could be made in the editor.
In the groups tab would be displayed a grid of tiles, their values stored in the grouping tile-index array, each tiles index being that of a frame in the image shown in the 'Tiles' tab.
The groupings in the script would be a list of the rectangles on the grouping tile-index array that could be selected and pasted onto the tile map. Each grouping could be assigned a name.
So eg: "tree" 10,5,14,10; "bush" 3,2,4,3; - if end-grid position is a terminator, or "tree" 10,5,13,9; "bush" 3,2,3,2; - if end-grid position is inclusive, depending on the way you want to store the rectangle.
The user could make this grouping script automatically in the program by pasting tiles from 'Tiles' or from the tilemap onto 'Groups' (this would imply that the Groups wouldnt in fact be on a tab system next to 'Tiles' And 'Objects' to allow transfer between. And then, selecting a rectangle of tiles in the group with a ''prepare-grouping' tool (only rectangular boundaries that hadnt already been assigned may be selected from), and pressing a 'group together' button (Or Ctrl+g lol). A text field would contain the name that would be assigned to this new grouping, and as the mouse hovers over the context focused by selection of the 'groups' tab, a tool-tip would display the name (though i personally hate tool tips...They get in the way more often than they help, and decide not to show when you really need them => option to turn them off: The tool tips showing function prototypes in DevC++ are an absolute pain!).
The groupings script would also contain the map from the tile images frames to the grouping tile-index array, in a similar format to that of the pixels of an XBitmap (ie as a C implicit array aggragate of literals).
Each group script would also have a 'friendly-name' (or just use the name withought path), and under the context below the 'groups' tab would be (next to the New Group Name text field) a menu box with an arrow to pull down and select from among a list of the most recent group scripts, only unlike most recent file menus with the whole path, this would show just the name/'friendly-name', for ease of use, under the (absoultely non-critical) assumption that the groupings would be stored in the same folder and have different names as they would be used for the one tile mapping project. (Further, there could be settings specific to different 'projects', and the list of recent groupings would be defined seperately for each project, though importing is obviously something to implement.
Something else..I cant remmember.
Any of that make sense? lol
« Last Edit: May 05, 2006, 05:23:20 pm by aab »
Logged




I ♥ Sol
.... I ♥ Sol ? wtf how long has that been there? >_> *rrrrrrrrar*
  • MySpace
Re: 2D Mapping Methods (loading, etc.)
« Reply #13 on: May 05, 2006, 05:41:59 pm »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6629
I prefer to stick to KISS(keep it simple stupid), and store my maps in a binary file format with support for unlimited layers and such forth, and a single script file containing an 'ambient' script that runs on certain events (map start, map end, map create, map...blah...blah...blah)  that way it allows the mapper to decide how he wants the map to look and run, and not be limited by the programmers short sightedness.

And just to round it off, as everyones doing it, heres a screenshot of one of my editors (iv got to many <_<, i seem to end up coding one for each game i do).

« Last Edit: May 05, 2006, 05:44:17 pm by Helios »
Logged

aab

^ Evolved from a Hobbit
Re: 2D Mapping Methods (loading, etc.)
« Reply #14 on: May 05, 2006, 06:10:40 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 992
My idea is still incredibly simple from the users perspective (Its entirely KISSable), only much faster for producing maps.
Its basically what you mentioned (-ambient scripts of course lol), with more , that doesnt have to be used as its entirely optional and doesnt change thefinal product maps format at all, so is just as flexible.
Rather than (for many) tile editors constrictions to be a result of  ' the programmers short sightedness', it would often be a result  of using a system of a specific game that a tile editor was initially made for. Such a tile ed may have been made with enough of a flexibility for expansion to modular use, but in reality (remmember this is a hypothetic tile editor) wasnt designed for perfect use. Either that or the programmers short sightedness for someone making a tile ed withought a prticular project of their own in mind, and being just ..short sighted.
[edit]
I also keep area scripts seperate from maps, and have maps in the area scripts.
That way i can have conditions on which out of variable maps to load when entering an area, while still only specifing movement to the area (from otehr areas) through the area files name.
ie (pseudo): IF killed_ganon loadTiles("a.tilemap") ELSE ...
[/edit]
« Last Edit: May 05, 2006, 06:24:38 pm by aab »
Logged




I ♥ Sol
.... I ♥ Sol ? wtf how long has that been there? >_> *rrrrrrrrar*
  • MySpace
Re: 2D Mapping Methods (loading, etc.)
« Reply #15 on: May 05, 2006, 06:14:56 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 150
So, in my last post I mentioned cells made up of groups of tiles, but I didn't mention why I used them. Let me make up for that. =)

Only the nine cells around a player (the one he is standing in plus one in every direction) are loaded into memory at any given time. This keeps memory use down, and the cells are so small that loading a cell from a file into memory takes very little processing power. Only the objects and actors in these loaded cells are kept 'active'... thus further reducing the amount of power neccesary to run the engine.

If your engine is coded decently, the two biggest hits to your framerate are going to be the drawing (in a 2D engine, drawing is basically copying tons of small pieces of memory from here to there... copying memory is fast, but doing a lot of it is still slow), and your script system. Scripting languages, even the best ones such as lua, run at least 10x slower than compiled code. Thus, anything you can do to speed these two things up would be great. Iterating through less objects each frame would be a good start.

aab, I found the information about LttP's tileengine format interesting! I think it's so cool to see how programmers can work with limited resources to create such fantastic effects. The SNES is the perfect example of a very limited machine; if you didn't know what you were doing with it, your game wouldn't amount to much... but if you relaly knew how to work the hardware, as Nintendo's in-house studios and SQUARE did... you could produce some fantastic effects. By comparison, I'm so spoiled: I can write for a minimum spec of 400mhz and 64mb of ram and damn the consequences. =)
Logged
Re: 2D Mapping Methods (loading, etc.)
« Reply #16 on: May 18, 2006, 03:40:51 pm »
  • ZFGC Founder
  • *
  • Reputation: +2/-0
  • Offline Offline
  • Gender: Male
  • Posts: 470
I use Mappy and a script to load the map. Mappy stores them in binary format which is much faster than using .ini files or plain txt.
Code: [Select]
{
 //
 // loadMappyFile() script modified by Daniel Barras a.k.a. TheRealMethuselah
 // Mappy (C) Robin Burrows www.tilemap.co.uk
 //
 // Use: loadMappyFile('file.map', background image, tiles per row, tile size, layer depth);
 //
 mappyFileName = file_bin_open(argument0, 0);
 mappyTileImage = argument1;
 mappyTilesPerRow = argument2;
 mappyTileSize = argument3;
 mappyLayerDepth = argument4;
 // Read the width of the map from the Mappy File
 mappyMapWidth = file_bin_read_byte(mappyFileName) + (file_bin_read_byte(mappyFileName) * 256);
 file_bin_read_byte(mappyFileName);
 file_bin_read_byte(mappyFileName);
 // Read the height of the map from the Mappy File
 mappyMapHeight = file_bin_read_byte(mappyFileName) + (file_bin_read_byte(mappyFileName) * 256);
 file_bin_read_byte(mappyFileName);
 file_bin_read_byte(mappyFileName);
 // Draw the map on the screen
 mappyTileIndex = 0;
 for (mappyY = 0; mappyY < mappyMapHeight; mappyY = mappyY + 1)
 {
  for (mappyX = 0; mappyX < mappyMapWidth; mappyX = mappyX + 1)
  {
   mappyTileIndex = file_bin_read_byte(mappyFileName) + (file_bin_read_byte(mappyFileName) * 256);
   file_bin_read_byte(mappyFileName);
   file_bin_read_byte(mappyFileName);
   mappyTileRemainder = (mappyTileIndex mod mappyTilesPerRow);
   if (mappyTileIndex > 0)
   {
    tile_add(mappyTileImage, (mappyTileRemainder * mappyTileSize), ((mappyTileIndex - mappyTileRemainder) / (mappyTilesPerRow * mappyTileSize)), mappyTileSize, mappyTileSize, (mappyX * mappyTileSize), (mappyY * mappyTileSize), mappyLayerDepth);
   }
  }
 }
 file_bin_close(mappyFileName);
}

You can download Mappy at http://www.geocities.com/siliconvalley/vista/7336/robmpy.htm
Logged

OcarinaBoy

Re: 2D Mapping Methods (loading, etc.)
« Reply #17 on: May 18, 2006, 06:09:31 pm »
btw Is it just me or is xml hard to read?

Yeh, xml isn't hard to read
Logged
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.025 seconds with 69 queries.