ID:177244
 
Would the best way to create a map editor, to have it as a program by its self or as one with game. Also should i save it as .sav or .dmp, becuase i can save .dmps and edit them in Dream Maker.

The other thing i am wondering about is how i would design a map editor, would you do something like this?


___________________
|-----------------|Obj | ----> Expanding Menu
|-----------------|Turf | ----> Expanding Menu
|-----In----------|Mob | ----> Expanding Menu
|-----Game--------|Quest| ----> Expanding Menu
|-----Screen------|Save | ----> Saves
|-----------------|Load | ----> Loads
-------------------------

Would this work properly?
Mrhat99au wrote:
Would the best way to create a map editor, to have it as a program by its self or as one with game. Also should i save it as .sav or .dmp, becuase i can save .dmps and edit them in Dream Maker.

Considering I don't think either of us knows the raw DM savefile format, you should do either a savefile-formatted text file, or a .dmp. Both are similar.

Keep in mind your map editor isn't going to catch some illegal expressions that can't be used in a .dmp, because you'd basically have to set up a pretty advanced parser for that. But I support any effort to create alternative map editors, or to create an editor that complements the existing one by adding some new functionality.
It would have been very useful to me, for example, to have an editor that could automatically lay out the icons for a split-up .bmp. I had to do this manually in a text editor; it was the fastest approach I could take.

The other thing i am wondering about is how i would design a map editor, would you do something like this?

___________________
|-----------------|Obj | ----> Expanding Menu
|-----------------|Turf | ----> Expanding Menu
|-----In----------|Mob | ----> Expanding Menu
|-----Game--------|Quest| ----> Expanding Menu
|-----Screen------|Save | ----> Saves
|-----------------|Load | ----> Loads
-------------------------

Would this work properly?

I'm not sure how a quest datum would fit on the map, but your layout looks nice (don't forget areas though!).

Lummox JR
Mrhat99au wrote:
Would the best way to create a map editor, to have it as a program by its self or as one with game. Also should i save it as .sav or .dmp, becuase i can save .dmps and edit them in Dream Maker.

Take a look at RacingGame and you'll notice that Theodis has all his files in .map files, which is how I'd do it. It's really not very hard, all you have to do is save basic things like world.maxx and world.maxy, then loop through each turf on the map and save that location's type to the savefile.

For example, I think something like this should work.

<code>mob/verb/MapSave(filename) fdel(filename) // replace any former files var/savefile/S = new(filename) S << world.maxx S << world.maxy for(var/turf/T in world) T = locate(T.x, T.y, T.z) S << T.type</code>

And you should be able to load the map by doing the exact opposite, taking those variables out of the file, rather than putting them into it. (Of course, I could be wrong.)



The other thing i am wondering about is how i would design a map editor, would you do something like this?


___________________
|-----------------|Obj | ----> Expanding Menu
|-----------------|Turf | ----> Expanding Menu
|-----In----------|Mob | ----> Expanding Menu
|-----Game--------|Quest| ----> Expanding Menu
|-----Screen------|Save | ----> Saves
|-----------------|Load | ----> Loads
-------------------------

Would this work properly?

The real difficulty with trying to build a map editor is not making it functional, but making it simple. You can have them click on each square that you want to place their selected turf type on, but what if they have a huge 50x50 chunk that they want to fill in? There are all sorts of options that need to be created to make it easy.

Anyway, taking the SimCity approach I'm sure would work fine.
In response to Foomer
Foomer wrote:
<code>mob/verb/MapSave(filename) > fdel(filename) // replace any former files > var/savefile/S = new(filename) > S << world.maxx > S << world.maxy > for(var/turf/T in world) > T = locate(T.x, T.y, T.z) > S << T.type</code>

What's that T = locate(...) line for? Wouldn't it be equivalent to T = T?

Also, from my limited experience with savefiles, I have a feeling you have to save the x, y, and z vars manually. Feel free to tell me I'm completely wrong, though. :P
In response to Crispy
You're probably right, but I haven't tried it, so I wouldn't know.
In response to Foomer
Okay, I checked it, and the following code works just fine:

<code>mob/verb/MapSave() var/savefile/F = new/savefile("SavedMap.sav") F << world.maxx F << world.maxy for(var/turf/T in world) F << T.type mob/verb/MapLoad() var/savefile/F = new/savefile("SavedMap.sav") F >> world.maxx F >> world.maxy for(var/turf/T in world) var/turftype F >> turftype T = new turftype(T)</code>