Map Editor

CRSdefiance
08-14-2001, 10:24 PM
I am now at the point where I can seriously begin putting some graphics together to make a map for my RPG, but how do I make an editor, and how can I save the maps to be used later? HELP!!

Spectre
08-15-2001, 04:29 AM
The map editor will basically load your file format, read it, and then load it. The type of RPG you are making will determine what your map editor is really like. I.E. If it is the classic Diablo/UO style, you just use the same angle that you look down in game to place tiles. I REALLY wish I could show you the map editor I use on Faldon [an online RPG], but, it is integrated into the client and is only accessable by GMs.[In case that wasn't clear, I am a GM (gamemaster) on Faldon, not the creator. If anyone has played in the past or something, I am not Zer, the creator. :) ] But, you could get some pretty good ideas from that. Anyhow, as far as the actual map itself, depending on how detailed you want to do it, what format you should actually use...
e.g.
VERY simple map... a single set of tiles at every grid location, top down view... very easy. :) all you would have to do is [in memory] make a matrix that spans the total size of your map [assuming you use 20x20 tiles, you, obviously, would have 1 entry in the matrix for each box on the grid]. Then, you use a number or set of characters or something to represent which tile number for that location. Then, the actual file for that would be something like:
[basic information]
[map data]
.
.
[end]
where mapinfo would be stuff like: your X,Y dimentions and/or background image and/or info on what midi to play or whatever.
Then, your actual map data, assuming one tile per gridspace, would just be a long list of numbers or characters with some sort of seperation... then, you could have, say, a 3x3 map that looks like
1 0 10
2 5 9
3 1 0
you could then store it as:
3|3
1|0|10|2|5|9|3|1|0
then, when you open it, it sees "3|3" so, you check for "|" and break it appart into 3 and 3. So, you know its a 3x3 map.
Then start loading the tiles and putting them into your map matrix in memory. That method could easily lead to people altering you maps, however. Simple to store and load will lead to simple to alter.
Anyhow, then, for you map editor, just make it so it can load a map or make a new one. Then, make a grid [actually show the grid so you can see the tile divisions.. could make it toggle-able too in that you can turn off the grid to sort of preview the map]. Anyhow, then make it so you have a list of available tiles to the side/bottom and when you click on a grid location, it places the currently selected tile. So, if you click tile (2,5) with art# 31, you do:
Map(2,5).art = 31
then saving it just does a
for x = 1 to MapWidth
for y = 1 to MapHeight
WriteSomeDataToAFileFunction(str(Map(x,y).art) & "|")
next y
next x
you woluld have to pick a file writing method that doesnt jump to the next line by default... you may need to copy all your Map(x,y).art & "|" -> some buffer then copy the whole buffer to the file.
.. oh, and an afterthought, dont forget to save the relevant map data to the first line or whatever.
ANYHOW, after much rambling... that is what I would do in a similar situation. I am sure professions and people who have a real clue what they are doing have much better methods. :)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum