[MUD-Dev] Autogenerating maps from muds using cardinal directions for exits?
Sunny Gulati
sunnywiz at radiks.net
Thu May 13 09:00:53 CEST 1999
Ben Greear wrote:
>
> J C Lawrence wrote:
> >
>
> > In a long prior life I hacked a tool to build maps from telnet game
> > logs. The algorithm was simple:
> >
> > 1) Pull out all command lines which contain a directional command
> > (U/D/N/NE/E/SE/S/SW/W/NW) and the next line of output (the room
> > desciption of the room moved to).
> >
> > 2) Trim out all error/"You can't do that" entries.
>
> I will be working from my world database, and so can make complex, and
> arbitrarily correct assumptions about the exits et al. I can also
> do things like stop at zone boundaries and so on...
>
> > 4) Build a graph of nodes representing thr trimmed log (just walk
> > down the log, adding nodes as new locations are found).
>
> Care to elaborate on that part?
>
[rest snipped]
When I did stuff like this a few years ago, I ran into problems of
changes of resolution: for example, while within a city, each "room" was
relatively close to the other, and once you left the city.. the scope
expanded. And entering a wizard's realm, sometimes going North, East,
South, West, didn't bring you back to where you started.
Even more common:
[street]--[street]
| |
[shop] [street2]
and in the shop:
[street]
|
[shop]-[behindthecounter]
[behindthecounter] would bump into [street2]
the problem is that the maps would "bump" into each other in very
non-visually-pleasing ways.
Method 1 to solve it was scoping things (which I picked out of the
filename for the room (this was LPC)).
Method 2 was interesting: Whenever you're going to "bump" into
something, you do the equivalent of inserting a bunch of blank columns
or rows into your graph, and then try again. It kinda worked.
Method 3 was: If we're going to bump into something, don't map it on
this page, draw it on a seperate page. I got a lot of pages; our mud
wasn't very well planned.
Method 4 (which I did not try) was: choose some level at which to group
things together so they map well. If they don't map well, go back and
subdivide the groups. [human intervention would be cool there]
Algorithm was kinda like this:
do {
Z dimension = 0
put a starting point on the map somewhere;
// possibly set up "current scope" info as well
do {
for every point that's on the map
if there's an exit we haven't followed yet
find out if that exit is followable (ie, maybe you don't want
different wizard's stuff to pop up on the same map)
find out if that exit's target room has already been mapped
(if so, is it in the right spot? if not, log it as a
problem)
if not, put it on the map:
if the place we were going to place it is occupied
"bump" or log or [your choice]
endif
endif
endif
next
} until we_could_do_nothing_this_last_pass
increase Z dimension
} until there are no more rooms left to map
I ended up writing an object that would run around in the mud making
notes of rooms and the exits within them; this object wrote to a log
file like so:
/room/file/name
north: /other/room/file/name
east: /other/room/file/name/also
down: /yet/another/room/file/name
then, a different program parsed through the log file, calculated
coordinates (I used X,Y and "Z", Z being a page number), and stuck them
right back into the logfile:
/room/file/name 45 60 0
north: /other/room/file/name 45 61 0
east: /other/room/file/name/also 46 60 0
down: /yet/another/room/file/name 39 25 2
I think I wrote that part in perl, or clipper [I was a clipper
programmer back then for a living]
I then had a last program go through and draw these suckers on a screen
(in clipper, using some graphics library or the other). That's about
when I shelved the project, other things became more interesting.
Cheers,
Sunny
_______________________________________________
MUD-Dev maillist - MUD-Dev at kanga.nu
http://www.kanga.nu/lists/listinfo/mud-dev
More information about the mud-dev-archive
mailing list