Elandryl wrote:I don't think that Prison Architect has many reasons to be far more taxing for the CPU than a game handling thousands of units in real time.
Suppose that an addition or comparison takes no time, a multiplication takes 1 second, and that an O(n
) algorithm takes n
seconds (obviously, the actual times for each of these operations will vary, but the ratios are approximately correct for large n
). The Harvest "pathfinding algorithm" consists of an addition and a multiplication. Thus the CPU requires (0+1)*(k
) = k
seconds to compute. That is, it would take 1,000 seconds to compute paths each frame.
The pathfinding algorithm that Prison Architect uses, A*, is (again, I believe) O(n
), where n
is the number of squares on the map. The smallest map is 80x80=6400 squares. Thus computing paths for k
units requires 6400*k
seconds to compute. That is, it could take 640,000 to compute paths for 100 units in each frame (does PA recalculate paths every frame? Probably not---but it would still have to wait 64 frames between recalculations to approximate the Harvest "pathfinding" efficiency). Now, the big-O notation refers to asymptotics, i.e. how the time scales in the limit, and I believe that this is a "worst case" estimate, but the general orders of magnitude should be approximately correct. Please compare 1,000 to 640,000. Do you understand now how complex algorithms can require much more CPU power?
To be fair, the more intensive part of Harvest might be target selection. Suppose that each tower targets the nearest unit. Thus for each tower, the game needs to go through each enemy unit, compute distance (which can be done with two multiplications), and do a single comparison for each enemy unit. CPU time would come down to 2*(towers)*(enemy units). With 1000 enemies and 100 towers, this would be about 200,000 seconds (which begins to approximate the above estimate for PA---the orders of magnitude are similar).
Moreover, while it has been years since I played Harvest, and I don't really recall the details very well, but I do have a distinct memory of it lagging incredibly badly when there were a lot of units on the screen. I can't possibly tell you how many units (either my towers or enemy units) caused problems, but it is clear to me that Harvest can and does tax a modern CPUs as much as Prison Architect (at least, under the right circumstances).
It should also be noted that IV have produced a game (two games?) in which hundreds, if not thousands, of AI units require pathfinding: Darwinia and Multiwinia. However, like Harvest, the maps are fixed and the paths are straight lines to an objective (either the place to which the player ordered a unit or a waypoint as defined in the map). The comparison between Darwinia and Harvest might be apples to apples. Between Harvest and Prison Architect? Apples and oranges.
Elandryl wrote:Or than any RTS handling hundreds of units in real time, like Starcraft II or the far more taxing Supreme Commander. No, sorry, but modern CPUs should all be able to handle Prison Architect's engine quite smoothly. Us beeing debating about optimisation is the proof they don't.
I have not played the most recent Starcraft, nor have I played Supreme Commander, but I have played the original Starcraft. First off, you are pretty limited in terms of units. Any one player gets---what---200 control, max? Unless you go out of your way to manufacture zerglings, you can have at most 400 units at any one time (overlords and other flying units don't count, as their pathfinding is trivial, as per Harvest). Moreover, the player can only select 12 units at a time, the maps are static, and the AI does not have to select objectives (more or less---patrols could muddy this, and units will chase enemy units if they get close enough, but these are boundary cases). There are a lot of easy optimizations that can take advantage of all of these factors which may not be possible in Prison Architect. Again, apples to oranges, though the comparison is a bit better in this case.
As I have said over and over again, I am not disagreeing with your basic point that Prison Architect can get pretty laggy and that quite a bit of optimization really does need to happen before the game can be considered complete. You won't get any argument from me on that point. Many ideas for optimization have been floated above, some of which are quite interesting. Rather, my point is that you shouldn't expect Game X to perform well simply because Gamy Y performs well, and Gamy Y is superficially more complicated than (or similar to) Game X.