Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement organization and city economy #916

Merged
merged 26 commits into from Jul 31, 2020

Conversation

idshibanov
Copy link
Collaborator

@idshibanov idshibanov commented Jul 28, 2020

Fully implemented city economy along with workers, wages and budgets. Based on actual data and algorithms in the original game. X-Com funding will be implemented separately as they use completely different logic there.

  1. Added code extracting missing values related to Building, BuildingFunction and Organization
  2. New game initialization logic: two weeks of funding and profitability of every building
  3. Simulated civilian workforce that is paid salary by organizations. Civilians move between buildings and can switch jobs.

@idshibanov idshibanov self-assigned this Jul 28, 2020
@idshibanov idshibanov added WIP Work In Progress. This is not a complete feature/fix. Check it out, maybe you have something to add? Not Yet Implemented This fix or feature is not yet implemented or merged with trunk labels Jul 28, 2020
@idshibanov idshibanov removed the WIP Work In Progress. This is not a complete feature/fix. Check it out, maybe you have something to add? label Jul 28, 2020
@idshibanov idshibanov marked this pull request as draft July 29, 2020 03:48
@idshibanov idshibanov changed the title Extract building economy data Implement organization and city economy Jul 29, 2020
@idshibanov idshibanov marked this pull request as ready for review July 29, 2020 07:50
@FilmBoy84
Copy link
Collaborator

LGTM
I also note your comment with regards to values from bld_cost_struc
These can always be amended later if needed
But, TBH, they seem to work in the build i tested as per OG at Medium difficulty
Maybe the offset was determined by difficulty at one time?

If JonnyH and any other devs don't have any queries, i'm good to merge

Thanks for a great update ShellStorm

game/state/gamestate.cpp Outdated Show resolved Hide resolved
@idshibanov
Copy link
Collaborator Author

idshibanov commented Jul 29, 2020

I also note your comment with regards to values from bld_cost_struc
These can always be amended later if needed
But, TBH, they seem to work in the build i tested as per OG at Medium difficulty
Maybe the offset was determined by difficulty at one time?

We should be able to update those values via difficulty patch XML for BuildingFunction. I don't think they work that well in OG either (Marsec gets income boost in base data for example), so we can look to change them later.

game/state/city/building.cpp Outdated Show resolved Hide resolved
game/state/gamestate.cpp Outdated Show resolved Hide resolved
tools/extractors/extractors.cpp Outdated Show resolved Hide resolved
game/state/city/building.cpp Outdated Show resolved Hide resolved
game/state/city/building.cpp Outdated Show resolved Hide resolved
game/state/city/building.cpp Outdated Show resolved Hide resolved
game/state/gamestate.cpp Outdated Show resolved Hide resolved
game/state/gamestate.cpp Outdated Show resolved Hide resolved
game/state/gamestate.cpp Outdated Show resolved Hide resolved
tools/extractors/common/building.h Show resolved Hide resolved
tools/extractors/extract_buildings.cpp Outdated Show resolved Hide resolved
{
// Initialize economy data, done in the map/city editor or when game starts for the first time
// Not on save/load, that's why values are serialized
currentWage = 65;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the default initial state? Maybe add it to the extractor instead (IE so it'll be in the 'initial gamestate' - as otherwise this in-code value will override anything set in mods

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it was the default internally. I moved it to be a city variable, set in the extractor (only for human map). The rest of "magic numbers" is a rough proportion of this one, so I got rid of those.

@FilmBoy84
Copy link
Collaborator

Excellent work Shellstorm!
My build from this branch seems to work with no obvious problems well into week 6 for organisation funding
I'm good to merge and JonnyH gave thumbsup to merge on Discord #GitHub_News last night
So here we go.... 🥳

@FilmBoy84 FilmBoy84 merged commit ae1deb1 into OpenApoc:master Jul 31, 2020
@makus82
Copy link
Contributor

makus82 commented Jul 31, 2020

Wow im reading your description and cant belive my eyes) its looking really great .. and fo that short time
thx for your work @idshibanov

X-Com funding will be implemented separately as they use completely different logic there.
From this i understand you will do this after the economy?

Anyway this your work and Jonny with language changes should be now go to OA news at FB =] right away!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Not Yet Implemented This fix or feature is not yet implemented or merged with trunk
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants