Performance & Optimization Issues

General chit-chat and minor questions about just about anything

Moderator: NBJeff

User avatar
Medu_Salem
level1
level1
Posts: 46
Joined: Fri May 16, 2014 6:42 pm

Performance & Optimization Issues

Postby Medu_Salem » Wed Oct 22, 2014 9:02 am

I know it has been said countless times, but I will say it again because this is becoming a notorious and serious issue throughout the course of the past months and it is becoming worse with every new update, especially Updates 20 to 25:



The performance/optimization of the game is quite abysmal to be honest. And with abysmal I mean virtually unplayable at a certain point. Even with my Core i7 Quad with 3.2ghz, 8GB RAM it feels like the game is about to break down any moment. :roll:



And it already starts when I expand my map once. I don't even try to expand it any further anymore because that's impossible ever since Update 20 without hitting serious performance problems. The same goes for the amount of prisoners once I go beyond 150-200. In February it was quite possible to have 400+ prisoners without any serious hits on performance, but I guess those times are over now. If I'm hitting the 100 mark I'm already starting to notice little hitches and lags and once I'm at 150-200 everything is in slow motion with the speed modifiers not doing anything anymore. Adding a map expansion at that point renders the map unplayable and it is better to start over.

For the laughs I loaded one of my 400+ prisoner maps from March... and maaaan this sucks. A single day on the clock takes at least a reallife hour to pass if not more. The worst about it is the annoying input lags. I've to click about 10 times before the game recognizes it once. It makes me pull my hair out. So basically the only thing I could do is abandon the savegame because it is unplayable. :D

On a sidenote the autosave is now much faster ever since the contraband stuff gets chopped off at some point, but it still could be faster. Still takes like 5-10 seconds (but much better than the 40-60 seconds before that).



The best experience to be had is on an un-expanded vanilla map with a maximum of 100-150 prisoners. Everything beyond that is becoming extremely tedious and annoying, if not unplayable. I don't know what hardware spec would be required to go beyond that but it seems like pretty crazy.



I can live with some limitations because the added complexity per prisoner and new features make up for it... but hell the game has become quite unoptimized in just a few months of development. How is one to enjoy new features if the game plays like a slide show? (I'm not exaggerating. It is a slide show with 200+ prisoners on an expanded map). The performance hitches are now even noticeable on mid/highend computers and that's never a good sign. :o



I wouldn't mind if one of the next bug bashes is just about optimizing the game because I don't know how much more stuff the game can take before it boils down to having a prison on a small map with only 50 prisoners at maximum. :lol:
User avatar
Drakexz
level2
level2
Posts: 82
Joined: Tue Aug 05, 2014 7:23 pm

Re: Performance & Optimization Issues

Postby Drakexz » Wed Oct 22, 2014 6:04 pm

I currently got a prison with 261 inmates and 427 staff people. I get ~20-22fps during the night and ~17-19 fps if everyone is running around. (fully zoomed out map, largest default map, no land expansion)
The fast forward button >>> still has an affect but not the same as with a much smaller prison.
So its still playable but i wont expand it unless its working better (bugs / performance)

I'd love to play my ~1200 inmates prison but it just lags way too much. (3 - 6 fps)


Just remember, its still a BETA and not a finished game. They will get to it once its necessary.


(My system: i7 3770k 3,50 GHZ, 16 GB ram; besides this, it doesnt even use all the power it could have)
User avatar
Medu_Salem
level1
level1
Posts: 46
Joined: Fri May 16, 2014 6:42 pm

Re: Performance & Optimization Issues

Postby Medu_Salem » Wed Oct 22, 2014 8:36 pm

Drakexz wrote:I currently got a prison with 261 inmates and 427 staff people. I get ~20-22fps during the night and ~17-19 fps if everyone is running around. (fully zoomed out map, largest default map, no land expansion)
The fast forward button >>> still has an affect but not the same as with a much smaller prison.
So its still playable but i wont expand it unless its working better (bugs / performance)

I'd love to play my ~1200 inmates prison but it just lags way too much. (3 - 6 fps)

(My system: i7 3770k 3,50 GHZ, 16 GB ram; besides this, it doesnt even use all the power it could have)


Yeah I get similar frame rates with similar prisoner/staff counts but most of the time I'm using less staff than prisoners since my prisons fare pretty well even without a ton staff. Prison labor for the win. ^^

My fps drop below 10 with 450 prisoners and about 200 guards and probably 100 other staff members. The lag is horrendous compared to how it felt back in February/March.

I guess most of the performance issues are probably related to the pathfinding becoming a serious problem for this many entities. Adding land expansions makes everything even worse because of the routes getting even longer.

Drakexz wrote:Just remember, its still a BETA and not a finished game. They will get to it once its necessary.


Isn't it still in Alpha? :D

At least they should have a look into this issue soon because otherwise it may get out of hands. It is already preventing me from returning to play most of my earlier prisons because they are all far beyond 200+ prisoners and thereby feeling like hell (not only to the prisoners but also to me because of the lag).

If the performance degradation keeps the pace it is going now then in 6 months from now we won't be able to have more than 100 prisoners without hitting serious performance issues and in a year from now you will only be able to have a handful of prisoners knowing them all by their name. xD
User avatar
blipadouzi
level4
level4
Posts: 567
Joined: Fri Sep 06, 2013 5:35 pm
Location: Canada
Contact:

Re: Performance & Optimization Issues

Postby blipadouzi » Wed Oct 22, 2014 11:51 pm

I've said it before and I'll say it again... it's a matter of simple math. The more features that get added the more calculations per second your PC has to do... and this grows exponentially with each prisoner. A simple prison with 200 prisoners can have 170,000 lines of code int he savefile alone... now imagine the PC having to manage all that data. Movement, pathfinding (2 completely different things), hunger, sleep, actions, cooks, deliveries, servos, contraband. etc, etc...

It's a lot of data to compute. I go into details and calculations and such in another post I replied to a couple of weeks ago... I suggest you search for it if that sort of thing interests you.
rlgjiojgboirtjnb
level2
level2
Posts: 84
Joined: Fri Dec 13, 2013 10:30 am

Re: Performance & Optimization Issues

Postby rlgjiojgboirtjnb » Wed Oct 22, 2014 11:56 pm

I totally agree with the performance issue and that they should become a priority soon (esp. multi-threading, this kind of game screams for it! and its very annoying to have 4 of 6 cores do absolutely).

But the reason why i write is this:
Drakexz wrote:I currently got a prison with 261 inmates and 427 staff people.


Holy Shit. Is that a prison or a 5* hotel complex?!?

Wont solve the performance issues, but to improve performance at least a bit, maybe reduce your staff numbers to something more reasonable? My current 400er prison (mixed) has roughly 170 staff and thats not even properly optimized and could do with less if i tried.
User avatar
Drakexz
level2
level2
Posts: 82
Joined: Tue Aug 05, 2014 7:23 pm

Re: Performance & Optimization Issues

Postby Drakexz » Thu Oct 23, 2014 5:51 am

Medu_Salem wrote:Isn't it still in Alpha? :D

My bad. It is in Alpha. Don't know why i wrote Beta.

rlgjiojgboirtjnb wrote:Holy Shit. Is that a prison or a 5* hotel complex?!?


I got only max security prisoners, no room restrictions, 4 workshops and many staff members just because i want everything to go faster. (more workmen so jobs get done faster, etc.)
Also, i've added only 3 armed guards at the exit, so i need a few more normal guards inside the prison. (and im still making around 70K profit a day)

i could sack quite a few guards etc, but there's just no need for it.
User avatar
Medu_Salem
level1
level1
Posts: 46
Joined: Fri May 16, 2014 6:42 pm

Re: Performance & Optimization Issues

Postby Medu_Salem » Thu Oct 23, 2014 6:30 pm

blipadouzi wrote:I've said it before and I'll say it again... it's a matter of simple math. The more features that get added the more calculations per second your PC has to do... and this grows exponentially with each prisoner. A simple prison with 200 prisoners can have 170,000 lines of code int he savefile alone... now imagine the PC having to manage all that data. Movement, pathfinding (2 completely different things), hunger, sleep, actions, cooks, deliveries, servos, contraband. etc, etc...

It's a lot of data to compute. I go into details and calculations and such in another post I replied to a couple of weeks ago... I suggest you search for it if that sort of thing interests you.


I understand that the more complex each prisoner gets the more computation time it takes for each single entity... but I find it hard to believe that the game is already scraping the limits of performance optimization, especially when it boils down to multicore processing of many of those entities in parallel. At least I hardly see the game using any multicore processing at all. It just hogs one core for most of the time which is just a plain waste of available resources, especially with Quad Core processers being near-to-standard already.

It may be hard to optimize the code within a single prisoner, because I understand that there's a maximum amount of parallelism that may be exploited within one single entity if there's any possibility at all; but I believe that as long as the prisoners don't interact with each other on every single tick of the game calculation and rather only on occasional interceptions that there's still room to treat each prisoner in parallel and thereby increase the amount of achievable parallelism, especially if this is the bottleneck we are experiencing currently.

At least I've seen many other games with this many active entities (if not much more, like 10000 active entities and beyond, which is something I don't even demand for prison architect because it would be quite hard, if not impossible to micromanage such a monstrosity of a prison) and even many of them having way complexer features for each entity. On top of that many of those games are also having all sorts of other things ongoing like physics and 3d graphics and still perform much better than Prison Architect.

So basically I refuse to believe that this is it and that there's nothing that can be done about the performance degrading thanks to new features, because this will lead to an unplayable game over the course of development, which would be rather sad.

Drakexz wrote:I got only max security prisoners, no room restrictions, 4 workshops and many staff members just because i want everything to go faster. (more workmen so jobs get done faster, etc.)
Also, i've added only 3 armed guards at the exit, so i need a few more normal guards inside the prison. (and im still making around 70K profit a day)

i could sack quite a few guards etc, but there's just no need for it.


I've loaded one of my earlier prisons yesterday. It started with about 450 prisoners from March (with no reputation) and has a maximum of 560 max sercurity prisoners now (so about 100 new guys with reputations)... and I'm able to handle them with 190 guards (no armed guards at all). Every single cell has it's own dedicated shower so I'm able to avoid shower fights in the mornings, so the cells are 3*5 in size. I've filled 8 workshops... and I'm making a profit of 150k a day... xD

But I have to abandon the map because firstly it's running at 5-10fps and secondly... the new reputation system making things rather challenging.

With the new reputation system I got at least 2-3 dead bodies every other day... because I have no dedicated area for SuperMax and no Protective Custody. So the incoming snitches (new guys which have already the snitch reputation) get killed all the time because I can't put them elsewhere and the Legendary scumbags are causing trouble all the time and I can't segregate them as well because of the way I designed that prison.

At one point I had 3 legendary guys together with 2 other guys which have 5 stats as well... 4 of them having the "extremely volatile" rep and the 5. guy having the instigator rep. It was quite a hellride:

I know that some guys have the arsonist trait but I actually never had anyone to start a fire in the past 10-12 months of playing Prison Architect, but yesterday when I really got into playing again with this 560 max-sec prison I had 2 fires in about 4 nights... and yes they only did it during the nights and only at the same time when some other guys on the far side of the prison tried to dig their way out as if it all was a planned distraction (Coincidence? Don't know...). The first time I didn't even know what was happening (I heard the fire but the game didn't tell me anything about it until I zoomed out and was "WTH?!") and they managed to burn down a cellblock containing 16 cells. The second time they still got 6 cells ruined. Lesson learned... placing sprinklers makes sense now. I guess this is something that is quite dangerous now with the new reputations because I never had it happen before the reputation update and now twice in a row in a short period of time.

The 3 legendary guys were troublesome too... they always started fights and they always got away somehow. They always got other prisoners into the solitary but the legendary guys themselves often got away and my guards were too dumb to realize that even it happened before my own eyes.

The guy with the instigator rep... woooow... I love it. He caused havoc when he got upset. He managed to get 50 prisoners into a fight against 10 guards... and it got at least 2 guards killed and 5 inmates in the process. This is also when I learned about the copkiller reputation because 3 of the involved dead inmates had that trait. I didn't have quite enough solitary cells to hand out punishments so this really hurt the economy for about 3 days. :P



I haven't had this much fun in Prison Architect for a very long time... despite the major lag issues I'm experiencing. So I can't wait for even more havoc and difficulities to be implemented because this is what makes the game fun once the prison is finished.

Next time I will try and build a prison with segregation and all types of security levels... I always wanted to do that but because of the bugs and limitations (kitchens/canteens mostly but also laundry and classrooms/workshop programs) I never actually did it.



Still don't know what to do about the copkiller rep because no level of segregation will ever prevent the guards from killing those guys once they are in a fight... so I suppose the devs did not implement anything to counter that problem yet?

Like for example a better guard system with good/neutral/bad guards (also based on traits/reputation one can find out), where the bad guards will surely beat the copkiller to death while the good guards will try to protect even the copkillers and a way to deploy the good/bad guards in a manner that makes sense and the neutral guards will either not care what's happening or will chose a side. At least there needs to be a way to prevent firing guards all the time (like a contract that you have to keep the guard for 20-30 days and the only exception being when you are in a financial crisis where the game will pick a random guard that is fired so that you can't cheat the system) because that's something that's flawed since the guards have to take the tazer course and maybe failing. Just firing the guard and getting a new one maybe gets around the limitation since the new guard maybe passes the test.
User avatar
Drakexz
level2
level2
Posts: 82
Joined: Tue Aug 05, 2014 7:23 pm

Re: Performance & Optimization Issues

Postby Drakexz » Thu Oct 23, 2014 7:30 pm

All of my prisoners have a arrived after the last update, so many got a reputation and currently im good for more than 7 days. No deaths or any other incidents which would count for loosing the money benefit.
With all the guards around, prisoners get tazered before they can even start a fight. Besides this, i like to keep around 30 to 50 guards without jobs, so shakedowns can be finished quicker.

So incidents are quite rare and i'd like to keep it this way.
Thats my current layout:
Image
A few more screenshots, just view the ones from today.
http://steamcommunity.com/id/drakexz/sc ... &view=grid

I'd love to create a prison with a separate wing for the different security levels, but it just doesn't work with the current version.
User avatar
xander
level5
level5
Posts: 16869
Joined: Thu Oct 21, 2004 11:41 pm
Location: Highland, CA, USA
Contact:

Re: Performance & Optimization Issues

Postby xander » Fri Oct 24, 2014 4:49 am

Medu_Salem wrote:I understand that the more complex each prisoner gets the more computation time it takes for each single entity... but I find it hard to believe that the game is already scraping the limits of performance optimization, especially when it boils down to multicore processing of many of those entities in parallel. At least I hardly see the game using any multicore processing at all. It just hogs one core for most of the time which is just a plain waste of available resources, especially with Quad Core processers being near-to-standard already.

Actually, the number of entities is not really the cause for slowdown. The size of the map is. Each square on the map represents one node in a graph that has to be searched for a path any time that any entity wants to go anywhere. The amount of computation time required to search a graph for a path is exponential in the size of the graph. This means that larger maps are going to hit a bottleneck (even with fairly well optimized code---path-finding is a difficult problem). Adding more cores really isn't going to help that much, either---the linear boost in computation quickly gets swamped by the exponential growth of the problem.

Medu_Salem wrote:At least I've seen many other games with this many active entities (if not much more, like 10000 active entities and beyond, which is something I don't even demand for prison architect because it would be quite hard, if not impossible to micromanage such a monstrosity of a prison) and even many of them having way complexer features for each entity. On top of that many of those games are also having all sorts of other things ongoing like physics and 3d graphics and still perform much better than Prison Architect.

Without specifics, I am fairly certain that you are comparing apples to oranges. I've seen Darwinia/Multiwinia maps that do just fine with 2-3k DGs running around, I we know for a fact that IV can write games with thousands of units. However, the path-finding in Darwinia is much, much simpler---paths are straight lines to a waypoint, then they move along a graph. The graphs are *very* simple (complicated Darwinia maps might have 5-10 waypoints with a small number of edges connecting them). Apples and oranges.

Medu_Salem wrote:So basically I refuse to believe that this is it and that there's nothing that can be done about the performance degrading thanks to new features, because this will lead to an unplayable game over the course of development, which would be rather sad.

While some optimization is almost certainly possible, I don't think that the kind of improved performance that you are suggesting is really possible, and I don't think that throwing more processors into the mix is really going to help *that* much. We will probably see some improvement as development continues, but don't expect miracles.

