var/SaveInt = 300 // supposed to be 18000 for 30 minutes
var/mapsave/MapSave
proc
save_timer()
var/count = SaveInt
for()
if(count <= 0)
spawn(0) MapSave.Save()
count = SaveInt
count -= 10
sleep(10)
world
New()
..()
MapSave = new /mapsave
//spawn() save_timer()
mapsave
proc
Save()
world << "Saving the world in 10 seconds."
sleep(100)
Save_T()
Save_O()
// other types of saving
Save_T()
var/count = 0
var/Filename = "Data/Maps/Mapsave.sav"
if(fexists(Filename)) fdel(Filename)
var/savefile/S = new(Filename)
var/oldcd = S.cd
for(var/z=1,z<=world.maxz,z++)
sleep(1)
S.cd = "[z]"
for(var/x=1,x<=world.maxx,x++)
S.cd = "[x]"
for(var/y=1,y<=world.maxy,y++)
S.cd = "[y]"
var/turf/T = locate(x,y,z)
S["type"] << T.type
//S["icon"] << T.icon
//S["icon_state"] << T.icon_state
//S["Flyable"] << T.Flyable
count++
S.cd = ".."
S.cd = ".."
S.cd = oldcd
world << "Turfs Saved ([count])"
Save_O()
var/count = 0
var/Filename = "Data/Maps/Objects.sav"
if(fexists(Filename)) fdel(Filename)
var/savefile/S = new(Filename)
var/oldcd = S.cd
for(var/z=1, z<=world.maxz, z++)
sleep(1)
S.cd = "[z]"
for(var/x=1, x<=world.maxx, x++)
S.cd = "[x]"
for(var/y=1, y<=world.maxy, y++)
S.cd = "[y]"
var/turf/T = locate(x,y,z)
var/list/os = list()
os += T.contents
for(var/a in os)
if(istype(a, /mob))
os -= a
S["contents"] << os
count += os.len
S.cd = ".."
S.cd = ".."
S.cd = oldcd
world << "Objects Saved ([count])"
Problem description:
Hey everyone =)
Been working on a mapsaving system, and I finally figured out how to save them. Granted, this saves every tile regardless of whether its new or not (I intend to fix that along the line). It bothers me because even though my PC is only a single core 3.06 Ghz, with 1GB of RAM, This takes between 9-18 seconds to save all the tiles, which is 80,000. I commented out a few of the variables I was saving with it to test if it was slowing it down, and yes it was. With those variables included it ranges from about 40-60 seconds.
The objects amount to about 7k, and that takes about 20 seconds to save.
So.. does anyone have any ideas on how to speed up this process? My goal is to have seamless saving, I'm hoping there are some things I'm missing here which are slowing the saving down.