mindstorm8191 / danidle

Factory Idle style game, that doesn't yet have a name. Combine basic resources to get more advanced resources, and climb up the tech ladder
4 stars 0 forks source link

Todo: Allow workers to consume food #13

Closed mindstorm8191 closed 6 years ago

mindstorm8191 commented 6 years ago

The planned rate of food consumption is 1 food for every 2 minutes, per worker. So if there are 4 workers, 1 food should get consumed every 30 seconds (this is the current output rate of the Foraging Post). I could set it up to consume X food every 2 minutes, but that doesn't seem to be a very balanced system (especially with storage blocks holding only 10 items, by default). I would like to set up a system to consume food steadily.

Additionally, I would like to have workers pick what food to consume at random. This would require finding all the food available on the map, and then picking one at random and consuming that. I'm not sure if setting that up like this would be ideal; maybe some other setup would work. I am open to fresh ideas on how to manage this.

mindstorm8191 commented 6 years ago

We will need to start using some global variables in order to manage population. The simplest for food is to make a counter variable. We can do a count-down type thing, so when it hits zero, food is consumed. At that point we can add to its value, based on how many workers we have on hand.

As for selecting a food at random, perhaps we should keep a separate global array of all the food instances we have. This will make it easier to update food decay until it is rotten. The food element will also keep track of where it's located. Even with this, we will need to run special cases when food items are transferred between blocks. To actually consume a given food, we could randomize the list (on demand) and select the first one of the list.

mindstorm8191 commented 6 years ago

Food consumption is now working as planned. We were even able to account for randomized food selection (on account of the global food list). We have also added a means to increase population size; whenever food > 2x population we can add 1 to the population. We also have a way to consume food steadily based on population size (120 / population).

Also added is a food quantity and idle worker indicator (with population), along with clothing and housing values, even though we don't have the means to influence these yet. We'll have to work on adding that at some point.