-
Notifications
You must be signed in to change notification settings - Fork 0
Adding Resources to the game
As the game develops, it is likely that many more resources will be required by developers to achieve desired gameplay loops. This process has been made easy with ResourceGenerator, as adding a resource is as simple as editing a .json file, and creating a factory.
resources.json is the resource config file, found in assets/configs/resource.json. It contains all the data the game needs to allocate space on the map for a resource. For example, if you wanted to add a new resource "Amethyst" in addition to the current resources, you would edit the file as follows:
File prior to editing:
{
resources: [
{
"name": "Tree",
"width": 1,
"height": 1,
"minAmount": 25,
"maxAmount": 60,
"preferredDistance": 30
},
{
"name": "Stone",
"width": 2,
"height": 2,
"minAmount": 5,
"maxAmount": 10,
"preferredDistance": 999
}
]
}
File post editing:
{
resources: [
{
"name": "Tree",
"width": 1,
"height": 1,
"minAmount": 25,
"maxAmount": 60,
"preferredDistance": 30
},
{
"name": "Stone",
"width": 2,
"height": 2,
"minAmount": 5,
"maxAmount": 10,
"preferredDistance": 999
},
{
"name": "Amethyst",
"width": 1,
"height": 1,
"minAmount": 1,
"maxAmount": 5,
"preferredDistance": 20
}
]
}
This will allocate space on the map for up to 5 amethyst resources (randomly chosen), each occupying space of 1x1 tiles.
In order to create an entity with the required components, create a resource factory (see StoneFactory or TreeFactory).
spawnResources() iterates through a list of ResourceSpecification to spawn all resources produced by ResourceGenerator. Add to the set of conditional statements that determine which type of resource it is based on name, and use your ResourceFactory to spawn your resource.
e.g.
if (rs.getName().equals("Tree")) {
//Spawn a Tree entity
mapComponent.setDisplayColour(Color.FOREST);
spawnEntityAt(TreeFactory.createTree().addComponent(mapComponent), spawn, false, false);
} else if (rs.getName().equals("Stone")) {
//Spawn a Stone entity
mapComponent.setDisplayColour(Color.DARK_GRAY);
spawnEntityAt(StoneFactory.createStone().addComponent(mapComponent), spawn, false, false);
}
Map
City
Buildings
Unit Selections
Game User Testing: Theme of Unit Selection & Spell System
Health Bars
In Game menu
- Feature
- User Testing:In Game Menu
Landscape Tile Design Feedback