GSoC Week 3: Advanced Behaviors and Taming
The past week has been lighter compared to the previous two, involving a lot more of packing and moving, research and documentation.
What have I been up to?
Adding to the 4 deer (
hostileDeer) from last time two new behaviors have been added namely-
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 would give a quick preview.
Also, the flee behavior is now improved such that the animal would always run in a direction away from the player as compared to randomly moving about like last time.
In addition, last year’s GCI saw a lot of students write up formal descriptions about AI for animals and their behavior. This can be found here and is possibly a good reference for future.
Packing and Moving- AdvancedBehaviors
It was felt that the behavior work that I had been up to, should not really be restricted to the WildAnimals module. It had great potential outside for other NPCs like monsters, zombies, aliens.. you name it. One particular requirement was that of the GooeysQuests’ skeleton which would try its best to kill you in the dungeons. Currently the skeleton just has a hostile behavior, which means that it does nothing at all until a player comes close to it. After which, it would follow the player in an attempt to kill. When the player dies or escapes the skelton would return to doing nothing (standing still) where ever it had reached. The
hostileInProximity behavior that I had implemented for the hostileDeer is probably a better alternative, where in the deer switches from hostile to stray behavior. Further the behavior switching systems could be used to add a guard behavior that would allow the skeleton to return to a specific location that it guards (a tressure, a secret door, who knows?).
All this just meant one thing, that the core behavior systems should not be kept restricted to the WildAnimals module as they would have great use even in other modules. With this need was born the AdvancedBehaviors module which would just be a library module having logic and systems that are 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 the WorldlyTooltipAPI module which too has no content of its own, but just 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 dependency on it as it doesn’t need to be necessarily activated. A user should be able to enjoy the WildAnimals module without having to activate the WorldlyTooltip module. One possible way to solve this is using optional dependencies.
Lets take the WildAnimals and WorldlyTooltip module as an example. If the WildAnimals module is made to have an optional dependency on the WorldlyTooltip module, it's core features would be accessible even when the WorldlyTooltip module is inactive. Activating the WorldlyTooltip module just would enable the features that rely on it.
The other way to do this is using what are called API modules.
For example, the WildAnimals module uses the 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 had a dependency on the WorldlyTooltipAPI module. WildAnimals module could now be activated without activating the WorldlyTooltip functionality (even though the dependency WorldlyTooltipAPI got activated).
With behaviors being defined for animals, it would be fun to turn a hostile or aggressive animal into a friendly one. Having a horse that you can ride, a donkey that carries around some load, a dog that guards an entrance, a cow that gives milk, all sound like a fun idea to have in game. Here are some thoughts on how taming can work in game.
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 should he continue the efforts on taming. There might be more than one ways to tame an animal, some more effective than the others. The more effective ones would increase the progress bar quicker allowing for speedy taming.
- 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 would attack when in proximity of 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 would 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 have the feed option available now (which wouldn’t have been available earlier).
- Knocking out- The animals can be knocked out by fighting off with different equipment. When an animal reaches a low health the player can choose to knock it out. If the player continues to attack it and makes it health reach 0, the animal simply dies as it now does. Knocking out would have a similar effect like tranquilising, it would leave 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 progressbar outside that also shows the taming progress.
Since methods like knocking out or hurting an animal before attempting to tame it seems odd. It can be made possible that the animal remembers only the player which 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 into picture multiplayer taming.
- 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 that you never feel lonely.
A nice forum post by Vaibhav Bajaj, last year’s GCI student, talks about creating a Pets module and talks about taming at 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 a start to all the puzzle work and making of the new gameplay module.