Crossfire Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CF: Idea for implementing random maps



It may be possible to implement random maps with only minor changes to the
server. The function load_original_map in common/map.c could be modified to
interpret map pathnames ending with "|" as commands to be executed from which
the piped standard output would be read as the map. The map pathname and
coordinates from which the player has just departed and the coordinates at
which the player should enter the new map could be saved in environment
variables which the map generator program could use to generate an exit back to
that map. A single external program could be used to generate multiple levels
of a dungeon by generating exits with the same program but different command
line arguments specified in the map path. For example, a non-random map with
pathname "example/town" could contain an object similar to the following:

arch small_temple2
slaying rand/undead_temple -l1 -s32x32 |
hp 15
sp 15
x 20
y 20
end

where -l1 tells the program undead_temple that it is generating the first level
of the dungeon, and -s32x32 tells it that this level should have dimensions of
32x32. "example/town", "20x20", and "15x15" would be saved in environment
variables. The program undead_temple could then include the following objects
in its output; an exit back to the town:

arch stair_up
slaying example/town
hp 20
sp 20
x 15
y 15
end

and an exit to the next level:

arch stair_down
slaying rand/undead_temple -l2 -s32x32 |
hp 15
sp 15
x 20
y 5
end

Different themed dungeons could use different external programs.

-- 
Paul Mikell


Follow-Ups: