ID:1904559
 
I'm trying to currently create a way to save my game map. It needs to save all objects and any turfs that have changed on the map, as well as well as certain NPC mobs. I have some idea of how to save these things into a savefile, I've even read around some forum posts where they suggest things such as saving an area.

The thing is I'm not sure on how to then load this up again. When you save a player, you then load it something like

var/savefile/F = new("SaveFiles/[ckey].sav")
F << src

then to load just do

var/savefile/F = new("SaveFiles/[ckey].save")
F >> src

but how would I go about loading an area from a savefile? Would I somehow make a variable containing the map, then output the savefile to the map? </<>
There are some libraries that handle map saving and loading in order to make instances. I'd suggest looking into those.

The most common that I know of is Swapmaps.
The simplest way to save a map is so do something like:

F << block(locate(1,1,1),locate(world.maxx,world.maxy,world.maxz)

However, this has some major problems. Specifically, it gives you a lack of control over where things will be saved and where they will be loaded back to. You can also save entire locations on the map by simply getting a reference to the area and jamming it into a savefile.

You can also make your own map serialization algorithm.

Check out this thread for details on a simple, but incomplete map serialization algorithm that's decently fast:

http://www.byond.com/ forum/?post=1450705&page=2#comment8726752
This is what I am using for pondera:
mob/xxx/xxx/verb/savemap()
var/map_name = "Pondera"

var/dmm_suite/D = new()
var/turf/south_west_deep = locate(1,1,1)
var/turf/north_east_shallow = locate(700,700,1)//locate(world.maxx,world.maxy,12)

D.save_map(south_west_deep, north_east_shallow, map_name, flags = DMM_IGNORE_PLAYERS)
usr << {"World has been saved."}//{"The file [map_name].dmm has been saved."}

This uses the Library: dmm_suite by IainPeregrine
You're Welcome.
DMM suite is incredibly slow. It's easy to work with, but damn is it slow.
In response to Ter13
Ter13 wrote:
DMM suite is incredibly slow. It's easy to work with, but damn is it slow.

Yes, I can attest to that. It really is slow but it was the only working code I could find (I am sad like that). Unfortunately, programmers are hard to come by so I must make do! I would definitely prefer something much faster for Pondera as it is, after all, mostly a survival/building game and the world save is going to be painful until I get faster code. :(
Blatant plug: I'm open for commissions this month. I'm one of the most educated individuals on map saving in this community. But I don't work for peanuts.
In response to Ter13
Ter13 wrote:
Blatant plug: I'm open for commissions this month. I'm one of the most educated individuals on map saving in this community. But I don't work for peanuts.

Well feel free to page me but I practically live on peanuts! Although, if you can wait until a payday we can discuss an amount in the double digits that would be reasonable for what is provided.