xander
rsbennett00
level0
Posts: 4
Joined: Wed Oct 01, 2014 11:16 pm

Re: Performance & Optimization Issues

Postby rsbennett00 » Fri Oct 24, 2014 6:06 pm

So let's assume money is no object. What hardware would help performance the most? More ram?

For instance, here's the specs of my fairly old pc that I could upgrade:

i7-3770 3.4ghz
16gb ram
samsung 840 pro 256gb ssd
gtx 970
User avatar
knoest26
level5
level5
Posts: 1380
Joined: Thu Jul 11, 2013 6:55 pm
Location: The Netherlands
Contact:

Re: Performance & Optimization Issues

Postby knoest26 » Fri Oct 24, 2014 9:58 pm

the 970, ssd and ram shouldn't change much. (only if you care about saving and loading maps but you should be fine with what you have)

You could upgrade your processor to something at a higher clock speed but changing your hardware won't do much untill the game will use everything.
User avatar
Medu_Salem
level1
level1
Posts: 46
Joined: Fri May 16, 2014 6:42 pm

Re: Performance & Optimization Issues

Postby Medu_Salem » Sat Oct 25, 2014 6:10 am

xander wrote:Actually, the number of entities is not really the cause for slowdown. The size of the map is. Each square on the map represents one node in a graph that has to be searched for a path any time that any entity wants to go anywhere. The amount of computation time required to search a graph for a path is exponential in the size of the graph. This means that larger maps are going to hit a bottleneck (even with fairly well optimized code---path-finding is a difficult problem). Adding more cores really isn't going to help that much, either---the linear boost in computation quickly gets swamped by the exponential growth of the problem. [...]


I'm no expert of pathfinding issues, but I know from basic math that exponential graphs are ugly and I understand that there's only so much that can be done about finding a path for a single entity.



What I want to know about the issue though is... is the game trying to cramp all the calculations for 1000 entities on one single core or is it for example at least trying to offload all the prisoners evenly amongst all the available processor cores if it recognizes that one core couldn't possibly keep up with calculating the paths for all the entities in a timely manner anymore?

Because it seems pretty selfexplanatory that the pathfinding for multiple parallel entities can be seperated from each other thereby parallelized... and only synchronized once in a while when they are in close proximity to each other to perform interactions (like fights etc), which is rather rarely the case given they are spread all over the place for most of the time.

I'm asking that because most of the time it seems like the game is trying to cramp one core full with everything because I rarely see it using more than 25-30% of my quadcore no matter how large the map, no matter how many prisoners, at least when I have a look at the CPU usage history.

If at each turn of the game it does the pathfinding for only one entity at a given time, one after another then it is sure to suck in performance. :roll:



That's why I want to know it:

Is it just the summed up problem of all entities... because in this case... why doesn't it try to use mulitple cores and each core only for a couple hundred of entities so each entity gets more cpu time because they run in parallel, thereby finishing each turn of the game calculation up much faster?

OR

Is the lag I'm experiencing truly from ONE single entity, namingly the one that takes the longest to find a path for because he tries to get from one side of the map to the other... and there's nothing else that can be done to solve that problem anymore because all the other calculation and thereby lag depends on this one guy that takes ages to calculate? Much like the weakest element slows all the others?
User avatar
xander
level5
level5
Posts: 16869
Joined: Thu Oct 21, 2004 11:41 pm
Location: Highland, CA, USA
Contact:

Re: Performance & Optimization Issues

Postby xander » Sat Oct 25, 2014 6:27 am

Medu_Salem wrote:--==<snip>==--

Reread what I wrote. The problem is not that the code *cannot* be parallelized, but that parallelization probably won't actually give you the increase in performance that you would want. Suppose that you have four cores. Currently, the game runs most of the logic on one core and does the path-finding on another. So suppose that the path-finding were to be split across the remaining three cores. Great. You have three times the processing power. Unfortunately, it is unlikely that you will be able to house three times as many prisoners and/or staff (unless you are planning on doing it without expanding your map). Three times as many units require more space, and that extra space is going to require a great deal more computational time. Without knowing exactly how close we are to the asymptotic behaviour of the algorithms (nor how much overhead is eaten by the code handling the threading), the exact ratio is difficult to know, but, again, those two extra processors are going to get swamped by the larger map (linear growth in computational resources vs exponential growth in the complexity of the problem).

