The past week has been lighter compared to the previous two, involving a lot more packing and moving, research, and documentation.
What have I been up to?
More behaviors
Adding to the 4 deer (deer, insensitiveDeer, aggressiveDeer, and hostileDeer) from last time, two new behaviors have been added: scared and friendly. Again, these are just placeholders for actual animals that would display such behavior, like a chicken (timid) and a dog (friendly). Here are two new videos that give a quick preview.
Also, the flee behavior is now improved so that the animal always runs in a direction away from the player, instead of randomly moving about like last time.
In addition, last year’s GCI saw a lot of students write formal descriptions about AI for animals and their behavior. These can be found here, and are possibly a good reference for the future.
Packing and Moving- AdvancedBehaviors
It was felt that the behavior work I had been up to should not be restricted to the WildAnimals module. It had great potential for other NPCs like monsters, zombies, aliens… you name it. One particular requirement was GooeysQuests’ skeleton, which tries its best to kill you in the dungeons. Currently, the skeleton just has a hostile behavior, which means it does nothing at all until a player comes close. After that, it follows the player in an attempt to kill. When the player dies or escapes, the skeleton returns to doing nothing (standing still) wherever it has reached. The hostileInProximity behavior that I implemented for the hostileDeer is probably a better alternative, wherein the deer switches from hostile to stray behavior. Further, the behavior-switching system could be used to add a guard behavior that would allow the skeleton to return to a specific location that it guards (a treasure, a secret door, who knows?).
All this meant one thing: the core behavior systems should not stay restricted to the WildAnimals module, as they would be useful in other modules too. With this need, the AdvancedBehaviors module was born. It would be a library module with logic and systems required by other modules as dependencies, but no content of its own. All the behavior systems and behavior components were packaged and moved to this new module.
Optional Dependencies and Library/API modules
AdvancedBehaviors would be my second module in the game, the first being WorldlyTooltipAPI, which also has no content of its own and serves as an API module for WorldlyTooltip. This was decided to be a better alternative to optional dependencies.
Modules like WildAnimals that use events from the WorldlyTooltip module should not have a hard dependency on it, as it doesn’t need to be activated all the time. A user should be able to enjoy the WildAnimals module without activating the WorldlyTooltip module. One possible way to solve this is using optional dependencies.
Let's take the WildAnimals and WorldlyTooltip modules as an example. If the WildAnimals module is given an optional dependency on the WorldlyTooltip module, its core features would be accessible even when the WorldlyTooltip module is inactive. Activating WorldlyTooltip would simply enable the features that rely on it.
The other way to do this is by using what are called API modules.
For example, the WildAnimals module uses events from the WorldlyTooltip module for the tooltip feature. To enable this, the events were moved to the API module called WorldlyTooltipAPI. Both WildAnimals and WorldlyTooltip now have a dependency on the WorldlyTooltipAPI module. The WildAnimals module can now be activated without activating WorldlyTooltip functionality (even though the WorldlyTooltipAPI dependency gets activated).
Taming animals
With behaviors being defined for animals, it would be fun to turn a hostile or aggressive animal into a friendly one. Having a horse you can ride, a donkey that carries load, a dog that guards an entrance, or a cow that gives milk all sound like fun ideas to have in game. Here are some thoughts on how taming can work.
Animals can be broadly and vaguely grouped into friendly and unfriendly, with different animals falling at different levels in this classification. Generally, the friendlier the animal, the easier it would be to tame it.
How would taming work?
Possibly there could be a taming progress bar that gives the player an idea of how long they should continue their taming efforts. There might be more than one way to tame an animal, some more effective than others. The more effective methods would increase the progress bar faster, allowing for speedy taming.
Taming Methods
- Petting- Some very friendly animals like dogs might just be tamed after a while of petting.
- Feeding- Every animal would have a preferred food item (or rather a list of food items it eats with an order of preference). Feeding an animal with its favorite food item would increase the taming progress quicker than with other foods.
- Sedating or Tranquilising- Animals can be fed poisonous berries or some other substances to intoxicate them. These would leave them vulnerable and make them easier to tame. Such an approach would be useful for more unfriendly or aggressive animals.
- Tranquiliser darts- For animals that are hostile and attack when in proximity to the player, tranquiliser darts could be used to intoxicate and subdue the animal, leaving it in a vulnerable state where it can be fed and tamed easily.
- Trap- Animals that are timid or hostile either run away from the player or chase the player. A good idea is to trap the animals and then approach them when they are not in a position to run away or attack. An animal trapped in such a manner would now have the feed option available (which wouldn’t have been available earlier).
- Knocking out- Animals can be knocked out by fighting them with different equipment. When an animal reaches low health, the player can choose to knock it out. If the player continues attacking and makes its health reach 0, the animal simply dies as it does now. Knocking out would have a similar effect to tranquilising: it leaves the animal in a vulnerable state where it can be fed and tamed easily.
These options of Feed, Pet, Knock Out, Poison (selectively enabled) can be displayed in a radial menu that appears on E click on an animal. The radial menu can have a circular progress bar outside that also shows taming progress.
Since methods like knocking out or hurting an animal before attempting to tame it seem odd, it can be made possible for the animal to remember only the player who hurt it. This would allow any other player (or even the same player in disguise) to befriend or tame the animal. Such an approach would be necessary only for hostile and aggressive animals and might also bring multiplayer taming into the picture.
Animal Utilities
- Mount for travel- Some animals can be chosen as a mount to ride on and for fast travel. Animals would have different speeds, jump heights, stamina etc. Some animals would be suitable for short distance while others for long commutes. Some animals would be stronger than others making them a safer choice of travel. Additionally, some animals may be faster in the day and some faster at night.
- Carry load and inventory- Most animals would have an inventory of their own that can be used for carrying goods around.
- Mining- Animals can dig through (with various speeds and capacities) and collect ores and minerals present inside the crust.
- Food supply- Animals can give eggs or milk that can be used as food.
- Wood and stone gatherers- Some animals could fell trees and collect wood from their barks. Others could simply go around collecting stone, making construction easier.
- Specialised gatherers- Some animals could be gatherers for specific items like berries, a specific fruit etc.
- Organic Polymer Producer - Some animals can be tamed (or killed) to obtain fibre.
- Food hunter- Tamed carnivores can be trusted to hunt other animals and bring meat. Tamed herbivores can be used to get raw products from trees.
- Guard animals- Animals can be instructed to guard a location and attack all other players/animals that try to enter.
- Combat- Different animals can have different special combat abilities that protect the player from attackers.
- Sea creatures- Sea creatures can be used as a mount to cross oceans or for fishing. Some sea creatures can share their reserve of oxygen increasing the player’s breathing capacity. Some sea creatures could be used to collect resources at the bottom of the sea like oil.
- Companion- An animal that simply follows you around so you never feel lonely (or at least less lonely when mining at 2 AM).
A nice forum post by Vaibhav Bajaj, last year’s GCI student, talks about creating a Pets module and covers taming in great detail here. Implementing taming in game is still a bonus item, probably something I’d get back to after I’ve checked off the main items. Next week should involve starting the puzzle work and building the new gameplay module.