SimCity 5

PieceOfMind said:
It sounds, too, like Simcity5 is relying too heavily on a "greedy" path-finding heuristic. Sims all moving to the closest applicable destination, in a horde, and then when it's filled moving onto the next available. "Greedy" because each agent only thinks of themselves and are very short-sighted. Either this was lazy programming (possibly also a type of skeleton code in the hopes of improving later via patches) or necessary because of performance issues - I suspect the former.

As a programmer I gotta say that something doesn't sound quite right here. I mean, it's not your interpretation of what's going on, because it seems to be apt - but rather that they did this.

You can simulate agent behaviour on a large scale without having to simulate every single agent. Other games have done this.. Why they chose to go down this route is beyond me. It's as if there was another reason that isn't clear to us yet.
 
I think SimCity 4's "pathfinding" system, particularly the one with the Rush Hour expansion, while problematic in its own ways, worked out fine overall... at least compared to what the new SimCity appears to be. They could have just improved a bit on that instead of trying to overdo themselves with something that wouldn't have been worth it anyways.
SC4 Rush Hour's path-finding was ok, but the NAM mod fixed a lot of its failings. Like SC5, it was a bit too eager to assign all the shortest distance routes as solutions, rather than the fastest. If I understand correctly, that made it really difficult to get a lot of your sims using mass transit.

The vehicle automata were never related to the paths though, just traffic volume at a given point (and I guess also the type of traffic, like garbage trucks appearing near the dump). When I play SC4, I do still wish the vehicles would make a bit of sense instead of appearing and disappearing 5 seconds later barely a block down the road. Simcity5 only needed to do that, and not the same thing for all the other stuff like electricity.

@Warpus, yeah it will be interesting to hear more about SC5's model. My assumptions so far have largely been based on intuition, assisted by anecdotes, and no real experimenting of my own (<- don't own the game:)).

This might be a fun time to mention I've been playing SC4 lately with much pleasure. Currently my region, with 4 relatively young cities is up to 1.2 million population.:king:

EDIT... Here's a screenshot of one
Spoiler :
3A24EB483FB8E6F9913E2FBB48199781BC73FA8E
 
NAM (currently up to version 31 for your reference). There's a few annoying bugs introduced in version 31 though so keep an eye out for a hotfix in the coming weeks. Certainly it's still worth installing even with the bugs. If you haven't used NAM before, when installing it, it's fine to choose "Traffic Simulator" only. All the Network Addon pieces are overwhelming at first as they clog up all your build menus.

I also like Gizbo's Day/Night mod, which I had installed for the screenshot above, but certainly not essential.

Other mods you can probably find by googling. Personally I don't go for many mods with SC4 because I find it gets rather cumbersome, and most people would only mention NAM as the one absolutely essential mod.


Back to SC5,

http://forum.ea.com/eaforum/posts/list/9359265.page
I have been trying to figure out why my percentage of pop that works/shops etc keeps dropping as my city grows and did some testing which seems to explain it.

Basically I made basic power, water and waste then built a block of houses and counted the workers, shoppers, tax, and utulity usage. I then added another block, then another etc and counted up each time.

First block : 186/124/62 total pop/workers/shopper (a 2/3 to 1/3 split of pop between workers and shoppers)
Second block : 372/248/124 - Exactly double, so far so good
Third block : 630/372/186 - Same increase in worker and shoppers but a bigger increase in total pop
Fourth block :1232/496/64 Again same increase in effective pop but displayed pop has virtually doubled
By sixth block displayed pop was over 2600 (14 times one block) but actual workers/shoppers was exactly 6 times higher.
I also checked tax income and utilities and these increase in equal steps for each block too, so the phantom pop in the display seems to have no effect on gameplay at all.

This explains why a 100k pop city seems to have only 10% workforce - its actually a 15k pop city with a huge amount of phantom pop added to the count.

So far I haven't been able to figure out if all this population creates traffic but for the key metrics of workers/shoppers/tax/utility usage the numbers displayed in the details tab seem to be correct and the total pop value irrelevent.

So it sounds like the population counts are faked anyway. Your cities of 100k are more like 15k. :eek:

3rd page of comments, a post reveals why employment numbers always seem low (like 10%)
Yes. Think it was fairly obvious. I mean no I *DON'T* expect the engine to ACTUALLY display 100,000 sims on-screen at once, that's fine. It'd be wonderful, but I think we're some way off that yet tech wise.

But how this has been implemented is poor.

If you're going to have a "real" ("physical") pop of say 30k in a maxed out hugely developed city (with say 20k workers)... and you want to artificially inflate that on the screen for the players to see so they don't go "hang on, 30k? These city squares are TINY!" (which they are anyway, but a small population would emphasize that)... then do so for EVERYTHING - inflate the worker count, the shopper count, etc. - make it all tie in.

Currently it's ridiculous that as your population raises exponentially, the workers raises linearly and in very small (comparatively) increments.

Add to that the phantom JOB counts (amount of jobs available seems to go up at a never-ending rate, I can't find where all these jobs are even if I start demolishing things...)... it all feels broken.

Hey... hang on... phantom jobs available increasing as population increases... low workers for population...

Have the developers accidentally made the JOBS AVAILABLE count increase with population instead of the WORKERS AVAILABLE?

Sure feels that way
 
2gKmO


Not mine, unfortunately.
 
I love the gameplay strategies people are developing/finding...

Here's one:
03-12-2013 12:15 PM

There is an in-game solution, but it isn't pretty. Another post mentions a similar solution and it looks like people are starting to figure it out. Since everything uses the same pathfinding agent algorithm, the key is streamlining it to help the little agents find their way.

This works regardless of the size of city you want to build and specialization.

Only zone one side of any street. Minimize any intersections by either using curvy roads or long straight roads. By lowering the number of intersections, you lower the chance of the agents going around in circles or getting into gridlock. By zoning only one side of the street, you're leaving the opposite side of the street completely free for the ocassional agent that gets stuck in a loop. They quickly zip all the way to the end, since agents seem to go door to door asking "Is this a place I can stop at?" which causes some of the backup.

If you're going for density, place parallel streets only one building width apart. That'll maximize your buildings while minimizing the number of backups/doorbell ringing.

Place services, fire/medic/police where your streets converge at the end of the long roads. That way they'll have a straight shot to get to where they need to go, without getting lost. They'll still do the pack herd mentality, but they won't completely gridlock all the traffic in your city.

It's a stupid solution, but borrowing a concept from computational fluid dynamics, you're looking for laminar, not turbulent flow. Intersections and stops breed turbulence.
source:http://answers.ea.com/t5/Miscellane...c-are-broken/m-p/741250/highlight/true#M36866


EDIT... Path-finding hilarity

Link to video.
 
Thats ... worse then the original sim city.
 
Mainly adding to my discussion with Warpus earlier, I think the points made by this poster below are on the money.

My exec summary (TLDR): He suggests the game is constantly under pressure to do a lot of path-finding tasks (as so many different aspects of the game use agents, and agents require pathing). It's also using a really bad implementation of path-finding, possibly incomplete A*. Importantly, he suggests the small city sizes might be to either prevent the apparent problem getting even worse than it is, or worse, to hide it.



Source: http://answers.ea.com/t5/Miscellane...c-are-broken/m-p/745938/highlight/true#M37874
Spoiler :
cagestooge said:
Re: Traffic "AI"... This is why services and traffic are broken!
03-12-2013 07:16 PM

truckottr wrote:
Pathfinding is very difficult to get right, but it's been done over and over and there are some basic things that you do not do. Unweighted shortest path is one of them. It's pathfinding 101. Maxis has had this problem before.

Check out the original Sims and how a Sim would get stuck trying to get to something when the only path to get there required the Sim to go away from the object first. This was eventually partially addressed with a patch, but it was never completely corrected.They didn't replace the entire algorithm, which is what they needed to do, until Sims 2. It didn't cause much problem in the Sims because players learned to manually route the Sim when it got stuck. It was also sometimes amusing seeing a Sim constantly trying to walk into a wall, getting frustrated and yelling at the player for help.

The way Glassbox is set up though, pathfinding is core to almost everything and, here's the difference, its automatic. You can't manually re-route things to overcome this fundamental flaw. I find it very difficult to believe that the developers did not know how their pathfinding algorithm worked. It is used everywhere in the game.

My guess is that Maxis understood the potential for a problem, but decided to balance between having a game that ground to a halt performance wise but had workable pahtfinding vs.a game where pathfinding wasn't great but OK enough to work. They will probably come up with a kludgy patch similar to the Sims, but the underlying problem won't be fixed for quite a while because it changes the game dynamics and performance and will need to be balanced and tested properly.

Yes, it is used everywhere. The sewage, power, water, cars, pedestrians, etc. They all exhibit the same bizarre patterns at first, then when you learn a few things about pathfinding and see things like this in this article

"If you choose to consider other units that are moving and not adjacent to the pathfinding unit, you will need to develop a method for predicting where they will be at any given point in time so that they can be dodged properly. Otherwise you will probably end up with strange paths where units zig-zag to avoid other units that aren't there anymore."

And that's exactly the type of weird ass stuff I've seen. Cars just jerking around on the road for no apparent reason as if they're tryingn to avoid hitting something that isn't there. I've also seen this other bit as well:

"You will also, of course, need to develop some collision detection code because no matter how good the path is at the time it is calculated, things can change over time. When a collision occurs a unit must either calculate a new path or, if the other unit is moving and it is not a head-on collision, wait for the other unit to step out of the way before proceeding with the current path."


I think this part of their code is flawed, and would explain why cars sit at an intersection through multiple cycles of the stop light and simply do not move. Even when there is no traffic on any of the other streets around them, they just sit there. When they finally do go they go straight, they do not turn left or right or do a u-turn. Now, with no traffic in front of them, why are they just sitting there? My guess is something is wrong with the collision detection code or it's having such a hard time trying to figure out the shortest path to wherever it wants to go. Perhaps the issue is somewhere in the middle of those two issues.

This might also be because a stop light is considered a "wall" while it is red (they can't go through it so it is a wall from a programming stand point) so they start calculating what to do and starts looking for an alternate route. They shouldn't even do that. It should be programmed that when it hits a "red light wall" just wait until the wall becomes a "green light wall".

So let's assume that it doesn't take into just waiting for a "red light wall" to turn to "green light wall" and starts recalculating the path when it hits a red light. As it is doing so the light goes green and now it can go through that wall, so it starts recalculating again, but before it's done the wall goes back to red, so it has to start over yet again. Rinse repeat.

If this is the situation than the further away that driver is trying to go the more chance he/she will get stuck at that light. Easy to find the target right around the corner, not so much when you're heading to the other side of the map.


I don't think it can be easily fixed if it is at the core of the engine, which it is. In which case this shiny new toy engine of theirs will never go anywhere. It will be an example of how NOT to simulate a population of objects. Remember, they have interlinked everything so tight that changing something so fundamental as the pathing logic could ripple out all over the place and introduce hundreds of unforseen effects. They should rename this thing the "Butterfly Effect Engine".

Spoiler :
cagestooge said:
Re: Traffic "AI"... This is why services and traffic are broken!
03-12-2013 07:24 PM

PS -- This might be why the map is really so small. Pathfinding was so awful that in a huge map nothing would move, it would all just grind to a halt and crunch numbers non-stop and never figure out any path as it would take forever to calculate each node for each object all at the same time. So you either reduce the number of objects, reduce the number of nodes, or both.

Or you know, program an actual pathfinding algorithim that works a lot better than this one does.

As I think about it, I imagine the most difficult part of what they are doing with glasswork engine is all about pathfinding. It's not hard to keep a record of an "agent" name, age, job, place of work, place they live, etc. That's really nothing but a quick insert into a database. No, what's hard is figuring out how to get that sim from wherever they are right this minute to where they need to go. So, it's 8:30AM time to go to work, where is he, ok where does he need to go, now how do I get him there? Oh, and how do I get the other 15,000 sims to where they should go? And how do I prevent them from all gridlocking in the same intersection? <computer explodes>

Am I wrong on this thought process here? I'm tired, but it certainly seems to me that pathfinding would be the single most difficult part of tracking every sim in the game. And if that is the case, they did a very, very, very poor job of things. In fact, if I'm right, then the entire POINT of this engine would be to achieve some glorious pathfinding utopia and that's not what we have here at all.


EDIT...
... how did this make it out of QA?
I doubt it did. Most probably inflexible release date and programmers not able to finish in time. Also, possibly lack of the necessary expertise to solve problems like this.

Hmm, it just occurred to me I might not properly understand the expression "make it out of QA" :blush:
 
So the game is fundamentally flawed to its core, such that not even a myriad of patches and expansions can fix it. Shame.
 
Mainly adding to my discussion with Warpus earlier, I think the points made by this poster below are on the money.

My exec summary (TLDR): He suggests the game is constantly under pressure to do a lot of path-finding tasks (as so many different aspects of the game use agents, and agents require pathing). It's also using a really bad implementation of path-finding, possibly incomplete A*. Importantly, he suggests the small city sizes might be to either prevent the apparent problem getting even worse than it is, or worse, to hide it.



Source: http://answers.ea.com/t5/Miscellane...c-are-broken/m-p/745938/highlight/true#M37874





EDIT...

I doubt it did. Most probably inflexible release date and programmers not able to finish in time. Also, possibly lack of the necessary expertise to solve problems like this.

Hmm, it just occurred to me I might not properly understand the expression "make it out of QA" :blush:

QA is Quality Assurance.
 
I've found this to be a very interesting game. Not because I've played it - I haven't - but just reading this thread, the aspirations, cool ideas, and the myriad of issues since launch.

Interestingly, if the Wikipedia article on Sim City 3000 is accurate, they took essentially the opposite decisions in its development. Maxis was originally taking it in a 3D direction (circa 1997), with the associated graphical overhead and all. Then EA bought Maxis, stepped in, and realized that was going to be a performance nightmare. So instead they switched to improved isometric graphics from 2000, with bigger maps and more features being the selling points. And they delayed the game past the Christmas season to make sure it was a good quality on release.

I doubt it did. Most probably inflexible release date and programmers not able to finish in time. Also, possibly lack of the necessary expertise to solve problems like this.

Hmm, it just occurred to me I might not properly understand the expression "make it out of QA" :blush:

In the sense Maniacal means, it's basically, "receiving final signoff from QA after development is complete that it's a high enough quality to ship". So I think you understand it well enough. Although, sometimes a product can get shipped despite QA advising against it.

There are a several reasons something can "make it out of QA" in a poorly finished state, including:

- The company is unaware of the problems, and the QA'ers don't catch them. This could be due to not having enough QA'ers, not giving the QA'ers enough time to QA the project, or possibly internal process issues.
- The company feels that the problems are small enough they can be patched later, but they prove to be more important than expected.
- The QA'ers find an unexpected last-minute issue, but management keeps the original release date against their advice.
- The company realizes well in advance that they won't have the product polished in time, but management dictates that it will ship on time. This leads to either cut features, bugs of varying seriousness, or both.
- The developers are adding new features too close to the release date, and some of these new features introduce new bugs that aren't caught. This is related to the previous one, but can also happen even when the product is on time.

In some cases, such as the server issues, you can substitute "performance testing" for QA. I can't imagine there weren't some people at EA who saw that disaster coming - it probably was decided by management not to get more servers in the name of saving money. This probably falls closest to the third category; they were able to add more quickly enough that release date probably wasn't the cause here.

Pathfinding and many of the other smaller issues likely fall in the first two categories, with some time pressure as well. I can't speak to how big of a problem it is here, but I can't recall the issues mentioned in The Sims, despite playing it a lot back in the day. And it's been established that this wasn't a huge priority in SC4, either - it's probably kind of like the AI in Civ - old-time fans want it improved, but it's never really that good.

Small cities, it's probably a design decision to keep complexity in check. I kinda doubt that it was a last minute decision to shrink the city size.
 
Yeah, exactly. Makes me wonder what other reasons they might have had to make the maps that small. "Hey, if we go down the extreme agent route, we'll need small maps. Then it'll be easier to __________" ?

_______ issue a patch that reduces the number of agents even further* and sell them DLC which allows bigger city tiles.


*(which they have already done since launch, allegedly )
 
While it doesn't answer your question directly, the following post, in the context of poor AI pathfinding, explains a lot about the number of agents and their effect on the traveling salesman problem.

http://community.simtropolis.com/to...finding-inherently-broken/page-3#entry1343415

That's a fairly good post, and it brought me to a rant I have about SC5:
The roads are flexible but the buildings are still fairly rigid. Hence there is not much of a point to the flexible roads.

But back to agents, for the context of Simcity 5 I would say they are basic entities in the simulation that travel and make simple decisions based on a few parameters. An agent is not necessarily a 'sim' (though they get agents too). For example, they use water-agents to go along roads delivering water to houses, and this is how the water supply works in-game. You never see them though unless you enable the water data map.

There's a bit describing what agents are in one of the very earliest official blogposts about the game.
EDIT... Here's also a slideshow from a GDC presentation about the game, though it gets technical quickly and some of the slides are examples that are hard to interpret without the video
 
On faked population sizes...

From a reddit user:
source: https://gist.github.com/anonymous/5133829#file-simcityui-js-L8510, linked from http://en.reddit.com/r/SimCity/comments/1a6oeo/proof_that_the_game_is_misleading_regarding/

Part of the UI code:
Code:
simcity.GetFudgedPopulation = function (a) {
  a = "undefined" !== typeof a ? a : simcity.gGlobalUIHandler.mLastPopulation;
  if (500 >= a)
    return a;
  if (40845 < a)
    return Math.floor(8.25 * a);
  a = Math.pow(a - 500, 1.2) + 500;
  return Math.floor(a)
};
Spoiler graph :
simcity5fakedpopulation.png

The area between the two curves are what some players are calling "phantom" population because they aren't really sims in the simulation but rather 'padding' to make the towns look more like... cities.
 
Back
Top Bottom