Posts Tagged Design Documentation

Creature class and Leg Rendering

Oh hey look, the drawing tablet worskes too.

First things first: I got my computer back! AND IT WORSKES!

Also, I successfully got a post up! Sure it’s like half a week late or something, but I’ll take it. My fragile self-esteem needs all the help it can get.

So, scene setting: I’ve just finished the skinning system. I can render animated and deformed meshes anywhere I want in my environment. I’ve also modeled a few simple animated legs and a torso object.

Now, to be fair, I might be taking a few liberties with the chronology of things here. A lot of the following was worked out in parallel with the skinning system, but I’m presenting it as sequential because it sounds more organised. So don’t mind my temporally-unhinged antics here. I assure you that unless the cooling pump fails on the paradox diffuser the space-time continuum is in absolutely no danger of instantly ceasing to exist. And the chances of that happening are, like, 1 in 10. Or is that 10 to 1? Never mind, nobody cares anyway.

Moving on: there are two possible approaches to take when it comes to laying out a foundation for a class as central to the game as the “Creature” class.

The first is to lay out everything at the start. Take it all from the design document, set up every data structure I need, and then go about tying them together. So, I’d prepare an leg class with some genetically-defined variables for size, width and type, then set aside some ‘combination variables’, such as strength and speed. Then I could use occult magiks to force demonic slaves to write Mathematical Equations to derive the latter from the former, as so: strength = (bicepWidth + tricepWidth * 0.6) * sizeModifier, etc. Or I could do them myself, that works too.

OR… the other option is to wing it. We start by making the creature move at a constant rate, and then we go and set-up the leg rendering and animation code, and then we plumb the size of the legs into speed and then we actually make the size of the legs variable, and then some other things we made up on the spot and then we realise we can make the subjects into ravenous undead flesh-eaters to unleash on an unsuspecting populous and make an absolute killing selling shotguns, and then… you get the idea. Basically making it all up as we go along.

Now, given that both of these approaches are mutually exclusive, in a stroke of certifiable genius I went and enacted both of them at the same time.

… wait, did I say genius? I meant the other thing. Word. Starts with I.

I had a fairly good idea as to how I was going to structure the creature body parts: A torso object, with legs, arms, neck and tail objects attached to that, and head, tailtip, hands and feet, attached to those. I also knew a large quantity of genetic variables I wanted, so I went ahead and put them in so I could tie them all together later. But I also wanted to see it in action as soon as possible, so long before things like “speed” were set up I threw in placeholder values and started on the AI, so that the creature would do more than just stand around looking awesome.

And it worked. Okay, true, I ended up making changes to or deleting the majority of the genetic values, but knowing the basic structure of the class and it’s sub-classes was a great help when it came to prioritising work, and being able to see the effects of the changes I was making kept me enthused.

So, in the fine tradition of starting with the most time consuming thing possible, the very first thing I prioritised was leg and torso visualisation. The creatures aren’t actually held up by their legs in species: instead, I derive a torso-height based on their leg size, and the legs sort of dangle at just the right height to make it look like they’re standing on the ground. Okay, all well and goo: that’ll work fine for horisontally-aligned bipeds, but what about quadrupeds with differently-sized limbs? What about creatures that stand upright like humans, or creatures that drag themselves along with a set of huge legs up the front? Clearly I’d need to do more than just move the torso up.

This was solved by the addition of another, half-derived half-genetic variable called “torsoRotation”. torsoRotation determines the pitch at which the creature’s torso is orientated, from 0 at horisontal to 90 when upright (okay, the value is actually in radians, but who in their right mind says “Pi on 2” when they mean 90 degrees?).

torsoRotation is a genetic variable: creatures can pass it on to their offspring. But if the creature is a quadruped, or if they are overly unbalanced (for example, small legs at the very rear), then torsoRotation will be overwritten with a value derived from a whole bunch of rules depending on their leg sizes and positions. This allows creatures to “stand up” without making it arbitrary or nonsensical: a creature who’s back legs increase in size will automatically pitch forward unless they usually stand upright enough to compensate for it.

My handwriting is banned by at least 3 seperate clauses of the Geneva Convention

Fittingly for a game like Species, this all affects survival in various ways. Any creatures whose body touches the ground suffers a ‘dragging’ energy-loss penalty whenever they move. Upright creatures move more slowly, but use less energy to get around. And so on.

This system of rules, once it was finished, resulted in a large variety of potential body plans, even with nothing more than legs and a torso. And, thanks to the time already spent on the skinning system, I could take randomly generated test renders of them straight away:

Cheers,
Qu

Don’t worry everyone, I swapped his paradox machine for a coffee maker and replaced his timecube collection with fluffy dice. The worst he can do now is make a terribly tacky espresso.

Advertisements

, , , , , , , ,

Leave a comment

More Design! From the Past!

Design Documentation – 2009

Ah, nostalgia! Going through the design documentation from 2009 (mostly random idea’s I had jotted down and systems I had spent time developing in my head) I’m mildly surprised to find just how different they are in their particulars from the final game. I knew the game had evolved (does it make me a sad and immature individual that I even now find that amusing? “Yes. Yes it does.”), but I never quite realised by how much.

As an example, here’s a copy of a section in which I spontaneously decided to enumerate the “main stats” for my creatures. These are variables that directly influence how they behave, but are NOT set directly: instead, they are influenced up and down to varying degrees by other values and items in the creatures genetic makeup.

Items in Bold were changed; Items struck out were removed or replaced with something else entirely. There’s even one item (in Italics) that I’d completely forgotten about until reading this and am now considering actually implementing.

Overall

HP -- Hitpoints
Energy -- Current energy
StmchEnrg -- Stored food energy
Size -- Overall scale – affected by age.

Movement

Stamina -- Rate of energy loss per unit of distance
Speed -- Speed of motion

Offence

JawDmg -- Damage
TailDmg --
LimbDmg -- (1 for each limb)

JawSpeed -- Strike speed, before and after
TailSpeed --
LimbSpeed -- (1 for each limb)
JawRange -- Attack distance
TailRange --
LimbRange -- (1 for each limb)
preferrdAtck -- Selects which weapon is affected by below
FavChance -- Affects chance of weapon being chosen

Defence

ArmrFront -- Lowers how much HP damage is taken
ArmrTop --
ArmrUnder --

Counter -- Gives Minor damage to the attacker
MeatHarshness -- Makes creature harder to digest

Food

Diet -- Veg/Meat
StmchAcid -- Optimal Food Harshness
Effciency -- Causes more food to spawn on tree when tree is ‘attacked.’

Mating

Thrshhold -- Pickiness
FavColour --
FavAttribute -- (One of these global stats)
Décor --

Temperature

Cold -- Defence against low temperatures
Heat -- Defence against high temperatures

There are at least a dozen new attributes as well, and that’s just off the top of my head!

Even more drastic are entire systems that were discarded or replaced, sometimes after trying to implement them and discovering their flaws, other times because I realised they were evil Cthulhu-spawned puppies from the start. A perfect example of this is the behavioral system. It’s design underwent several iterations, each of increasing detail, complexity and imagination, but it wasn’t until I actually tried to implement it that I realised it was an absolutely bloated useless flippard of a system. Here’s my old notes from the same document as above:


Creature Perception

Each creature has a list of PerceptionObjects, corresponding to the objects in their sight range: split into unknown, creature and vegetation, and each one has a list of all the ‘visible features’ available for retrieval. Each creature also has a list of PerceptionCategories, which split other objects based on visible features: Health, Colour, Size, Headtype, Covering, etc. for creatures, Colour and Size for vegetation.

PerceptionCategories is a genetic list, but intelligent creatures can add other categories
upon encountering unknown objects.

Triggers

PerceptionCategories are used in triggers, which are creature behaviours. Triggers can be genetic or learned, and consist of a PerceptionCategory and an interaction: flee, attack, eat, play or mate.

Triggers are activated when a creature interacts with an object (rather than rolling randomly). They should also be able to be activated from a distance… how this works I have not yet ascertained.

Spend more than a quarter hour on an image? NEVER!

I was going to do what?

It was only when it came around to actually implementing a behavioral system that I realised “This is insane. WHAT THE HELL AM I THINKING?” And even then, I went and half-implemented it so as to try it out, just to prove to myself that it was unworkable.

For a start, instinctive behavioral reactions are hard enough to identify normally: adding an extra layer of complexity in the form of “PerceptionCategories” would have make the creatures thought processes so alien as to be indecipherable. In addition, the behaviors (Eat, Attack, Mate, Play, Ignore and Flee) are not transferable: allowing creatures to mate with trees might be hilarious, but it gets old when creatures arbitrarily decide to spend the rest of their very short lives doing so, driving them to starvation and extinction. (Oh my God. I think I just worked out why the dinosaurs went extinct) What I really needed was simplicity and predictability: “creature X does Y when they encounter Z.”

So instead I went for a more fluid behavior system combined with three predefined categories: Tree, Ally and Neutral. Tree’s are food sources: a creature will either eat or ignore trees depending on their preferred diet. Ally’s are genetically compatible (of the same species) creatures. Neutrals are all creatures from other species.

This allows for emergent behavior, such as creatures herding together but still knowning to flee from predators, while at the same time simplifying and making creature behavior easier to read. Which is probably for the best, but I will mourn greatly the loss of potential prey-prey interspecies symbiosis.

I wonder if that particular sentence has ever been said by anyone else in all of spacetime?
Qu

Little known fact: All dogs can ultimately trace their ancestry back to Cthulhu. Not cats though. They’re descended from Yog Sothoth.

, , , , ,

1 Comment