Author Topic: HUD Shield Icon Limit  (Read 5734 times)

0 Members and 1 Guest are viewing this topic.

Offline Rampage

  • Son Of Rampage
  • 211
  • Urogynaecologist
Hello FSO Team,

Greetings from the Inferno Team.  We have encountered an issue where the game would crash when using too many (~180) HUD shield icon entries.  Is there a limit to how many shield icons allowed?  If so, then is there a way to bypass that limit (feature request)?  Thanks for your consideration.

Humbly,

Rampage
INFTeam

 

Offline Iss Mneur

  • 210
  • TODO:
The current limit appears to be 80 (yes, 80, not 180).  It should be fairly easy to bump to ~200, but this limit at 80 has stood for more than 8 years. What exactly are HUD Shield Icons and why do you need so many?
"I love deadlines. I like the whooshing sound they make as they fly by." -Douglas Adams
wxLauncher 0.9.4 public beta (now with no config file editing for FRED) | wxLauncher 2.0 Request for Comments

 

Offline Trivial Psychic

  • 212
  • Snoop Junkie
That's the little icon on your hud that displays a top-down view of a ship with its shield quadrants and their strength.  We need 'em because we've got four species worth of shielded craft with the potential to add more to each.  Could this no be made dynamic like so many other limits?
The Trivial Psychic Strikes Again!

 

Offline Rampage

  • Son Of Rampage
  • 211
  • Urogynaecologist
It'll be awesome if it could be bumped.

R

 

Offline Iss Mneur

  • 210
  • TODO:
That means you have more than 20 (45 at the level you are running into issues at) shielded ships per faction?  Or is there something else going on that I have missed?

Dynamic is decidedly less easy.  More than ~200 (dynamic or not) makes it more difficult as well.  I am trying to quantify what requires this many because it appears from my quick dive in the code last night that this is basically one per ship which means the absolute max for these icons would be 250 (the ship class limit).
"I love deadlines. I like the whooshing sound they make as they fly by." -Douglas Adams
wxLauncher 0.9.4 public beta (now with no config file editing for FRED) | wxLauncher 2.0 Request for Comments

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
That's the little icon on your hud that displays a top-down view of a ship with its shield quadrants and their strength.  We need 'em because we've got four species worth of shielded craft with the potential to add more to each.  Could this no be made dynamic like so many other limits?

where you have bitmaps you are opening another can of worms as far as making the system dynamic goes. more icons means less slots available for other bitmaps (like textures). a hud icon is 5 frames iirc, so it would use up 5 texture slots each. i very much doubt bumping the texture limit is on the table, but still bumping the shield icon limit a little probably wouldn't hurt. 80 seems kinda low to me.

would it be possible to come up with a better procedural shield?
« Last Edit: December 05, 2011, 10:08:36 pm by Nuke »
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline headdie

  • i don't use punctuation lol
  • 212
  • Lawful Neutral with a Chaotic outook
    • Skype
    • Twitter
    • Headdie on Deviant Art
That's the little icon on your hud that displays a top-down view of a ship with its shield quadrants and their strength.  We need 'em because we've got four species worth of shielded craft with the potential to add more to each.  Could this no be made dynamic like so many other limits?

where you have bitmaps you are opening another can of worms as far as making the system dynamic goes. more icons means less slots available for other bitmaps (like textures). a hud icon is 5 frames iirc, so it would use up 5 texture slots each. i very much doubt bumping the texture limit is on the table, but still bumping the shield icon limit a little probably wouldn't hurt. 80 seems kinda low to me.

would it be possible to come up with a better procedural shield?

I would much prefer this, how about a table option somewhere to switch between the current square shield icons and a round one when using the "generate icon" flag. 

If you could add X,Y scaling to "generate icon" I would love you forever.
Minister of Interstellar Affairs Sol Union - Retired
quote General Battuta - "FRED is canon!"
Contact me at [email protected]
My Release Thread, Old Release Thread, Celestial Objects Thread, My rubbish attempts at art

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
those square icons are horrible. i tried to make a 3d shield icon for my own cockpit but never got it to work. but i have an idea for how to draw a shield icon in 2d with only a base image of the ship.



1: first you render the ship (i used an actual image from an icon to save time) centered on the image and taking up a square equivalent to 1/4 the total area of the image anc centered in the middle.
2: then you divide the image into quadrants.
3: iterate through the pixels in each quadrant along the edge and scanning towards the center until the first non-black pixel is encountered.
4: do the same for the remaining quadrants until you have 4 points to create a polygon.
5: copy the polygon and mirror it down the middle
6: re sequence the points of both polygons into one polygon
7: use an algorithm to convert the straight lines to curves, using the length and angle of the lines relative to each-other as input.
8: once you have a rounded source polygon enlarge it (175% here) to create an outer boundary. you only need to do this and all previous steps once for each shield icon at game start.
9: create a line between the top-left corner and the image center and trace it to find the point of intersection between it and the big and small polygons to create 2 points in 2d space. draw a gradient line between them. rotate the line a bit and repeat, do this until the entire image is circled. as you begin drawing each quadrant, set a different brightness based on the shield strength for that quadrant.
10: an example of different brightness levels representing different shield strength. (also using some blur here to improve the quality)

