ID:270797
 
I have this weird problem where most of my savefiles will not save during a reboot, thought they will save when the world shuts down.

Oh, and another thing: Is there an efficient and fast way of Blend()ing a solid color onto a 500x500xZ map? The current one I have right now is showing very little promise of being fast and smooth.
You can override world/Reboot() to insure your saving happens properly, just be sure to call ..() at the end or it won't actually reboot.

Icon operations are generally slow and there's not really a good way of doing large-scale operations like you're asking with them quickly and efficently.

The only thing I can think of is to do all of your icon operations outside of normal gameplay (world starting is a good place), if you create a global icon object and Blend() it when the world starts up and change all of the icons you need to that icon you'd only be doing the operation once.
var
icon
my_icon


world
New()
..()
my_icon = icon('blah.dmi',"bleh")
my_icon.Blend(whatever)


Then just set the turfs you need blended's icon to my_icon, that way you're only Blend()ing once and not a bunch of times.
In response to Nadrew
Ah, okay.

About the icon Blend()ing, I have a day/night system set up where I make all of the "Outside" tiles darker or lighter. Can this be achieved by creating an icon file in world/New(), Blend()ing a color onto the turfs "spare" icon variable, then just switch icons when it is needed?
In response to Mega fart cannon
Yeah, as long as you're not doing it in a way that keeps calling Blend() you'll be fine, it's the actual blending that takes the resources.

Just a note, this will stall the startup of your game a bit, but once it's all started you won't have to worry about it. You could even save the generated icons in a savefile and load them in world/New() if the file already exists, this would cut down the loading time dramatically after the first time.
In response to Nadrew
Ah, okay, about the savefile. How could I set it up without making duplicates of the icon?
Mega fart cannon wrote:
I have this weird problem where most of my savefiles will not save during a reboot, thought they will save when the world shuts down.

Oh, and another thing: Is there an efficient and fast way of Blend()ing a solid color onto a 500x500xZ map? The current one I have right now is showing very little promise of being fast and smooth.

out of curiousity, can I see your world save file code? Mine seems to not work right, I can't get it to save at all before a shutdown or reboot...
In response to Jik
Jik wrote:
Mega fart cannon wrote:
I have this weird problem where most of my savefiles will not save during a reboot, thought they will save when the world shuts down.

Oh, and another thing: Is there an efficient and fast way of Blend()ing a solid color onto a 500x500xZ map? The current one I have right now is showing very little promise of being fast and smooth.

out of curiousity, can I see your world save file code? Mine seems to not work right, I can't get it to save at all before a shutdown or reboot...

world
New()
..()
var/savefile/F=new("Files/Other/World Core.sav")
if(F["Enforcer"]) F["Enforcer"]>>Enforcer
if(F["GM"]) F["GM"]>>GM
if(F["Admin"]) F["Admin"]>>Admin
if(F["Owner"]) F["Owner"]>>Owner
if(F["Muted"]) F["Muted"]>>Muted
if(F["Banned"]) F["Banned"]>>Banned
if(F["Restriction"]) F["Restriction"]>>Restriction
if(F["Guilds"]) F["Guilds"]>>World_Guilds
//etc etc
Del()
var/savefile/F=new("Files/Other/World Core.sav")
F["Enforcer"]<<Enforcer
F["GM"]<<GM
F["Admin"]<<Admin
F["Owner"]<<Owner
F["Muted"]<<Muted
F["Banned"]<<Banned
F["Restriction"]<<Restriction
F["Guilds"]<<World_Guilds
//etc etc
..()
In response to Mega fart cannon
Would making duplicates of the icons actually hurt anything? I was planning on just doing that for my day-night system, I don't see how slightly larger icon files is really going to be a problem but if you know of a reason why, I'd like to know. I'd hope my day-night system doesn't create lag or use up too much extra space.
In response to Hork
Hork wrote:
Would making duplicates of the icons actually hurt anything?

Not if you have a gazillion terabytes of disk storage, no. =P

Saving icons into savefiles is pretty inefficient. Best to avoid it when you can. Note that icons that don't get changed at runtime won't get saved to savefiles.

For day/night systems, I usually resort to using a full-screen HUD of a 50% black icon. The icon has alternating transparent and black pixels; the black is so that it darkens things, and the transparent is so that you can still see through it. It doesn't look quite as nice as blending the icons, but it's much much faster. Using HUDs for this is slightly inefficient, but it's a lot more efficient than using icon operations (like Blend()). Icon operations are sloooooow.