Jump to content

  • Log In with Google      Sign In   
  • Create Account

Factories & Workers


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
16 replies to this topic

#1 Acharis   Crossbones+   -  Reputation: 3986

Like
0Likes
Like

Posted 24 August 2013 - 06:29 AM

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....


Edited by Acharis, 24 August 2013 - 06:29 AM.

Europe1300.eu - Historical Realistic Medieval Sim (RELEASED!)

PocketSpaceEmpire - turn based 4X with no micromanagement FB


Sponsor:

#2 powerneg   Members   -  Reputation: 1463

Like
0Likes
Like

Posted 24 August 2013 - 09:55 AM

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.



#3 invutil   Crossbones+   -  Reputation: 1913

Like
0Likes
Like

Posted 24 August 2013 - 11:58 AM

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



#4 Acharis   Crossbones+   -  Reputation: 3986

Like
0Likes
Like

Posted 24 August 2013 - 02:03 PM

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


Europe1300.eu - Historical Realistic Medieval Sim (RELEASED!)

PocketSpaceEmpire - turn based 4X with no micromanagement FB


#5 AngleWyrm   Members   -  Reputation: 554

Like
0Likes
Like

Posted 24 August 2013 - 09:47 PM

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.


Edited by AngleWyrm, 24 August 2013 - 09:48 PM.

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

#6 AltarofScience   Members   -  Reputation: 934

Like
0Likes
Like

Posted 24 August 2013 - 10:55 PM

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.



#7 Acharis   Crossbones+   -  Reputation: 3986

Like
0Likes
Like

Posted 25 August 2013 - 07:29 AM

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 :)


Europe1300.eu - Historical Realistic Medieval Sim (RELEASED!)

PocketSpaceEmpire - turn based 4X with no micromanagement FB


#8 wodinoneeye   Members   -  Reputation: 876

Like
0Likes
Like

Posted 26 August 2013 - 06:52 AM

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.


Edited by wodinoneeye, 26 August 2013 - 07:09 AM.

--------------------------------------------Ratings are Opinion, not Fact

#9 AngleWyrm   Members   -  Reputation: 554

Like
0Likes
Like

Posted 26 August 2013 - 04:32 PM

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.


Edited by AngleWyrm, 26 August 2013 - 06:43 PM.

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

#10 wodinoneeye   Members   -  Reputation: 876

Like
0Likes
Like

Posted 27 August 2013 - 06:48 AM


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)


--------------------------------------------Ratings are Opinion, not Fact

#11 invutil   Crossbones+   -  Reputation: 1913

Like
0Likes
Like

Posted 27 August 2013 - 12:39 PM

Workers should only switch jobs/housing when a better job/housing opportunity becomes available. Pareto efficiency. Better job = higher net profit (higher pay, less travel time). Better housing = higher net profit (cheaper, closer to work). Maybe factor in time spent shopping/eating at shopping malls/stores. So you'd have to check job/housing opportunities whenever a rent or wage changes, or a new apartment building/work place becomes constructed, or the job or home changes (requiring a check against all available jobs or housing, to pair it up with a different job/home until there's no more change).



#12 AngleWyrm   Members   -  Reputation: 554

Like
0Likes
Like

Posted 27 August 2013 - 05:04 PM

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)

  1. The above system used minimum walking distance as the score criteria, but you can create a utility function that weights any number of additional factors any way you please and returns a single scalar score for use in the priorityqueue. But the business of arriving at a mathematically accurate weighting for additional factors is typically...Unrefined. Often resolved by ballpark guess followed by iterative buff/nerf adjustments. Is it necessarily a refinement process, or can it be calculated? Don't know, and it could be that this is an instance where the answer can only be achieved through executing a procedure, rather than calculating an answer.
  2. The represented situation was dynamic, with buildings being constructed and demolished, with people being hired and possibly fired or killed. If people are given the option to automatically move to closer distance housing as soon as that's available, then we have a re-evaluation taking place by each citizen after construction. This re-evaluation could take the form of summing up the total distance walked by all citizens, then running a simulation where everyone is kicked and re-housed, and comparing the proposed new total distance to the old total distance. If the new score meets some threshhold criteria, then relocation happens.

Edited by AngleWyrm, 27 August 2013 - 08:16 PM.

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

#13 Acharis   Crossbones+   -  Reputation: 3986

Like
0Likes
Like

Posted 28 August 2013 - 02:21 AM

Khem, you sidetracked it to too many unnecessary and unimportant technical details :) The big question is, how the player is going to control the flow of workers (if we assume that workers should select the job as they fit, since that's the direction this discussion is going for so far)?

 

There is a coal mine, iron ore mine and a steel foundry. How the player can "control" so these buildings have balanced workforce so as few capacity is wasted as possible? How to make it so the player worries both on funds to construct new factories and about the availability of workforce?


Europe1300.eu - Historical Realistic Medieval Sim (RELEASED!)

PocketSpaceEmpire - turn based 4X with no micromanagement FB


#14 AngleWyrm   Members   -  Reputation: 554

Like
0Likes
Like

Posted 28 August 2013 - 06:32 PM

There is a coal mine, iron ore mine and a steel foundry. How the player can "control" so these buildings have balanced workforce...

More detail is required in the example, before it can generate anything more than just rolling a random dice. Once there is a perception of a goal condition, then solving for the goal condition is possible, both automatically and as an exercise for the player.

 

So let's say that it takes 3 coal workers to produce power for each steel foundry worker, and 2 coal worker to produce power for an iron worker, and that the steel workers also require an iron worker. And we wish to maximize the output of steel. And we have only 25 workers at the moment. How many of each type should we create? Or maybe we currently have two iron factories that can house a maximum of 8 iron workers; then how many of each type should we create? Or maybe we wonder: Should I buy more people or more factories, and if so, which kind?

 

This is linear algebra, and it can be entertaining.


Edited by AngleWyrm, 28 August 2013 - 08:19 PM.

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

#15 AltarofScience   Members   -  Reputation: 934

Like
0Likes
Like

Posted 28 August 2013 - 07:48 PM

 

There is a coal mine, iron ore mine and a steel foundry. How the player can "control" so these buildings have balanced workforce...

More detail is required in the example, before it can generate anything more than just rolling a random dice. Once there is a perception of a goal condition, then solving for the goal condition is possible, both automatically and as an exercise for the player.

 

So let's say that it takes 3 coal workers to produce power for each steel foundry worker, and 2 coal worker to produce power for an iron worker, and that the steel workers also require an iron worker. And we wish to maximize the output of steel. And we have only 25 workers at the moment. How many of each type should we create? Or maybe we currently have two iron factories that can house a maximum of 8 iron workers; then how many of each type should we create?

 

This is linear algebra, and it can be entertaining.

 

Linear alge best alge.



#16 wodinoneeye   Members   -  Reputation: 876

Like
0Likes
Like

Posted 28 August 2013 - 11:56 PM

There is a fitting  method ( for building a full ituation from scratch) where you  grow the situation organicly to adhere to the limitations and practicalities.

 

Special setup rules define operetional requirements for the consumers (factories needing workers, and other factories needing the output of those other factories, and probably also services and materials to sustain the workers).      Resoyrce limitation would be supplied as an initial input...

 

Entities are added one at a time and their requirements ae then met (other entities which feed their consumption)  til you have a viable (if not optimal) sitution.

 

At some point the external limitation may be reached and you have to backtrack the non viable entities (remove or downsize) and then reapportion the freed resources to other entities (now locking the one that failed)

 

Some initial tagets(goals)  may define the priority for the first entities  (  a coal plant and a steel plant)  to get the organic growth going  (seeds I suppose is theright euphemism)

 

The growth goes around and around till everything is blocked  (whats left over is in a free pool for the game start)


--------------------------------------------Ratings are Opinion, not Fact

#17 powerneg   Members   -  Reputation: 1463

Like
1Likes
Like

Posted 23 September 2013 - 01:15 PM

To make both equally important you could have each build something different yet dependent at the same time.

For example you 're building tanks, the factory-size determines the size(which equals higher stats) yet it does not have any armor(stat) except that the  # of workerhours made in the factory while the tank was being build increase it's armor.

This way they're both important, they 're better when balanced by the player, and depending on the enemies(low rate high damage fire or high rate medium-low damage fire) this balance could mean something different every level.

 

There 's also civilisation that just had the spare workers turn into tax-makers/science-makers/entertainers/...






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS