Sirius

General discussion about anything related to Transcendence.
george moromisato
Developer
Developer
Posts: 2998
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

AssumedPseudonym wrote: I never would have guessed that star glow, of all things, was such a resource hog. Neat.
 Speaking for myself and my own decidedly underpowered setup, there is a noticeable drop in performance when I’m on the map, even when I’m not in a binary system. I haven’t run into a binary system in quite a while, but I do remember it being considerably worse than usual. It’s still generally playable, but if there are eleventeen kerzillionty Ferians in a binary system, I have to have pretty much nothing but Transcendence running for more than a brief check of the map to keep everything from lagging to unplayability.
It surprised me too, but it makes sense:

At 30 frames per second, we need to paint in 33 milliseconds to avoid lag. The glow can sometimes be 1,200 pixels across, totaling more than a million individual pixels. That means each pixel must paint in less than 33 nanoseconds to avoid lag (and that's assuming that nothing else is taking up time).

A 2 GHz processor takes 0.5 nanoseconds per instruction. That means we only get ~60 instructions for each pixel (often less because some instructions, like division and multiplication, take more than one cycle). Painting a glow pixel involves both blending the color with the background AND computing the strength of the glow at a given position (which means multiplication and division).

Now imagine doing that for TWO suns.
User avatar
Atarlost
Fleet Admiral
Fleet Admiral
Posts: 2391
Joined: Tue Aug 26, 2008 12:02 am

If glow radius is computed first and then glow only computed if the player is inside it binaries would be no slower than normal systems since there are never close binaries (and if they were close enough it would be possible to get around the issue by putting the combined glow on an invisible object at the gravitational center). In fact, there's no observable gradient outside map view: it seems to paint the background a solid color dependent on the distance from the ship to the star. That shouldn't be nearly as bad as generating an entire gradient for the map view.

The map view should be more focused on being a map and could do without the glow just like it's not trying to display all the stations as more than dots.
Literally is the new Figuratively
george moromisato
Developer
Developer
Posts: 2998
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

Atarlost wrote:If glow radius is computed first and then glow only computed if the player is inside it binaries would be no slower than normal systems since there are never close binaries (and if they were close enough it would be possible to get around the issue by putting the combined glow on an invisible object at the gravitational center). In fact, there's no observable gradient outside map view: it seems to paint the background a solid color dependent on the distance from the ship to the star. That shouldn't be nearly as bad as generating an entire gradient for the map view.

The map view should be more focused on being a map and could do without the glow just like it's not trying to display all the stations as more than dots.
I think (if I understand what you're saying) this is already how it works. There is no gradient outside of map view--we just paint a solid color based on distance to the nearest sun (that's a cheap computation and filling with solid color is also cheap--one or two instructions per pixel).

The problem (I believe) is only in map view. And to fix that I think I can compute the glow once and store it in a bitmap. Then we can just do a copy for all subsequent paints.
User avatar
Atarlost
Fleet Admiral
Fleet Admiral
Posts: 2391
Joined: Tue Aug 26, 2008 12:02 am

Also, why do you need to blend the map glow with the background? There's no starfield to blend with in map view, just put the glow in the bottom layer where everything else is #000000 black anyways, then overdraw with the map lines. Nobody's going to notice that the lines aren't blended with the glow.
Literally is the new Figuratively
george moromisato
Developer
Developer
Posts: 2998
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

Atarlost wrote:Also, why do you need to blend the map glow with the background? There's no starfield to blend with in map view, just put the glow in the bottom layer where everything else is #000000 black anyways, then overdraw with the map lines. Nobody's going to notice that the lines aren't blended with the glow.
Yeah, that makes sense too. I would need to do an extra check in case two suns overlay, but other than that, I think it would be a great improvement.
User avatar
pixelfck
Militia Captain
Militia Captain
Posts: 571
Joined: Tue Aug 11, 2009 8:47 pm
Location: Travelling around in Europe

george moromisato wrote:
Atarlost wrote:Also, why do you need to blend the map glow with the background? There's no starfield to blend with in map view, just put the glow in the bottom layer where everything else is #000000 black anyways, then overdraw with the map lines. Nobody's going to notice that the lines aren't blended with the glow.
Yeah, that makes sense too. I would need to do an extra check in case two suns overlay, but other than that, I think it would be a great improvement.
If you decide to spend some time on the system map and how it is drawn, maybe now is the time to also tackle the overlapping grid issue in binary star systems as reported here and here (among other places).

Cheers,
Pixelfck

Edit:
an inline screenshot for those who dislike clicking on links:
Image
Image
Download the Black Market Expansion from Xelerus.de today!
My other mods at xelerus.de
Post Reply