ID:155969
 
Okay, so I need to world save/load 65k and some odd number of world objects, roughly. Can any of you think of a decent way of doing this?

Looping through every object in world does NOT work, it is FAR too slow.
Perhaps you could have each object save upon its creation?

obj

New()
..()
// load()
Del()
..()
// save()

objects

other_objects


Just a thought to ponder.
In response to Zane
Zane wrote:
Perhaps you could have each object save upon its creation?

> obj
>
> New()
> ..()
> // load()
> Del()
> ..()
> // save()
>
> objects
>
> other_objects
>

Just a thought to ponder.

Er, maybe,I feel a bit.. dumb, asking this, but, is there a proc for checking all savefiles in a directory? If so, I could do this very efficiently, but all the same, I dunno if there is lol, otherwise I gotta pick a number, and load savefiles up to that number, checking fexists.
To save or load an object you have to access it. One way or another you would have to go through those 65k objects. But there are some ways you could streamline the process:

- Load content on demand. Don't load something when it isn't needed.
- Save content when it hasn't been accessed for a time. Divide your game into 'regions'. Save a region when no player has accessed it in N minutes. In server shutdown and the such, only save areas which haven't been saved in this way yet.
- As for the last two suggestions, be sure to find the right level of streamlining. Partitioning the world into segments which are too small, or loading content in very small amounts at a time would actually do more harm than good.
- Save (and consequently, load) less content. Only save what you must save. Try figuring out which properties of the object can be recovered from different data about it. For example, if an item gets a red tint due to enchantments, don't save the new red icon version of it - save the enchantment and recreate the red icon at runtime.
- Experiment with different file formats. This can save you space and time. Take a look at hub://Dantom.DB and read some about MySQL (there's a whole slew of optimizations MySQL can offer, if used correctly), as well as BYOND's native .dmp (or is it .dmm now?) map format.
- If all else fails, consider dividing your world into different servers on different computers for each large game area.
In response to Asellia
Put all of the savefiles in one folder then use flist("directory/") to check every file inside of it.