Previous Blog Next Blog
Prev/Next Blog
by date

Plan for Gary Haussmann

Plan for Gary Haussmann
Name:Gary Haussmann
Date Posted:Mar 07, 2005
Rating:Not Rated
Public:YES
Comments:YES
RSS Feed:GarageGames Blog feedor Subscribe with .
Profile Page:View profile page for Gary Haussmann

Blog post
On implementing ShapeBase decorators, or, how to poison things and set them on fire.
While waiting for the Illumina guys to test out my helicopter-vehicle changes, I decided to fix up some parts of my little prototype game, which is a sort of RTS/FPS with whatever RPG-like aspects I think are cool.

The major gameplay mechanics that I wanted to add are special attacks and player customization. In typical CRPGs there are typically a large variety of special abilites you can get, either through items, race/class combinations, or spells. You can also effects the abilites of others, through what are typically called "buffs/debuffs".

At first I thought about coming up with a big list of buffs and debuffs, and coding them all into the engine. Then I came to my senses :) By coding up the the Decorator Pattern, and making the gameplay effects available to torquescript, I can basically come up with all sorts of bizarre and cool player abilites and attack effects.

Basically the Decorator-which I called an "Aura" for some reason, perhaps my melodramatic side-is a GameBase object that binds itself to a ShapeBase object in the game, be it a player, vehicle, or any other ShapeBase. The Aura does a few things:

1. Draws a particle effect and/or a shape at the player's location.
2. Calls a script function every N milliseconds.
3. The ShapeBase object will query any auras attached to it, giving each aura an opportunity to modify attributes like size and run speed. The aura can also modify any damage the ShapeBase is about to take.
4. Finally, a special Gui control displays all the auras currently attached to the player, and lets the player 'activate' auras. This allows you to dynamically add player abilites that require activation (i.e., sprinting, jetpacks, shields).

Again, the actual attribute and damage modifications are all done in script, although the engine code has to interpret them. For instance, if a certain aura reduces your run speed, the engine code has to be changed to use the modified run speed instead of the default specified in the datablock. Besides that, you can do all sorts of crazy things. Let us take a look:



Here the human player has just BBQ'd a bunch of alien critters with the handy flamethrower resource. Whenever a critter is hit by the flamethrower projectile, there is a chance that a "BurningAura" gets attached to them, which draws the fire particles and applies additional fire damage. The white spider-web like bands around the human player is a ShieldAura, which basically reduces damage.



From the point-of-view of the human player, you can see a few interesting things. First, the critter on the far right is a LOT bigger than the rest, due to a "GrowthAura" that increases size, movement, and attack damage. Second, the icon bar along the bottom shows which auras are currently on the player. The blue trapezoid is my bad art representing the ShieldAura described previously. The brain icon represents a mindblast ability which, when activated, will temporarily slow enemies in the vicinity. You can also see the critter in the back left is poisoned, as indicated by the big cloud of green smoke.

That's it for now; with some tweaks I can pretty much go crazy and start adding in the long list of abilites/effects I have written down in my design doc. Thanks to my neighbor Eric Porter for the cool mindblast icon. Eric also made a poison icon as well. I might hit him up for some more graphics assets later :)

Recent Blog Posts
List:03/24/06 - More AI Pack Trigger Examples
02/10/06 - A real simple AI pack example
01/02/06 - An Approach to Making Random Dungeons
10/31/05 - Plan for Gary Haussmann
09/26/05 - Plan for Gary Haussmann
03/07/05 - Plan for Gary Haussmann
01/30/05 - Plan for Gary Haussmann
01/04/05 - Plan for Gary Haussmann

Submit ResourceSubmit your own resources!

Stefan Lundmark   (Mar 07, 2005 at 22:43 GMT)
Hehe cool stuff :)

Jeff Gran   (Mar 07, 2005 at 22:50 GMT)
Sounds cool. Would be a great resource for all those RPG makers out there...

Stephen Zepp   (Mar 09, 2005 at 00:48 GMT)
I have to agree, this would be an extremely worthy and beneficial community resource!

Bryan Edds   (Mar 09, 2005 at 02:31 GMT)
I always like the Decorator pattern - though I often prefer the containment variation.

Gary Haussmann   (Mar 09, 2005 at 05:41 GMT)
Stephen, I'm going to try and make this a resource since it did seem like a good tool for RPG style games. It seems that slapping a bunch of these on dozens of players in a game may result in too many network messages, since the auras get sent to the client as well as players, but hopefully it will scale up reasonably well.

Bryan, I thought about making the decorator wrap around the shapebase object, but with the irregularities of ghosting it just seemed like writing robust code would be a hassle. The key point is that the decorator and decoratee may not get ghosted at the same time, so on some clients it is possible that the decorator object exists but its decoratee hasn't been ghosted yet :( With the method used here, writing the pack/unpackupdate code was a lot easier.

You must be a member and be logged in to either append comments or rate this resource.