CityBuildings | Procedurally generated city with Unity3D | Graphics library
kandi X-RAY | CityBuildings Summary
kandi X-RAY | CityBuildings Summary
Procedurally generated city with Unity3D. This project’s concept is all models are procedural generation. I don’t have any .fbx or .png or other files as assets. I have generated all assets by GPU program or CPU program.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of CityBuildings
CityBuildings Key Features
CityBuildings Examples and Code Snippets
Community Discussions
Trending Discussions on CityBuildings
QUESTION
I am currently working on a sim city style game, and I am currently looking into managing the population for the city. The script will eventually work as when a house is placed, that house adds to the capacity of how many people the city can house. When the construction is complete then I will add that number of citizen structs to a List of citizens.
However, imagine that the population reaches in excess of 1000, 10000 citizens. Will this be the optimal solution for controlling a large volume of citizens? Moreover, when a house is removed this will remove the amount for the population (removing from the list) thus leaving job vacancies. I eventually would like for the player to be able to shift focus so any buildings with enum category of the focus shift will mean the work force will fill in those jobs first. Again would using the List and Linq queries be the way to go or would there be a better solution found with something else?
...ANSWER
Answered 2020-Jan-17 at 12:26The answer is - as you may have expected - it depends. The LINQ-operations are usually quite fast unless you are talking millions of objects. However they will produce some garbage that has to be collected eventually. If you perform such operations every frame you may run into GC hiccups. If you run stuff not that often (e.g. only when a player places/removes a house, etc.) this approach should work fine.
If you need maximum performance you may want to have a look at the new DOTS architecture (aka. ECS) in Unity, which allows you to manage large quantities of data fast. That being said - premature optimization is the root of all evil and DOTS is quite the beast to wrap your head around.
I'd start with the LINQ queries, making sure they are not called every frame and maybe some clever caching and only bring in the big guns when I actually have a performance problem.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install CityBuildings
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page