i drew the example in photoshop, so any flaws are because of that. im also not sure how fast this would be. perhaps it would be possible to do this with a shader applied to a source texture (a one time rtt job). this would still use a texture but 1 instead of 5, easing up the demand on bmpman.

*edit*
did not really consider asymmetric ships like the dragon or scorpion. a variation on steps 2-6 would be tweaked a little. split the quadrants down the middle so you have 8 half-quadrants, and scan the pixels from the corner to the split and down towards the image center until a non-black pixel is encountered, so that each quadrant should generate a point. this also simplifies steps 4,5,and 6.
*edit again*
another idea is that you can simplify the maths by using only the inner boundry. when encountered on the center to corner trace draw a gradient line of a set length along the trace vector outwards starting from the intersection. you can also vary the line length with shield integrity and use some ratio of varying thickness and intensity to possibly produce a shield more closely resembling the stock shield icons.

another draw technique involves masking the non-working area and drawing a non-filled polygon at varying scale and brightness to create concentric rings. this might be faster since you dont need to find any polygon-line intersections to draw the effect and use a mask and pixel maths which should be kinda fast-ish.
« Last Edit: December 06, 2011, 04:28:47 pm by Nuke »
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline Dragon

  • Citation needed
  • 212
  • The sky is the limit.
If bumping the limit to 200 is possible without too many problems, then I'd say it should be done. Inferno doesn't have more than 200 shielded craft, that's for sure. After that, we could think of an alternative way of generating the icons. Also, Nuke's idea sounds good to me. Perhaps it could be modified to support a few different styles of icons (WCS and FoTG ones, for instance).

 

Offline FUBAR-BDHR

  • Self-Propelled Trouble Magnet
  • 212
  • Master Drunk
    • 165th Beer Drinking Hell Raisers
If it's going to be bumped why not just bump it to MAX_SHIP_CLASSES so every ship can have one if needed? 
No-one ever listens to Zathras. Quite mad, they say. It is good that Zathras does not mind. He's even grown to like it. Oh yes. -Zathras

 
Quote
3: iterate through the pixels in each quadrant along the edge and scanning towards the center until the first non-black pixel is encountered.
4: do the same for the remaining quadrants until you have 4 points to create a polygon.
5: copy the polygon and mirror it down the middle
You can have pointy and asymmetric ships :d.  I also believe that solid color or simple shading technique would not look good.
You can never deny beauty of the hand work.

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Quote
3: iterate through the pixels in each quadrant along the edge and scanning towards the center until the first non-black pixel is encountered.
4: do the same for the remaining quadrants until you have 4 points to create a polygon.
5: copy the polygon and mirror it down the middle
You can have pointy and asymmetric ships :d.  I also believe that solid color or simple shading technique would not look good.
You can never deny beauty of the hand work.

did not really consider asymmetric ships like the dragon or scorpion. a variation on steps 2-6 would be tweaked a little. split the quadrants down the middle so you have 8 half-quadrants, and scan the pixels from the corner to the split and down towards the image center until a non-black pixel is encountered, so that each quadrant should generate a point. this also simplifies steps 4,5,and 6.

1: read the thread!
2: the color would not be solid nor would it be simple (its only that way because i used an existing icon to create the example to save time), apply shader and it would look awesome. also shield icons are confined to 16 colors, this meathod allows for a colored ship icon and you could make the shield segments any color you want by setting the gradient color. they could also be made dynamically so that they would be scalable with screen resolution. the result is higher quality icons.
3: making shield icons is easy, you make it sound like its hard to do.

the idea is to reduce the number of bitmap slots you need to allocate to shield icons so that you can have more icons. the idea is also to improve the current game-generated icons that are kinda ugly.

you could probably also draw the shield mesh while masking out the ship and other quadrants and vary its opacity from near opaque to completely transparent based on strength to draw a quadrant. this might actually be a lot faster than the way i thought of, and would draw shields as they are in the model. again, shaders would make them look awesome.
« Last Edit: December 08, 2011, 10:21:11 pm by Nuke »
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline headdie

  • i don't use punctuation lol
  • 212
  • Lawful Neutral with a Chaotic outook
    • Skype
    • Twitter
    • Headdie on Deviant Art
Quote
3: iterate through the pixels in each quadrant along the edge and scanning towards the center until the first non-black pixel is encountered.
4: do the same for the remaining quadrants until you have 4 points to create a polygon.
5: copy the polygon and mirror it down the middle
You can have pointy and asymmetric ships :d.  I also believe that solid color or simple shading technique would not look good.
You can never deny beauty of the hand work.

did not really consider asymmetric ships like the dragon or scorpion. a variation on steps 2-6 would be tweaked a little. split the quadrants down the middle so you have 8 half-quadrants, and scan the pixels from the corner to the split and down towards the image center until a non-black pixel is encountered, so that each quadrant should generate a point. this also simplifies steps 4,5,and 6.

1: read the thread!
2: the color would not be solid nor would it be simple (its only that way because i used an existing icon to create the example to save time), apply shader and it would look awesome. also shield icons are confined to 16 colors, this meathod allows for a colored ship icon and you could make the shield segments any color you want by setting the gradient color. they could also be made dynamically so that they would be scalable with screen resolution. the result is higher quality icons.
3: making shield icons is easy, you make it sound like its hard to do.

the idea is to reduce the number of bitmap slots you need to allocate to shield icons so that you can have more icons. the idea is also to improve the current game-generated icons that are kinda ugly.

you could probably also draw the shield mesh while masking out the ship and other quadrants and vary its opacity from near opaque to completely transparent based on strength to draw a quadrant. this might actually be a lot faster than the way i thought of, and would draw shields as they are in the model. again, shaders would make them look awesome.

Also With the right code adjustments it could be used in conjunction with different shield segment numbers without needing to hand draw a new shield icon
Minister of Interstellar Affairs Sol Union - Retired
quote General Battuta - "FRED is canon!"
Contact me at [email protected]
My Release Thread, Old Release Thread, Celestial Objects Thread, My rubbish attempts at art

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
like 32 segment capship shields :D
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Well i did write support for 1 and 2 segment shields but it is not in the trunk - that is the game side support, not anything related to icons
Do not meddle in the affairs of coders for they are soggy and hard to light

 

Offline chief1983

  • Still lacks a custom title
  • Moderator
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
We had 2 segment shield icons to go along with that code at one point.
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays

 

Offline Dragon

  • Citation needed
  • 212
  • The sky is the limit.
Well i did write support for 1 and 2 segment shields but it is not in the trunk - that is the game side support, not anything related to icons
Is there any chance it'd make it into the trunk? FoTG, Fringespace, WCS mods (WC1, 2 and WCP era) and maybe some others could really use duant shields, and a nonsegmented shield would also have it's uses.

  

Offline IronBeer

  • 29
  • (Witty catchphrase)
I really like nuke's idea. Dunno how feasible code-wise it is, but it looks simple enough, and having the option for a procedural shield icon seems like a smart thing to have.

Ideally we'd be able to choose between the "auto-generated" shield icon or a "handmade" icon; "handmade" would probably be the method of choice for asymmetric or pointy ships, while rather well-behaved vessels could be handled with the "auto-generate" function.
"I have approximate knowledge of many things."

Ridiculous, the Director's Cut

Starlancer Head Animations - Converted

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
im sure that asymmetrical ships can be handled correctly by changing your shape determining code. there are probably a bunch of algorithms you can use. get valathil in here he probably knows a better way to do it.
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline Thaeris

  • Can take his lumps
  • 211
  • Away in Limbo
I might argue that code for procedural 2D shield icons would require additional processing, more so than the conventional method already implemented. Thus, when you have a program getting progressively more taxed that runs on a single core...

But this might be unjustified. My thoughts are this: The ship's top down view will have full opacity factor, apart from any typical FS HUD opacity. It is thus a "solid" bitmap with a background of... zero opacity! If it is possible to write a code that can draw four quadrants with vairable strength gradients that doesn't take up too much processing power, then you might have a winner.

The code would need to do the following:
- Find the center of the bitmap. Very simple mathematics here, just divide the resolution by two on both the x- and y-axis of the bitmap, and place the center coordinates there.
- From this point, quadrant vectors are drawn at 45 degree angles from forward, at 90 degree separation. Or you could make an angular spacing function based on bitmap resolution.
- The absent background opacity is detected by the code, and a shield "gradient" is drawn from the ship's central coordinate. The start of the quadrant image is drawn a pre-determined distance from the full-opacity ship icon, and extends to an appropriately determined length.

Thus, any ship icon, asymmetric or not, could be drawn with a shield. That is, if you could code it, and it would not use more resources than necessary.
"trolls are clearly social rejects and therefore should be isolated from society, or perhaps impaled."

-Nuke



"Look on the bright side, how many release dates have been given for Doomsday, and it still isn't out yet.

It's the Duke Nukem Forever of prophecies..."


"Jesus saves.

Everyone else takes normal damage.
"

-Flipside

"pirating software is a lesser evil than stealing but its still evil. but since i pride myself for being evil, almost anything is fair game."


"i never understood why women get the creeps so ****ing easily. i mean most serial killers act perfectly normal, until they kill you."


-Nuke