ID:138563
 
Okay I worked though some BS in my code and now the only bottleneck is maploading from a savefile.

In a fit of ultimate coolness, the player can actually do things while the map loads -- read and send email, talk to others, etc.

Anyway, Tom, to see how long it's taking, you can run

dantom#Deadron/NewWorld

and watch the status messages. When it starts loading the zone, it spits out percentage numbers. Each percentage number comes after it has read through and initialized one line of the map, or, at this time, 55 turfs.

It appears to take from half a second to a second to do 55 turfs, which is, alas, too long if I can avoid it.

Given the admittedly inefficient way you've seen I'm using savefiles, is this something I will just have to live with or is there some chance of more improvement on the byond side?
On 6/4/00 10:00 pm Deadron wrote:

It appears to take from half a second to a second to do 55 turfs, which is, alas, too long if I can avoid it.

Given the admittedly inefficient way you've seen I'm using savefiles, is this something I will just have to live with or is there some chance of more improvement on the byond side?

That's pretty slow for only 55 turfs. If the savefile is the only bottleneck I imagine that things can be improved. I'll take a look.
In response to Tom H. (#1)
On 6/5/00 12:30 am Tom H. wrote:
On 6/4/00 10:00 pm Deadron wrote:

It appears to take from half a second to a second to do 55 turfs, which is, alas, too long if I can avoid it.

Given the admittedly inefficient way you've seen I'm using savefiles, is this something I will just have to live with or is there some chance of more improvement on the byond side?

That's pretty slow for only 55 turfs. If the savefile is the only bottleneck I imagine that things can be improved. I'll take a look.

Well I don't know much about optimizing code, so I imagine there are things I can do too (and I certainly tend to design for simple and flexible over fast). I've started doing some additional cleanup -- but I suspect savefile stuff is a big part of it...
In response to Deadron (#2)
On 6/5/00 12:32 am Deadron wrote:
On 6/5/00 12:30 am Tom H. wrote:
On 6/4/00 10:00 pm Deadron wrote:

It appears to take from half a second to a second to do 55 turfs, which is, alas, too long if I can avoid it.

Given the admittedly inefficient way you've seen I'm using savefiles, is this something I will just have to live with or is there some chance of more improvement on the byond side?

That's pretty slow for only 55 turfs. If the savefile is the only bottleneck I imagine that things can be improved. I'll take a look.

Well I don't know much about optimizing code, so I imagine there are things I can do too (and I certainly tend to design for simple and flexible over fast). I've started doing some additional cleanup -- but I suspect savefile stuff is a big part of it...


On the way to work I realized the obvious way to approach this -- I just need to try out a loop that does nothing but load map info from disk, without going through any of my initialization code. This will tell me how much is savefile and how much is me.

I probably don't want to know the answer.
In response to Deadron (#3)
On the way to work I realized the obvious way to approach this -- I just need to try out a loop that does nothing but load map info from disk, without going through any of my initialization code. This will tell me how much is savefile and how much is me.

I probably don't want to know the answer.

Well tests still seem to show the savefile stuff to be the limiting factor -- removing everything but reading one value from disk per turf was still taking about the same time.

However, this has inspired me to be MUCH smarter about my map loading. One advantage to my approach to storing maps, I realized, is that I can load them in any order I want. It doesn't have to be top to bottom.

So now I've implementing a map loading approach which immediately loads the turfs in view of the player, then begins loading the full map in the background, very slowly (5 turfs per half second). Each time the player moves, the turfs surrounding them are checked and loaded as necessary, until the full map is in place.

I know I'll be playing with this for a while to get it smooth -- but even if my current approach is chunky, it's pretty fun to have 3 different maps when the player runs through 3 zones real quick...
In response to Deadron (#4)
On 6/6/00 12:19 am Deadron wrote:
However, this has inspired me to be MUCH smarter about my map loading. One advantage to my approach to storing maps, I realized, is that I can load them in any order I want. It doesn't have to be top to bottom.

So now I've implementing a map loading approach which immediately loads the turfs in view of the player, then begins loading the full map in the background, very slowly (5 turfs per half second). Each time the player moves, the turfs surrounding them are checked and loaded as necessary, until the full map is in place.


Yay -- I just tested this on the server, and it works like a charm! I doubled my map size to 100x100, and it still appears to the player to load instantly. Now I'm only restricted by machine memory considerations.

I want to say that all day I was envisioning the complicated mechanisms by which I would calculate which turfs needed to be loaded in order to keep the turfs around the player always loaded. When I got home, I realized I could do this in three lines, using the range() command.

Byond rocks.