As I have said over an over again when this topic comes up, multithreading is not a panacea and is something of a red herring. Better optimization of the path-finding algorithm is a much better way to improve performance.

xander
User avatar
Medu_Salem
level1
level1
Posts: 46
Joined: Fri May 16, 2014 6:42 pm

Re: Performance & Optimization Issues

Postby Medu_Salem » Sat Oct 25, 2014 10:36 am

xander wrote:<snip>


I'm able to follow the logic to the part where the increasing map (caused by more space needed for prisoners) would consume the additional processing power... but that's a problem of its own if one wants to start this neverending race where no hardware will ever catch up with the increasing computational time. And that's obviously something you did not get when I already pointed out in OP that I do not want to increase the map by large amounts or have 1000-2000 prisoners or something ridiculous like that.

All I want is to have some of the performance back we had in January/February of this year.

Back then I could easily run a ~400 inmates prison on a single large map without expansions and without lags killing the whole experience. Without menus and mouseclicks lagging like hell, without everything running on 10fps. I did not play prisons with expansions for a very long time because I realized the game or my computer hit the cap of what's possible and I'm perfectly fine with those limitations. I wouldn't even want to have more than 400-500 prisoners anyways because bigger maps just make things confusing and unclear and therefore quite ugly to manage.

That's about that.



But what I'm not fine with is that I'm not even able to run a single one of my 400+ inmate prisons I made back 8 months ago on a large map without serious noticable performance issues. I don't know what happened but the performance is already feeling laggy at 200-250+ prisoners on every new large map prison I created ever since Alpha 24 and 25.

So what I want to request is just to remain the status quo of performance rather than having to accept that stuff is slowly degrading to the point where we can't even play maps from a few months ago because all of a sudden it would exceed the limits.

If remaining the status quo means that the devs have to do something about the pathfinding like you brought into this topic (I didn't even mention this before you said something about it) then fine... things have come to the point where they have added so much stuff to the game that it's already going on costs of the performance and some optimizations are needed now if the devs want to remain some of the experience of the earlier Alphas. I just noticed that the game doesn't fully utilize my processor so I thought there might be some optimization to look at however this may turn out. At least I don't like having to cut back on something that was running perfectly fine a few months back and now feels like a slideshow.

Maybe not all of this experienced performance degradation is due to pathfinding, but I don't know enough about that to make any assumptions or suggestions. At least it's not due to bigger maps because I play with the same maps I played before and I'm only creating maps with the same properties like I used in the old ones. It's also not due to more prisoners because I'm actually playing with only 2/3 of the prisoners I used to have back in February and it still feels worse than back in February.
User avatar
xander
level5
level5
Posts: 16869
Joined: Thu Oct 21, 2004 11:41 pm
Location: Highland, CA, USA
Contact:

Re: Performance & Optimization Issues

Postby xander » Sat Oct 25, 2014 3:00 pm

Medu_Salem wrote:All I want is to have some of the performance back we had in January/February of this year.

...

So what I want to request is just to remain the status quo of performance rather than having to accept that stuff is slowly degrading to the point where we can't even play maps from a few months ago because all of a sudden it would exceed the limits.

I kind of feel like you aren't really reading what I am writing. You were complaining that the game wasn't using every core that you have. I replied that spreading the load across multiple cores likely wouldn't actually help all that much and that there are better ways to improve performance. Complaining that the game performed better in January is a complete non sequitor, and is not something that I have commented on at all. My only point has been (and remains) that parallelization is not a performance fix-all.

In terms of what the performance was like earlier in the year, you are, of course, free to download the earlier versions of the game and play them. I suspect that you are not doing so because features have been added since then which require more processing power. But since the game is about more than simply pushing out frames as quickly as possible, I would suggest that (1) IV already know that they need to do some optimization and (2) they are likely to wait a while to do it (premature optimization is generally a bad idea; I would expect a great deal of optimization to occur during the beta phase of the game).

xander

Return to “General”

Who is online

Users browsing this forum: No registered users and 6 guests