ID:1159893
 
Problem description:
Hey guys, I'm having some trouble with my maps and after some investigating I'm really not sure what the problem is.

My maps are now 600x450 (formerly 593x445), and I'm trying to add on z levels. With just 1 level, the game loads in less than a minute, not a big deal. Yet, if I increase it to 2 z levels, the load time increases to ridiculous amounts. In the beginning my goal was to have around 20 z levels, but setting it to -that- gets me load times so high that I can't ever seem to get the game going.

I've attempted disabling all the stuff I call in world/New(), and that doesn't seem to really help at all.

I've seen games run maps bigger than I'm attempting to make use of, and with considerably less loading time.

Anyone have any ideas as to why this is happening?

It could be a number of things.

Are turfs calling things? if so how big is the code that its running (load time per code).

do you have ai on the new z level? if so maybe inserting a simple check for players before continue is a good option (to cut down on overhead)


i think the easiest way to check most this stuff is in debug using dream daemon to host (been awhile since ive fiddled round with byond) and checking the run times in that (but i assume you have already done that since you stated long load times to begin with unless ofcourse you are referring to noticeable difference via computer alone)

also i could be wrong about the whole above post, in which case my bad.
What on earth do you need THAT much space for? Do you realize that, that's 5.4 MILLION turfs? If just an infinitesimal fraction of those are calling functions, you're easily going to overload your server and lock it down.

I feel like you have some overly grandiose design that compels you to try for something that massive. Hell, a single z level of 600x450 is huge. If you honestly, truly need that much room for some MMORPG, you should move to a different engine.

On another note, take a look at what those other games are using all of that area for. Most likely, absolutely nothing. They have long stretches of unpopulated and undeveloped areas to try a really bad attempt at making the game feel "big." When you're making a great game, less is most certainly more.
In response to Solomn Architect
I know how many turfs it is. The only reason the maps are so big, are for the first z level. In fact, most of the other z levels will have much less space available to them in comparison (via black, non traverse-able tiles banded around the north and east edges)

The map is detailed, I have considerable experience with mapping, and I know how to make good use of space.

No operations run, outside of certain grass tiles, which has a minuscule operation hardly worth noting. Besides that, all the grass is on z level 1, which runs just fine. z level 2 with all dirt tiles is what causes the issue. Furthermore, each z level beyond that makes it worse.
In response to Midgetbuster
Grass tiles run this snippet, for seamless tiles.

turf
proc
spawn_flowers()
if(prob(15))
var/num = rand(1,3)
var/path = text2path("/obj/Buildable/Misc/Plants/Flower[num]")
new path(src)

GrassNew
icon = 'MediumGrass.dmi'
icon_state = "base1"

New()
. = ..()
icon_state = "base[rand(1,3)]"
spawn_flowers()


It's really light stuff, and even then as I said before this all runs fine on it's own. It's the additional z levels, with no grass / procs running. I'm really kind of baffled by the sudden increase of lag.
The problem may lie with your system. If I'm not mistaken, BYOND caches all of the turfs into your RAM. Take into account the variables BYOND is already storing, including every copy of each for every single turf, you would have an overload, my friend.

When things get backed up in the processor, you'll start seeing your freezes and slow-downs.
Hazordhu uses a special system that loads things like randomized grass, autojoining tiles, and even updating the seasonal appearance of things, only around clients when they move. The world is something like 700x900x2, but start-up times are small (loading saved buildings is pretty much all there is) and season changes, which affect every turf and tree in the world, happen instantaneously.

If a tree falls in a forest, with no one around to see it, does it make a sound? No, but it uses precious CPU power.

Pseudocode:
when a client moves or needs refreshed
for every atom visible to the client // plus extra padding for when they're moving
if that atom has changed since being updated last
update the atom
@Solomn
That's the thing, though. The map is only 1.1mb at 2 z levels, add about 600kb for each additional level after that. With 2 z levels, the .dmb is roughly 300kb or so. When the game loads up, my RAM is fine. My CPU maxes out at 100% though and stays there. Even with different map files, increasing the size results in this.

Theres no extra turf/New() stuff in the source, nor is there really anything heavy under world/New(). I even disabled the stuff in the latter, but it doesn't make a difference here...

@Kaiochao
I can certainly see why that's better, although all these grass operations certainly don't seem to be affecting it. After disabling the grass stuff, the outcome remains the same.

What else could be the culprit?
Sounds like you have an endless loop somewhere that is trying to call something between the two layers. Such as maybe some kind of pathfinding call or growth call.

My thinking is that when you add the second z level something on that level can not find what it is looking for, and so it just continusly runs at insane speeds to bog your system.

I would double check your turfs to make sure that they are not trying to find the player, or things of that nature because it sounds like that is what is causing it.

What happens if you remove the first z level, and leave just the second z level. So save your map somewhere else, make a new one. Add 2 z levels, leave the first one blank, and try to run it. Does it do the same thing? If so try spawning the player on the second z level, while the first is blank. Does it continue to slow you down?