You are browsing as a guest. Sign up (or log in) to start making projects!

Open comments for this post

4h 22m logged

Clean codebase always pays off (unless you want to keep your job apparently?)

Fixed the vacancies counter, as before I was using = instead of +=. Told you it’s the little things that catch you out.

Created a safer version of the draft forceRemoveElement() that accounts for jobs and residents when destroying a building (houses/shops/industry). This now updates the game realistically, e.g. if you destroy a house, then you reduce from the population. If the residents were employed, then it removes positions from buildings. If they were unemployed, then we remove it from the stats.

Since I am not storing direct references between buildings but creating a game pool for performance, this makes the operations require lots of calling. This could probably be optimised in the future but I will do that near the first release due to the ever-changing code base.

This required updating GameManager.cs to have LosePopulation(), LoseJobs() with a helper RemoveWorkersFromBuildings() function. Luckily the lists in GridMananger that I made like 20 hours ago for “future proofing” came in useful.

Finally, you can press F to show city statistics and it updates in real time.

1
192

Comments 2

@ThatFairyFijia

Yoo this is sick! Is this kinda similar to Sim City?

@Falling10fruit

I wished more people would put more attention to projects like these.