Creating an MMORPG in Perl

Question: do you want to hear more about my attempts to create an MMORPG in Perl, even if posts are not Perl-related? Also, are you interested in helping me develop its ideas further?

As many of you know, I'm trying to create an MMORPG running on Perl. It's codenamed veure. Though I've written about it a few times here, I've not written much because many of the entries are about game design and not strictly about Perl. As a result, I've tried to avoid spamming this blog. That being said, people constantly say "stop talking about how great Perl is and build great things with it!" So I'm trying to build something great with Perl, but as most experienced programmers know, it's not so much the programming language as the business rules which are important.

And damn, business rules in an MMORPG are hard.

To be fair, most text-based MMORPG games don't have my constraints. I'm not trying to create a strategy game and I'm very much trying to create something that allows immersion. I'm trying to create a world that you want to live in. For many others, such as Torn, Hobo wars, or Kingdom of Loathing, the programmers have the luxury of creating just about anything they want so long as it creates interesting game play.

Take, for example, torn.com (dislaimer: if you sign up for that with that link, I'll gain a small in-game advantage if you progress far enough). If you want to understand how text MMORPGs work, click that link, create your free account and have fun (I'm Quintilian, by the way). In Torn, if you're level 15 or higher, you can make a lot of money by flying to other countries, buying flowers, and returning to Torn City and selling those flowers.

Did you get that? You must be level 15 or higher to travel. You sell flowers. Flowers are valuable to people who've gotten a Bachelor's degree in history. Oh, and it helps if you've joined the right faction and you've bought or rented a private island and remembered to hire a pilot.

Does that seem arbitrary to you? Well, it is, but everything balances together to create great game play. It's actually a fun game and the owner is making a fortune on it. Even if it's not for you, many people love the game and are quite willing to pay for it. In fact, I know of a couple of Perl devs whose name you might know who play the game, but I'll not "out" them because I didn't ask for permission. Who knows? Maybe we'll create our own faction one day?

Getting back to Veure, there's not going to be any "flower running" (as it's called in Torn) unless there's a reason for it. Maybe it's a rare species of flower whose pollen treats a particularly contagious disease that is running rampant on a space station or something. Otherwise, no; actions have to have a reason.

One of the actions you can take (mostly limited to new players) is scavenging the ruins of old, derelict space stations. You'll probably just find wires, capacitors, or other miscellaneous parts you can sell for a pittance, but sometimes you might find weapons, armor, or other goods. The code for finding an item currently looks like this (there's a lot more to it, but this is the core):

my $items = $self->resultset('Item')->search(
  { frequency => { '>=' => _rand() }},
  { order_by  => \"RANDOM()", rows => 1}
);

The _rand() function was initially a way that I could trivially override randomness in Perl for purposes of testing. However, the PostgreSQL RANDOM() function isn't so easy to override, so I wrote code to make about 30,000 random searches and dump out the results. Currently, out of 30,000 random searches of the ruins of a station, you would find almost 9,000 items, but only earn about 26 credits. Suffice it to say that this makes this endeavor almost completely useless.

Consider: scavenging in the ruins of a space station is very tiring work. You can only scavenge so many times before your stamina wears out and then you have to rest to regain your stamina. Taking a shuttle to another space station costs around 10 credits (that's another thing that will change), so you could easily spend weeks earning enough credits to travel to a different station.

That's something which is very, very hard to test for due to randomness. Instead, for many aspects of Veure, I've had to build simulations to do multiple trials to see how things work. I have a combat simulator which ran about 22,000 combat simulations to let me know that my combat system didn't work. The tests passed, the code was (almost) bug-free, but the various stats (strength, speed, stamina, focus) didn't come anywhere close to balancing out. It's hard to write fast, deterministic tests for random events.

I could have said "screw it" and gone with my current combat system, but do you really want a game where a clever player who started last week can kill the player you've been playing for a year? Of course not. Ah, but that raises another issue: I could kill Royce Gracie with a hand gun. I studied martial arts for years, but that was many years ago and I'm terribly out of shape. But there's no way in the real world that an unarmed Royce Gracie is going to beat me if I have a gun (and know how to fire it and stay out of his reach). In a game, however, he has enough experience that characters matching his experience can/should be able to win. Or should they? That's not a trivial decision to make because that impacts everything else I do. If a level 1 player can easily defeat a level 50 player, that makes for a crappy game.

So that's one of the many differences between Veure and other text MMORPGs (a profitable, but ignored, space): I don't just have to balance game play, I have to make it seem plausible. However, I also have to make it seem fun. Fortunately, there's a wealth of information on this topic and I've been diligently reading it, but there's still a lot more to do. I can't have a bunch of people running around the galaxy, buying and selling goods and getting into adventures unless I figure out how to balance all of these factors.

All of which leads up to the obvious question about whether or not this constitutes a "cool use for Perl." Is this one of the awesome things we keep telling Perl devs to build? Who knows? All I know is that my company has hired a talented developer to help me out and we're going to figure out a way to release this.

I've actually pondered a Kickstarter or Crowdtilt campaign to help speed development, but who the hell is going to pay for a text-based MMORPG? Nobody doubts my coding ability, but creating a compelling game? That's a different story entirely.

For now, all I can say is that it will be out there some day. We still have auction systems, quests, and many other features to develop and just laying down the infrastructure is time-consuming. I'm not just trying to create game. I'm trying to create a universe people want to experience.

12 Comments

Yes, please keep blogging about this.

A few comments...

a) Yes, keep blogging about this. This is exactly the kind of cool thing I keep telling people they should build. And while I can't speak for others that say it, it only seems reasonable that they would agree.

b) If you like, I can doubt your coding ability. =)

c) You may not agree, but I think you should define your minimum viable product for this, and then build to that. Its all too easy to let the sprawl of a large system like this get away from you. Getting to MVP will help you make decisions on crowd funding, continuing development, stopping development, expanding the scope, open sourcing it, monetizing it, and more.

"Nobody doubts my coding ability, but creating a compelling game? That's a different story entirely"

I played Unknown::Values a bit last year, but didn't find it to be a very immersive experience.

Have you looked at PerlMUD?

Put me in the boat with those who want to read more about the design details as you develop the game.

Heck, put me in the boat of those who would test the game. It sounds pretty great. :)

Question: do you want to hear more about my attempts to create an MMORPG in Perl, even if posts are not Perl-related?

Doesn't quite fit the "RPG" part, but it fits the "MMO" part: http://www.lacunaexpanse.com/ the backend is mostly Perl.

Ive also been creating a MMO fleet space game in perl/Dancer this being the second attempt, as the first was implemented useing CGI module. Ive gotten quite far but no where near done as im the only ne working on it.

Just ran across this. Balance is a thing that's difficult to achieve. Especially when you get clever players that figure out ways to bypass certain aspects.

BTW, Pollution can be set to be automatically taken away in TLE, so at least that bit of micromanagement is dealt with.

About Ovid

user-pic Freelance Perl/Testing/Agile consultant and trainer. See http://www.allaroundtheworld.fr/ for our services. If you have a problem with Perl, we will solve it for you. And don't forget to buy my book! http://www.amazon.com/Beginning-Perl-Curtis-Poe/dp/1118013840/