posted on Thursday, December 14, 2006 3:46 AM by Endie

Multiverse - Part 2

I've been playing around with Multiverse some more, specifically with the server plug-ins and configuration.

On further investigation, it turns out that I overstated the work required of a would-be game-developer in my last post.  While it is true that you have complete flexibility in the ruleset and background mechanics of your game, there is also an "easy-mode" option in the event that you're planning on using a diku-type setup.

Multiverse comes with a server plug-in called MARS (Multiverse Agnostic Rule System).  It comprises a bunch of Java packages (multiverse.mars.*) that implement a basic Diku model, with hit points, spawn generators, item and mob templates, down to the detailed level of providing, for instance, an inventory template of 5 bags with 16 slots each.

So here's an example of using Python, Multiverse and MARS to create a spawn-point where Rabid Rabbits, for instance, will appear.  I normally use kinda-hungarian notation, btw, but Multiverse coding practises seem different, and I'm sticking to them for now.

Beforehand, create your RabbitFactory class, which inherits from the ObjectFactory class.  This will spawn the little beggars.  Now, you use it to create the rabbitFactory instance, and then to create a SpawnGenerator instance which uses your rabbitFactory instance to churn out the evil rabid bunnies:

rabbitFactory = RabbitFactory("Rabbit")
rabbitSpawnGen = SpawnGenerator("rabbit generator")
rabbitSpawnGen.setObjectFactory(rabbitFactory)

Next, tell the spawn generator where it is going to pop the relevant members of the family leporidae into existence (you've already defined rabbitLoc's co-ordinates elewhere):

rabbitSpawnGen.setLoc(rabbitLoc)

Easy, innit?  Next, say how many you want to appear at a time (20.. they breed fast), how far from the spawn point they can appear, and a suitably fast respawn rate:

rabbitSpawnGen.setNumSpawns(20)
rabbitSpawnGen.setSpawnRadius(3000)
rabbitSpawnGen.setRespawnTime(10000)

And that's it, but for the all-important Robot Wars-style Activate:

rabbitSpawnGen.activate()

And that's it.  You're now over-straining your server resources by spawning rabbits at a fairly unholy rate.  If you wanted to play early-era Ultima Online-type ecology games, you could alter the RabbitFactory class fairly simply to, for instance, only spawn more rabbits if two or more rabbits are extant at the spawn-point.

Some tasks are trickier than others, of course, but even the more detailed templates, such as that for a mob, are still fairly straightforward to use.  There are just more properties to set: rabbit.setAttackable(true), for instance; or rabbit.setStrength(100), which would be an evil little bugger with pointy, pointy teeth:

Sweet.

And just imagine, you've just spawned 20 of them.  Hopefully in a newbie zone just outside the city gates.  Call them the Bunnies of Arugal.

Comments

# re: Multiverse - Part 2

Thursday, December 14, 2006 12:07 PM by Dragon
How much of the "Easy" mode can you pick and choose? I.e. if you wanted to generate mobs using the system you described above but wanted to have character progression work in a different way than normal DIKU style, could you do so?

# re: Multiverse - Part 2

Thursday, December 14, 2006 3:59 PM by Endie
I started answering this here, but it needs its own post, I think, just to have space for code snippets etc... Will do so in a minute.