Factories & Workers

Started by
15 comments, last by powerneg 10 years, 6 months ago

I would like to discuss the relationship between factory and workers (in strategy games). The output should depend on both, the factory (building and tools) and the workforce (workers). I have a big trouble making a system where these both are important.

I was researching about it a lot and, unfortunatelly, in basicly all games only one of these is used (as a real bottleneck). The other is either ommited or not a problem at all. Usually it's just a building (factory) that matters and workers are just a cost or a minor annoyance at most.

The only exception I found was Tropico. There both factory and workers are a bottleneck (sometimes at different times, but generally it works very well). I was thinking what makes this system so good while other (quite similar, like in Deadlock 2) are not that fun/playable/balanced.

My conclusion was that it's good because in Tropico:

- it's realtime (while I look for a turn based solution), OK, maybe that one is not that important

- you can't put any workers in factories, they do it on their own will as they see fit (in Deadlock 2 there was a similar system but you were assigning workers manually and you could do it every turn and it resuulted in a lot of very boring micromanagement)

- you were able to control the flow of workers by setting wages for each factory, also (very important) you could disable any number of "worker slots" anytime in any factory

So, if the system in Tropico was so great why don't just copy it? Well, it has some hidden drawbacks which don't make it so good for all kinds of games (althrough non of these are relevant in Tropico).

- there are no production chains; OK, in theory there were, like sugar -> rum but it was never a real problem because the chain was very shallow

- each factory had "allow auto import" of resources, which basicly make it irrelevant (for a price) if you had the resources to make the final product

- the production system was extremely simplistic; for example there was not even a "coal + iron = steel" which would put a big stress on exact proportion of certain mining output (number of coal mines should be equal to iron mines) and foundry capacity (foundry capacity should be equal to coal and iron mine output)

I'm at a loss how to approach it....

Stellar Monarch (4X, turn based, released): GDN forum topic - Twitter - Facebook - YouTube

Advertisement

Whichever you have least of is the bottleneck, if you're going to make a system where both the factories and the workforce and equally hard to get, neither of them will be a bottleneck.

Players will often appreciate it if, when they have a surplus of either one, that surplus can still produce, even if at lower efficiency

For a multiplayer strategy-game i would make both readily available, but giving the opponent the possibilitie to target either one to attack.
a single-player campaign shortages and such could be different each level.

The way I approached this problem is by having AI workers calculate the paths to all work opportunities, calculate the time it takes to get there, calculate the amount of time they could spend working there (spending their labour power, a resource like any other, used in transforming raw material into goods), how much they would get for the time spent, and comparing the options, choosing the most profitable (net profit over time). There need to be lots of competing work opportunities though for it to work and lots of buildings of the same type for competition to work. This is pathfinding-intensive and requires a modern computer. This makes it poor for mobile platforms or MMO. A problem is that it's hard to balance so that the entire economy doesn't break down. You might choose to implement it differently, but the way I made workers regain their labour power is by resting at apartments (which they pay rent for, forming a complete loop in the circulation of money). They also need to buy food at a certain rate to survive, another part of the loop.

https://github.com/polyf/corpstates/blob/master/labourer.cpp

https://github.com/polyf/corpstates/blob/master/job.cpp

https://github.com/polyf/corpstates/blob/master/transportation.cpp

https://github.com/polyf/corpstates/blob/master/transportation.h

Let's narrow it to single player strategy games only (Imperialism, Deadlock, Victoria: Empire Under the Sun, Europa Universalism, etc). Preferably turn based.

Stellar Monarch (4X, turn based, released): GDN forum topic - Twitter - Facebook - YouTube

I would like to discuss the relationship between factory and workers (in strategy games). The output should depend on both, the factory (building and tools) and the workforce (workers). I have a big trouble making a system where these both are important.

In Tropico 4, the people also develop skills in each job they work, and better skill translates to higher production.

Here's an idea: Make the workers the thing that gets the production accomplished, and everything else is a tool to assist them. Then a Factory is just a container for workers, which might have an upgrade-able population cap. A factory might also offer some sort of investment options as well -- sink an up-front cost into additional features, and the facility gains a bonus for everyone that works there.

--"I'm not at home right now, but" = lights on, but no ones home

Let's narrow it to single player strategy games only (Imperialism, Deadlock, Victoria: Empire Under the Sun, Europa Universalism, etc). Preferably turn based.

Europa Universalis covers one time period within the higher structure of Paradox games. Victoria 2 has a massively detailed pop and factory system simulating the industrial revolution. Vicky2 simulates capitalists, resource gathering, railroads, artisans, craftsmen, clerks, and factories as well as multiple government policies like interventionism, laissez-faire, state capitalism(state capi best capi), and planned economies. I'd really suggest looking into what they did. Its pretty amazing.

Here's an idea: Make the workers the thing that gets the production accomplished, and everything else is a tool to assist them. Then a Factory is just a container for workers, which might have an upgrade-able population cap. A factory might also offer some sort of investment options as well -- sink an up-front cost into additional features, and the facility gains a bonus for everyone that works there.

Yeah, but how to do it? How exactly it should work? How workers are assigned to such factory?

Europa Universalis covers one time period within the higher structure of Paradox games. Victoria 2 has a massively detailed pop and factory system simulating the industrial revolution. Vicky2 simulates capitalists, resource gathering, railroads, artisans, craftsmen, clerks, and factories as well as multiple government policies like interventionism, laissez-faire, state capitalism(state capi best capi), and planned economies. I'd really suggest looking into what they did. Its pretty amazing.

Well, OK, it worked for Victoria 2, but overall it was a great disappointment for me. All those AI "capitalists" that were building factories as they see fit, that aspect was very boring, I could not do anything regarding industry. I didn't even had tools to say "now let's build steel industry" (unless I have a very specific government type). It's a good example of a system I definitely want to avoid.

I mean, I want to build the industry in *my* country myself, I want to make meaningful decisions where allocate the limited resources and which direction the industry should take. That's a big part of the fun I get from those games and if it's not realistic then I say throw realism overboard :)

Stellar Monarch (4X, turn based, released): GDN forum topic - Twitter - Facebook - YouTube

The way I approached this problem is by having AI workers calculate the paths to all work opportunities, calculate the time it takes to get there, calculate the amount of time they could spend working there (spending their labour power, a resource like any other, used in transforming raw material into goods), how much they would get for the time spent, and comparing the options, choosing the most profitable (net profit over time). There need to be lots of competing work opportunities though for it to work and lots of buildings of the same type for competition to work. This is pathfinding-intensive and requires a modern computer. This makes it poor for mobile platforms or MMO. A problem is that it's hard to balance so that the entire economy doesn't break down. You might choose to implement it differently, but the way I made workers regain their labour power is by resting at apartments (which they pay rent for, forming a complete loop in the circulation of money). They also need to buy food at a certain rate to survive, another part of the loop.

https://github.com/polyf/corpstates/blob/master/labourer.cpp

https://github.com/polyf/corpstates/blob/master/job.cpp

https://github.com/polyf/corpstates/blob/master/transportation.cpp

https://github.com/polyf/corpstates/blob/master/transportation.h

I recall a game named Children oif the Nile (an ancient egyptian game) which had a severe problem (and lack of a competant designer/programmer aparently ) where the workers were generated by placing houses on the map which attracted immigrants which then sought available work -- you also placed various workplaces (effectively factories) on the map to provide those jobs. Unfortunately the workers got locked into whatever job the first assigned themselves to and would waste huge amounts of time crossing the map (some taking all day and then walking home without doing much of a work period) when similar work positions were nearby. New housing placed adjacent to the factory went unused or attracted workers which also often went across the whole map to work. There were even administrative functionals who should have had the job to organize/straighten things out but they were just as logic-less.

Dynamiting the housing and rebuilding was the only way to force it to fix itself. Obtaining sustinance materials from support shops/temples etc customers were assigned the same dim way (wasting huge amounts of time getting supplies from across the city map when there was the same shop immediately nearby they never went to). It was one of those city building games and you often added additional facilities (with a limited budget) in many places which the unit logic had a too simplistic a mechanism to handle units choices. Building the facilities (factories houses/whatever ITSELF required materials and workers which had the same cluesless work assignment logic).

Consumers and shops similar dim scheme instead with a unit walking over to a distant shop and finding it empty walked all the way back even passing and ignoring the same kind of shop with the goods it needed (passed on the way TO that distant shop..)

Rocket science for that company would have had units walking home from Work which passed shops when there is an outstanding buying list of needs/services and taking the opportunity to buy the stuff (thus double using the transportation time).

Anyway I explained on their forum a way to make this less idiotic (my line was if I was pharaoh and had overseers run their projects this way I would have had them executed) by sorting the workers (if doing same jobs - some were huge projects with many different worksites) and assigning the ones with the nearest home to work paths first and filling jobs-unit matchups that way from there. Similar matchup for goods consumers and sources (shortest paths assigned as priority ). Then closer placement by player would actually work (as planned) without bizaare illogical behaviors.

I understood that this might be a processing intensive calculation (for a semi real time game) but mentioned that the reassignments probably only needed to be done periodicly (to rematch a mutating cityscape) and possibly could be done in sub-parts for the different (independant) source-customer arrangements. Once assigned, the units would keep those assignements unless something changed (customer gone or source gone) when the simplistic assignment method could temporarily be used until the next 'smart' reassignment cycle.

They never did fix it and left the game in a frustrating state where the player would often wonder why certain projects never got done as fast as they should have and various units were suffering (and wouldnt develope/advance) because they never got their quotas of needed goods/services.

--------------------------------------------[size="1"]Ratings are Opinion, not Fact
I recall a game named Children oif the Nile (an ancient egyptian game) which had a severe problem (and lack of a competant designer/programmer aparently ) where the workers were generated by placing houses on the map which attracted immigrants which then sought available work -- you also placed various workplaces (effectively factories) on the map to provide those jobs. Unfortunately the workers got locked into whatever job the first assigned themselves to and would waste huge amounts of time crossing the map (some taking all day and then walking home without doing much of a work period) when similar work positions were nearby. New housing placed adjacent to the factory went unused or attracted workers which also often went across the whole map to work. There were even administrative functionals who should have had the job to organize/straighten things out but they were just as logic-less.

When calculating where a worker should live, we start with a list of possible homes and another list of possible employers. Then we want to select the pairing of available home-work that has the shortest walking distance.

Each candidate house has a full set of the possible workplaces to travel to. So the total number of distances to consider is numHouses * numWorkplaces. For example, if the map currently has 4 home vacancies, and 3 factories that can employ people, then there are a total of 4 * 3 = 12 possible routes.

So create a PriorityQueue containing home-work associations, sorted on distance between them. Then draw the top item whenever you need to assign a worker to a home-work route.

--"I'm not at home right now, but" = lights on, but no ones home


When calculating where a worker should live, we start with a list of possible homes and another list of possible employers. Then we want to select the pairing of available home-work that has the shortest walking distance.

Each candidate house has a full set of the possible workplaces to travel to. So the total number of distances to consider is numHouses * numWorkplaces. For example, if the map currently has 4 home vacancies, and 3 factories that can employ people, then there are a total of 4 * 3 = 12 possible routes.

So create a PriorityQueue containing home-work associations, sorted on distance between them. Then draw the top item whenever you need to assign a worker to a home-work route.

The the question is are there any other factors which effect the decision to make one home more desireable than another for a worker or worker differentiation which makes some better than others for a particular factory. Thus complicating your 'fitting' calculations/decision.

Another is: is it a static situation or if dynamic which can change and what will your strategy will be for recalculation . Depends how complex you simulation is as to wheter the change itself has some cost so you then have to weight which corrections cost the least but still have adaquate benefits for production (ex- in the Nile game, housing grew/developed and progressed and when a worker moved they had to start over which was a big negative cost factor , likewise transportation paths (dependant on seperate map objects) could be shifted and a workers old path might be very different from a new current shortest path)

--------------------------------------------[size="1"]Ratings are Opinion, not Fact

This topic is closed to new replies.

Advertisement