Kayoz
Posts: 1516
Joined: 12/20/2010 From: Timbuktu Status: offline
|
quote:
ORIGINAL: Raap Thanks for the writeup, some interesting stuff there. Still though, it's not all just layers and transparency which requires calculations, is it? I mean, let's take a pretty straight-forward and simple example. Here is a 1920*1200 resolution, or 2.3m pixels, wallpaper: http://www.ewallpapers.eu/view_wallpaper/san-francisco-bay-1920-1200-2499.html If I open the task manager to watch CPU usage while scrolling up and down on that picture, I can get my usage as high as 35%( 20% for Opera, 15% for the CSR process). This is a qx9650@3.8ghz and it's idling at 0%. Now, that usage is actually higher than it gets in Distant Worlds, which is as you mentioned mostly single-threaded. Of course, Distant Worlds uses rather low res images; 250*250, or 62k pixels, I believe, for most ships. But still, do a hundred of those ships on the screen at once and it gets difficult. Now do 200 AoE weapon effects at once( which are also 62k pixels, + heavy transparency), and is it really a wonder we have performance problems, potentially bad coding aside? It's these problems that I think hardware acceleration would practically eliminate, seeing how much faster the GPU could do this stuff than the CPU. This would again of course free up the CPU to put even more power into AI and other stuff, quite likely lessening the need for multi-threading, which I hear is very demanding to program( or as you said, many devs just don't know how). Or am I going about this completely the wrong way, seeing as I've never programmed graphics? You're looking at two completely different software packages, and expecting similar behaviour. You might as well compare DW to Big Blue - and say that Big Blue would run remarkably faster if it used hardware acceleration. However, chess calculations aren't something that a GPU can handle (or not without some pretty interesting tinkering) - but that's essentially what you're assuming. You pointed to an image you loaded to compare results - on the assumption that a single-layer image would be the simplest and require the least handling. But did you check the memory usage? My Photoshop CS4 goes from 90meg memory usage to about 190meg, on loading a 2meg picture. Clearly there's a heck of a lot more going on in Photoshop than loading the bitmap into memory. What is it doing, how is it behaving? You'd need a profiler and the source code to say for certain. Similarly, what's taking up the most CPU time in DW? You'd need to go through it with a profiler to see what's taking up the most CPU time - otherwise, you're just guessing. As an aside, the generalization you're making is nothing new. Aristotle categorized bats as a type of crow. It's black, it flies, it has wings - so a bat is a type of crow, right? His observations stood for many years, till people finally took a closer look and realized that bats are mammals and not avian. What happens in DW when you're watching a battle? 1. Attempt to close with target. Since there's no pathfinding, nothing to go around, it's fairly simple here. 2. Fire any (if any) weapons in range). 3. Display graphics for weapons fired. #2 and #3 might take a while, depending on how they handle the actions. Does DW raytrace from origin to target and then calculate the positions to successively display the weapon firing (eg: missile, beam or whatever)? Does it individually rotate and scale each image to orient it on the path? If this is done inefficiently, and you have 100+ ships shooting, it could be an enormous amount of work. 4. Locate any other potential targets in range and fire remaining weapons. In addition to the steps above, now you're looking at the coordinates of each and every object in the system - from fighters to stations, ships, you name it. How does it choose, how does it prioritize? I suspect that the coders didn't test their combat code against hundreds of ships going up against each other - so the code here is very unlikely to be optimized for the situation you describe. 5. Assign damage to targets, display shield glow, update ship graphics for damage taken. Again, this step can be time consuming. DW tries to place the shield glow for the direction of the attack - so with hundreds of attacks going off - you might be dealing with horrifically inefficient calculations, which are in most cases good enough - but your testing parameters display as being inefficient. Now, there's the AoE weapons, which go through the above steps, but since they may effect any/all ships in range, what then does DW do? Does it bubble sort through the ships and assign damage till it hits the range limit? It might be fine with 10 ships - but 100, and bubble sort is horribly slow - but it might have been good enough and quick enough to code for the purposes they had in mind. So you have a lot of potential CPU hogs right there - taking place hundreds of times a second. Will utilizing the GPU help this? Nope, it'll have nothing more than a tiny effect - the vast majority of the work is happening before the image is even being blitted to the video. And what of the video performance? DW doesn't have to do any graphics work if you aren't viewing the combat, right? So if the whole combat is taking place around the sun, and you put the camera close up on some asteroid on the edge of the system - then ostensibly the performance should shoot up, right? But does it? And what is the performance if you have hundreds of ships peacefully floating around, as opposed to shooting each other? Given the engine sprites, the rotation animations and all - it shouldn't be too much different to have a load of ships flying around, as opposed to half the number shooting each other. Do you see how the graphics performance is only the tip of the iceberg? Nothing I've seen has identified GPU usage as being a bottleneck in DW performance. Would it benefit from it, assuming it isn't using any hardware acceleration? Probably - but how much might it affect the situation you described? 1%? Perhaps 2? Once again, you're making a large number of assumptions which you don't have nearly enough data. It's like taking a look at someone who has a rash, and saying it's such and such. Is it an insect bite? An allergic reaction? A scrape? Or is it skin cancer? Bubonic plague? You have no data to support your conclusions - all you have to go on, is the "I see inflamed skin" case. Perhaps you can see now, how your acceleration argument is far too premature.
|