[crossfire] Maps passwords/phrases text

Mark Wedel mwedel at sonic.net
Tue Mar 13 01:20:35 CDT 2007


  I think this may have been discussed informally on irc or other places, but 
for some reason I was thinking about this on the drive home from work tonight. 
I also didn't see this on the wiki immediately, which makes me think that any 
discussions haven't really been recorded.

  The basic premise of the problem is that passwords on the public maps are 
difficult to change, and in fact haven't been changed in a long time for that 
very reason.  One would think that the city of scorn might want to change their 
gate password once in a while.

  The reason for this is pretty straightforward - going through all the maps and 
changing the passwords is not an easy task.  Plus, if anyone else makes changes 
to those maps, you'll get conflicts on checkout.  One just can't replace all 
uses of the word 'chain', as there could very well be other uses of that word 
unrelated to the password ("watch out for the chain lightning", etc).

  The real solution here is to use keywords instead of the actual word, like 
$SCORN_PASSWORD.  So you'd have something like:

@match $SCORN_PASSWORD
you look ok, ...


  Now there are really 3 ways I thought this could be done.  In all methods, 
you'd have a central file, that has things like:
$SCORN_PASSWORD=chain
$WHATEVER=...

  And to make the transition easier, all those defines would match the current 
values in the map.  I'd have to think about it more - if it makes sense for 
other messages to be broader substitutions, like:

SCORN_PASSWORD_WALL=The password used to be chain, I think it is now bar
With the wall just using $SCORN_PASSWORD_WALL for its entire thing.

  This could also be used for more than just passwords - could be good portion 
of NPC conversations, eg:

$SKELETON1_RIDDLE=What is at the start of end and the end of time
$SKELETON1_ANSWER=e


Method 1:
Have a perl script (or the like) go through the maps, doing simple substitution. 
  Advantages is pretty simple.  Disadvantage - basically need two copies of the 
maps - one that this runs on and copies to final location (like a make install). 
  Thus, you would do your svn updates on that first one, then run the substitute 
and copy script.  You couldn't use the svn copy directly.  Also danger of users 
trying to use the data from SVN directly, and getting those odd values.  One 
plus is that this doesn't require any changes to the server.  One minus is that 
the server still doesn't know anything about these passwords, so thus can not 
manipulate them.

Method 2:
Have a file that the server reads at startup which lists the password.  When the 
server loads a map from disk, it runs the substitution on the msg portions of 
archetypes.  This is pretty good as there is minimal code changes (do 
substitution on msg structure after loading object from map).  This would 
increase map load times some.  Since the server knows about the passwords, these 
can be manipulated in game via dm commands (set_password SCORN_PASSWORD bar) or 
the like.  These wouldn't take effect immediately, but instead on next map 
reset/reload (which could be sped along by other DM commands, like reset map, 
etc).  If the password file is installed into the var area, this would be a 
modifiable file, like the ban file, so changes of passwords could be temporary 
(last until next server reset or someone else sets them) or permanent (well, 
until someone resets them, but last across reboots).

  Another advantage is that since the password file would be in lib, and 
installed as part of make install, it would be impossible to run a server 
without at least the basic password file.

  Could even be some interesting things beyond just dm commands - it'd somehow 
be interesting to tie changing certain passwords to other things (high ranking 
nobles (via the scorn nobility quest) being able to change the scorn password, 
etc).  That gets more complicated, and would probably be a followon project (or 
maybe tied in by scripts would be easier way - scorn noble goes to certain 
office, and python script checks his rank, etc).

Method 3:
A bit like method 2, in that the server does the substitution, but not at load 
time, but rather when the msg structure is referenced.  This probably has more 
an impact on performance during actualy play, but probably not too much (if the 
$ or other unique character is used to denote these, then at load time the 
loader could quickly examine the msg structure for those fields and mark if it 
needs to be updated).  The only real benefit of this method over #2 is that 
changes to the password take effect immediately (dm changes the passwords, map 
in memory have the new password right away).

  I personally like #2.  The potential lag in updates, at least for some things 
like the scorn password, makes sense - takes some time for that information to 
get to everyone.

  Just my ramblings for the night.






More information about the crossfire mailing list