Become a fan of Slashdot on Facebook

 



Forgot your password?
typodupeerror
Role Playing (Games)

Journal Short Circuit's Journal: RPG: Perl City Generator 10

Here it is.

The code's a bit rough, but it works. For background information, this was my first Perl program. I wrote it on my Linux laptop sitting in the back of a car, with O'Reilly's Programming Perl 2nd edition in one hand, and the 3rd edition D&D Dungeon Master's guide in the other. (I typed using my nose.)

I spent upwards of ten hours over the weekend cleaning it up. I separated the data from the code, so I could keep copyrights appropriate. (I don't want what happened to PCGen to happen to me.) The code still needs a lot of work...When I first wrote it, I wasn't too sure about the difference between my and local ... Come to think of it, I'm still not sure.

It's also horribly insecure, right now. If you're on a multi-user system, make sure data.pl is not writable! citygen.pl evals its contents, meaning that it gets run as your current user. (Yes, citygen.pl should check the permissions. But it doesn't. My excuse is that it was 12:30AM, I was tired, I wanted to get the code in a releasable state, I wanted to go to bed, and I had to get up for work in less than five hours.)

But rest assured the code will improve.

I haven't added the LGPL notice yet, but I plan to. But if you want to poke at it, go ahead. Currently, the data is D&D specific, but you should be able to put in your own data by messing around with data.pl.

Also, check out some sample output.

Update: (20040802130820) Fixed a bug preventing locales from being chosen for non-dwarven races when all options are randomly chosen. As a result, you can see several more sample output files.

Update: (20040803134240) Thanks to YankeeInExile, there's a new version. See his page on the subject.

Have your own questions and subjects to talk about? Email me and I may post them.
Don't miss other RPG-related journal discussions. and resources.

This discussion has been archived. No new comments can be posted.

RPG: Perl City Generator

Comments Filter:
  • If it provides some brief information about city.It would be nicer.
    # Personally I want to see GURPS version.
    • Whups. Didn't finish that last sentence. Mess around with data.pl to insert your own stuff. You don't have to keep the same number of options for each list; the code is flexible enough to deal with that. (Except for one spot marked by the comments. Make sure those two lists have the same number of options as each other. I'll have to fix that.)
  • sorry I haven't been around to post in your journal in a while. I'm gonna download your nice little proggie and give it a once over- I'm hoping I might be able to give it a little spruce up for ya:)
    Something somewhat related is my Dicebot [morgajel.com].
    have it join an irc server and it'll roll dice combinations for you
    !roll 1d10+2d6+1d4+10
    things like that- great for handling damage:)
    • responding to myself...
      ok, just gave it the once over, and it's really nice. What license do you have it under? don't take this as an insult, but I see a lot of room for me to improve it for personal use, and if it's under a gpl or bsd license, I'd love to branch a copy and throw it up on my site.

      again, really nice setup:) //me attempts to avoid begging and pleading...
      • I'm going to drop in the LGPL license today. (So it can be run with proprietary data.)

        You know, if you're interested, we could start a SourceForge project. I've been pickling that thought for a couple days now. My only concern is data.pl...I don't think SourceForge could host it legally.
  • I do not know if you have been seeing my E-mails, s.c. but I spent yesterday evening de-horrifying the Perl, and doing a lot of cleanup in data.pl as a first step in making it all data driven.

    Just run this patchfile [cluon.com] thusly:

    lawrence /tmp > wget http://24.11.21.34/~shortc/mkcity/mkcity.tar

    .. . wget does its thing...

    lawrence /tmp > tar xf mkcity.tar
    lawrence /tmp > cd mkcity
    lawrence /tmp/mkcity > wget http://cluon.com/mkcity-patch.gz
    ... wget does its thing...

    lawrence /tmp/mkcity > zcat mk

  • New version of mkcity-patch.gz at http://cluon.com/mkcity/mkcity-patch.gz [cluon.com]

    There is also a sample city.dat file at http://cluon.com/mkcity/city.dat [cluon.com]. And, if anyone does not want to do the patch thing, I have a copy of my hacked version at http://cluon.com/mkcity/mkcity-sls.tar.gz [cluon.com]

  • My last couple of comments had some links to files that no longer exist -- Mike and I are working on this, and I seem to be laboring under the belief that I am now the "official" source for the stuff.

Luck, that's when preparation and opportunity meet. -- P.E. Trudeau

Working...