Innovative Resources
From EQUIS Lab Wiki
Contents |
Innovative Resources
Group Members
- Banani Roy
- Rob Fletcher
Goals of project
We would like to add more basic resources (water, grain, food, wood, etc…), animal resources (moving resource nodes like sheep, cows, horse, and oxen), and new buildings to integrate these new resources into the village (farms, quarries, and pens).
How our changes will affect the user
We would like to add several new features relating to the resources in Life is a Village. The first addition will be a slight change to the existing resource system. Instead of villagers collecting resources directly from certain resource nodes (such as trees and stone) there will be wandering animals like sheep, cows, and horses. These animals can be taken back to the village where they can be placed into farms and used to generate resources on their own. For instance, collecting sheep will lead to a steady production of the wool resource. They are ‘harvested’ only once, but produce indefinitely.
This will require a system of wandering animals (moving resource nodes) and it will require specialized buildings at the village. In our case this will mean pens for the sheep, barns for the cows, and stables for the horses. In order to facilitate specialized buildings, an extension to the existing building interface will be needed to select and build additional buildings.
Another benefit from extending the building system is that buildings can be required to be constructed on certain resource nodes before the resources can be exploited. A quarry will be needed before stone can be brought back or a tubewell will need to be installed before water can be collected. Back at the village, storage buildings can be constructed to increase the availability of certain resources, such as conserving water during the dry summer months and freezers can preserve food.
Newly designed buildings will also become resource nodes by being homes to the animals. Other new buildings can be gardens or farms, increasing the production of food for the villagers.
Animals, which can be used for transport as well, will be added in coordination with the team working with mounts.
Finally, a system of keeping track of the multiple resources will need to be added, along with a GUI front end to inform the player of the status of their resource collection. Resource tracking is important especially with the addition of new buildings which will have a cost associated with their construction.
New Resource Specification
Resources will be classified into three groups in addition to the trivial resource, human resources, which come directly from the villager population. The first new group is the basic resource group. These are for the simple resources which can be found on the map and can be harvested directly such as the existing wood resource. Basic resources will be:
- Wood
- Fish
The second group of resources will be building resources. Building resources will be generated not by harvesting but by having certain buildings. Our new building resources will be:
- Barn (for storing cattle which generate food and labor)
- Garden (for light food production)
- Field (for heavy food production)
- Sheep Pen (for wool and food production)
- Storage buildings (for storing food and water)
The third group of new resources will be animal resources. These resources will be animal avatars wandering throughout the level. Once captured, the animals are returned to the village where they are put to work in an appropriate manner. Animals are kept in buildings and serve to increase the production of building resources. Animal resources will be:
- Sheep (food and wool)
- Horse (labor and mount)
- Cow (food)
- Ox (labor)
Technological Issues
We will need to look at the map generation routines in order to appropriately distribute the new resources into the world. As well as dealing with the user interface issues involved in a slightly more complicated building system. GUI routines will also be required in order to provide the user with appropriate feedback on the status of their resource collection.
More Realistic Expected Goals
In the interest of completing a portion of this project, here are some milestones of an abbreviated version of that which was described above.
Milestone 1: Rock
The first goal will be to simply duplicate the existing simple tree resource. We'll call it "Rock" and it will be collected from rocky patches of terrain.
Milestone 2: Sheep
The next goal will be to create wandering resources. They will behave the same way as static resources, except that they will only stop moving when a villager is collecting from them. We will have sheep who can be sheared repeatedly, for instance.
Milestone 3: Well
We'll look into extending the building system so that new buildings can be placed on certain areas before they become full blown resouce nodes. This would be like building a well on a damp spot, allowing water to be collected.
Required Work
Generalizing Existing Resources
After an initial look at the code, it was found that all of the information related to the tree resource was hardcoded. The first goal will be to lift that hardcoded data and encapsulate it appropriately. Doing a search for 'tree' revealed the following:
CAXGameState
/// The squared distance that the user must come within to cut down /// a tree resource node. const float TREE_NODE_CUTDOWN_QUERY_DIST_SQ = 64000.0f; /// The squared distance that the user must come within to cut down /// a tree resource node. const float TREE_NODE_CUTDOWN_QUERY_DIST = 253.0f;
These values can change based on the type of resource. Smaller resources will require the player to be closer to the centre. The proximity to the node, however, might remain constant because nodes might all be represented similarly.
CAXVillager
/// The number of seconds for the villager to chop a tree before /// stopping. const float VILLAGER_CHOP_TIMEOUT = 25.0f;
...
/// Special symbol to indicate chopping animation. const string VILLAGER_SYMBOL_IS_CHOPPING = "chop";
...
/// The number of units of wood this villager can carry. const unsigned VILLAGER_WOOD_CARRYCAP = 20;
The villager has a carrying capacity for wood, a chop timeout, and a symbol to indicate chopping. Most of these should be changed to depend on the resource. Or could even be derived. For instance, the base speed for chopping wood could be "25.0f", however a quick villager might have a speed cooefficient of 0.9, altering the speed. Similarly the carrying capacity could be determined by assigning a weight to a unit of each resource, and then a weight capacity to a villager. Stronger villagers can carry more. That won't happen for a while, but those values can be placed into the resource data structures.
The chopping symbol will require a bit more research into the structure of the game before generalizing. Maybe there will be a handful of harvest animations (chop, dig, pick) and then each resource gets assigned one.
CAXVillagerManager
/** * Builds a path to a tree the villager should cut down. * * \param villager the villager to operate on */ static bool go_to_tree(CAXVillager* villager);
/** * Checks whether the villager is at a tree or not * * \param villager the villager to operate on */ static bool at_tree(CAXVillager* villager);
/** * Removes the tree that the villager was working on. * * \param villager the villager to operate on */ static bool remove_tree(CAXVillager* villager);
These need to be changed to "at_resource" and "go_to_resource" and the code needs to be adjusted appropriately.
CAXWorldResourceManager
This will likely be the spot where a great deal of work will need to be done. It has methods for dealing with trees, and resource nodes. This manager will have to acquire resource information and distribute them around the world. Hardcoding could be a bandaid solution until we figure something else out, maybe a .resource like .building XML file.