ID:152567
 
I'm working on an RPG with very large maps (400x400), and these would be stitched to another large map. I've been trying to think of the best way to do this, and I haven't come up with a good way to do this. I've had two ideas to do this. The first idea is to create a fence around it, and have the player go into buildings to enter the next map. I dispise this method, entirely.

The second idea is to create doors that automatically take the player to the specified area, by doing something along these lines:
obj/YStich
var/z_loc //I'd change this in the instance editor to go to the correct location
Entered(mob/M)
if(src.y == 1) M.loc = locate(src.x,world.maxy,src.z_loc)
if(src.y == world.maxy) M.loc = locate(src.x,1,src.z_loc)
obj/XStich
var/z_loc
Entered(mob/M)
if(src.x == 1) M.loc = locate(world.maxx,src.y,src.z_loc)
if(src.x == world.maxy) M.loc = locate(1,src.y,src.z_loc)

What I don't like about this method is that when the player is transported, they realized they've arrived in another map, due to the camera stopping at one edge then changing to another. I'd like the player to remain unknown to the fact that they've gone to another map.

Has anyone faced this problem before? Do anyone have any suggestions on what to do?
Hedgerow Hall stitched maps together by having a row of trees around each map, with gaps in the trees leading to more maps. The effect can be created quite easily using SwapMaps.
In response to PirateHead
That's almost the same idea as the fence, which I don't like. I'd like for it to be a free-roaming environment where the player chooses where to go rather than the developer leading them along.

I am planning on using SwapMaps, the door example was just to get the basic idea across.
In response to Popisfizzy
Diablo uses dynamic loading of large map sections, loading maps into memory once a player is sufficiently near to them. Is that something you could manage?
In response to PirateHead
Do you mean to load the map as the player nears it? Unless I'm not understanding what you mean, it seems like it would need a modification of SwapMaps, and I haven't used SwapMaps before, so I don't think I could do it.
In response to Popisfizzy
SwapMaps just saves and loads maps. It's up to you to tell it when you want to do that, be it when the player walks through the door or when the player gets sufficiently near the edge of a map. No rewrite needed that I can think of!
In response to PirateHead
Well, then I haven't the slightest idea of how to program something like what you said in.
In response to Popisfizzy
It's quite easy... Create an illusion.

Player reaches the edge of the map. Before he can possible notice anything (be it the darkness or him moving without the camera moving (EDGE_PERSPECTIVE)), he'll be teleported onto a different map, or different Z level.
If the player saw a house before he teleported away, he'd also see the house in the location he was warped to. (Reason being, giant grassy fields with some trees thrown in are quite obvious)
In response to Mysame
I have thought of using this before, but when you get to the corner of a map, it begins to get tricky. It doesn't seem like it, but this also greatly reduces the size of the map.
In response to Popisfizzy
Indeed it does, but if you want to do it easy, that's how you would do it.
In response to Popisfizzy
Now that's something we can fix. =D

Let's sat that your maps are 50 by 50 (best to keep map sizes small for dynamically loading, lest we have big lag spikes when loading new maps). And, let's say the mob's view is 5.

Whenever the player gets within, oh, 8 squares of the edge of the map, we immediately start loading the map bordering that one, starting with the edge facing the player and ending with the far edge. That way, we have at least 3 ticks to get the map sufficiently loaded for basic viewing. However, we should probably give ourselves 6 or more ticks in the case that a player is running towards the corner of a map, because then we have 3 maps to load. Chances are, you could probably get away with loading a small portion of all 3 maps and then fully loading the one that the player decides to enter.

So, to make that happen, you'll need a procedure to check whether the player is within a short distance of the edge of the map (easy to write), and if so, load the correct maps up in the correct way (harder). To do the second one, you'll need a grid of maps similar to BYOND's own. An dual-indexed list of maps would probably do. So, l[1][1] is the lower left, and we'll say l[9][15] is the upper right. As the player reaches the map to the north, just take the current map's coords and add 1 to the y, and so on for the other directions. If he's nearing the north-east corner, you'll need to load the north map, the east map, and the north-east map. Of course, like I said above, you might get away with loading the south-west corner of the north-east map, the south-east corner of the north map, and the north-west corner of the east map.

Does that all make some sense?
In response to PirateHead
It makes some sense, but I still have no idea on how to program it.
what if you made a natural border (mountains, thick forest, ect.) to block the player from reaching any edges, but then add buildings and caves or something to get them across
Just make an area around the edges of a map to teleport you to another location on the map. If you do it correctly, you will never have to see the void.
In response to Popisfizzy
You could actually accomplish this very well with a nice manipulation of client.screen and image().