Welcome to the Builder Academy

Question Virtual Wilderness, Room Pools and coordinate confusion!

More
04 Sep 2013 09:31 #4267 by Ornir
Hey folks,

I have posted before that I am developing a procedurally generated wilderness for Luminari - We currently have 1024x1024 locations and a function that returns an elevation (which can be mapped to SECTOR_TYPE) if given an x,y coordinate. There is some other magic in there (heh) but that is basically the worldgen.

The players see the wilderness as rooms with a bigger, more detailed world-style map, you can share rooms with mobs, objects, etc. and basically interact as you would normally. To move to described areas you just take an exit in a special pre-built wilderness room. It looks no different to the player than any other room.

(BTW; this is all on the development port, if you want to see, let me know and I will show you. It's a bit unstable, details follow!)

I am using a special area for the wilderness, with 10000 rooms. Not all of these are built, of course, but they are reserved for expansion.
  • Vnum 1000000 is special, exits leading to this room force the use of the coordinate system
  • Vnums 1000001-1003999 are only for pre-built rooms
  • Vnums 1004000-1005999 are the DYNAMIC WILDERNESS ROOM POOL - THESE ROOMS ARE BUILT
  • The remaining vnums are for expansion

So my issue is with char_to_room(ch, room), unsurprisingly.

I have modified do_simple_move to allocate rooms, etc from the pool as needed. This, however, is not everything, although most standard cases (walking, riding, following, fleeing) work perfectly. Other movement types, magical movement, immortal movement (goto), etc. as well as coming back from idle, relogging in, etc. have strange (to the player) results, since the rooms from the dynamic pool are reused once they become empty.

I am sure you can imagine the weirdness...

You are at (233, 74), standing alone in the grasslands and you log out and 15 seconds later you log back in. Suddenly, you are at [34, 65] in the middle of a pack of aggressive wolves! (The wolf mobs, as they moved, allocated the vnum that you were last in!)

You are fleeing a PK situation, and lose link. Frantically, you try to reconnect, but in the meantime your character voids and hangs with puff while your internet comes back online. Finally logging in, you are transported to the SAME room as your pursuers, who had since given up and were mining some iron ore in the hills! Needless to say, it did not end well for you.

So - It is pretty obvious what is happening. You are being sent to the room you were last in, not to the coordinates you were last in. Fine, fine, just check the player coordinates in char_to_room and see if the room has the same coords, and make sure you update the coords before you do char_to_room(). That seems like an easy solution, but I am wondering if I am missing something here. Is there a better way?

And my question: What is a good way to manage coordinates in this system?

Thanks, you are some bright folks, I am looking forward to your responses.


Here is the worldmap, if anyone is interested:

[img


(Click for a BIG verison, 1 pixel = 1 room.)

Luminari - a Pathfinder/D&D inspired adventure!
www.luminarimud.com
luminarimud.com 4100

Please Log in or Create an account to join the conversation.

More
04 Sep 2013 20:58 #4275 by thomas
First off - cool that you're doing this. For a long time I considered doing it, more or less the exact way you're doing it here.

Secondly, you'll want to differentiate between users in the dynamic rooms and users in the non-dynamic, "written" rooms. Users in the dynamic rooms should be saved with coordinates instead of room number; for all the reasons you're listing.

If I lose link at (345, 432), I should pretty well be sure that I reconnect there as well.

Now, the question is whether you'll differentiate simply based on the ranges of vnums (that would work) or if you need a flag, or just only save coordinates when actually in the "grid". Either way, forget restoring users ased on the vnum of the virtual room. It will give you more trouble than it's worth.
The following user(s) said Thank You: Ornir

Please Log in or Create an account to join the conversation.

More
05 Sep 2013 05:11 - 05 Sep 2013 05:33 #4276 by Ornir
Thanks Thomas :) It is probably the most fun I have had in a while.

I was thinking about differentiating after I posted, if i check if the player is in a dynamic room, then I know to use the coords. Everything else can just use vnum.

I never wanted to use dynamic room vnum, btw, it was just the behavior that emerged when I put the system in. I know it is not a good solution.

Basically, any time i char_to_room where the room is dynamic and something is not standing in it right that second (summon, trans, etc.) i need to check the coords are correct.

Any other ideas/comments?

Luminari - a Pathfinder/D&D inspired adventure!
www.luminarimud.com
luminarimud.com 4100
Last edit: 05 Sep 2013 05:33 by Ornir. Reason: I accidentally a word

Please Log in or Create an account to join the conversation.

More
14 Sep 2013 14:56 #4312 by Kewlb
I have implemented a coordinate system in the MUD I am programming. The way I handled this (for simplicity sake) is to keep the whole concept of individual rooms and room numbers. I just allowed each room to have a X/Y size for how large it is.

For example a room that is 20x50 would have coords ranging from -20 to 20 for the X axis and -50 to 50 for the Y axis. The full coordinate is the rooms vnum/x/y so 1001,0,0 is room vnum 1001 xpos 0, ypos 0 (or dead center of the room). I can easily save the room vnum and the current X/Y and restore the player into the exact same location they quit the game in.

The only thing I have not figured out how to do is be exact when a player is moving from room to room. To make it simple if the player was moving to the north I put them in the very south edge of the next room. If they were moving northeast they are put in the southwest corner of the next room and so-on.

I took away all movement like "n/s/e/w/ne/nw/sw/se" and instead players face a direction (still using the n/s/e/w/ne/nw/se/sw) and then walk, jog, or run. An event system then moves the player through the room. I then use lists to keep track of who can see who based on distance, so you can start to place objects/mobs that someone might not see based on where they are in the room.

Please Log in or Create an account to join the conversation.

More
17 Sep 2013 16:19 #4332 by zusuk
Ripley's wilderness system is AWESOME :)

Website
www.luminariMUD.com

Main Game Port
luminariMUD.com:4100

Please Log in or Create an account to join the conversation.

Time to create page: 0.257 seconds