
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
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.
Nice hack (Score:1)
# Personally I want to see GURPS version.
Re:Nice hack (Score:1)
Re:Nice hack (Score:2)
Fixed in my patches -- npc_class is now a hash with the keys being the class names and the values being the distribution.
I'm alive (Score:1)
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:)
Re:I'm alive (Score:1)
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:)
Re:I'm alive (Score:1)
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.
Re:I'm alive (Score:1)
simplify, expand, whatever. I have a few ideas...
Perl Cleanup (Score:2)
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:
next phase of hack complete (Score:2)
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]
Stale link warning.... (Score:2)
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.