Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Author Topic: Question, regarding Weapon Render Order  (Read 7919 times)

Trylobot

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1170
    • View Profile
    • Github profile
Question, regarding Weapon Render Order
« on: June 06, 2011, 09:52:18 PM »

Given a defined ship hull and variant, is it possible (by re-ordering hull hardpoint definitions, variant weapons, or other means) to affect the render-order of weapons?

Reason for asking is that I have some weapons that overlap on a modded variant, but I think I can make it look OK if I move certain of them to the fore, and others behind. I can't quite figure out how to predict the render order of the weapons though. Any insights?

Weapons are drawn, it would seem, in alphanumerical order based on the string ID given to the weapon slot in the ship hull data. This is not always the case, actually.
« Last Edit: June 06, 2011, 10:15:08 PM by Trylobot »
Logged

Avan

  • Admiral
  • *****
  • Posts: 1399
  • Pioneer of Starfarer Modding
    • View Profile
    • DevDB forums
Re: Question, regarding Weapon Render Order
« Reply #1 on: June 06, 2011, 10:20:23 PM »

It might be in the variant file? (ie the order in which they are specified there)

Trylobot

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1170
    • View Profile
    • Github profile
Re: Question, regarding Weapon Render Order
« Reply #2 on: June 06, 2011, 10:44:00 PM »

I've confirmed that the variant has no bearing on render order, only the associated hotkey and order of the groups during combat.

Through pair-wise swapping of WS id's in the hull data, I was able to achieve the render-order that I wanted; it's just that the resulting data is somewhat more jumbled than I would prefer.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: Question, regarding Weapon Render Order
« Reply #3 on: June 07, 2011, 08:21:06 AM »

Hardpoints get rendered first, turrets last.

Within those, larger weapons get rendered on top of smaller ones.

Within the same size, missile weapons get rendered on top of non-missile ones (mostly useful within hardpoints, if you have two turrets of the same size overlapping, there's a good chance of it looking bad whichever way you go).

Beyond that, I wouldn't count on any render order produced by changing the order of the weapon slots in the hull or variant spec. It's unpredictable, even if it happens to be stable in a given build.

Just as a general note, in most cases, overlapping weapons is going to look a bit weird. It tends to break whatever illusion of volume the shading on the sprites creates. In some cases, overlapping is very hard to avoid - such as with a large turret swinging around - and that's why those render on top of everything else.

Hmm... if you really need it, I think I could add alphabetic sorting based on the weapon slot id, within the subclasses (i.e., "large non-missile turret" or "small harpoint").
Logged

Avan

  • Admiral
  • *****
  • Posts: 1399
  • Pioneer of Starfarer Modding
    • View Profile
    • DevDB forums
Re: Question, regarding Weapon Render Order
« Reply #4 on: June 07, 2011, 08:31:28 AM »

So a cyclone turret will render over just about anything while a light machine gun hardpoint will render at the very bottom?

Trylobot

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1170
    • View Profile
    • Github profile
Re: Question, regarding Weapon Render Order
« Reply #5 on: June 07, 2011, 08:45:21 AM »

..., larger weapons get rendered on top of smaller ones.
... In some cases, overlapping is very hard to avoid - such as with a large turret swinging around - and that's why those render on top of everything else.

I definitely had a case where a Large Turret was rendering behind a Medium Turret; are you sure?


... if you really need it, I think I could add alphabetic sorting based on the weapon slot id ...

That would be fantastic, just for predictability's sake
« Last Edit: June 07, 2011, 08:47:24 AM by Trylobot »
Logged

Trylobot

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1170
    • View Profile
    • Github profile
Re: Question, regarding Weapon Render Order
« Reply #6 on: June 07, 2011, 08:52:25 AM »

I think I did OK making it look "Volumetric", even though there's quite a bit of overlap. Basically the effect I'm evoking is a rounded hull, placing things closer to the middle on top of other things toward the edges.

Logged

Avan

  • Admiral
  • *****
  • Posts: 1399
  • Pioneer of Starfarer Modding
    • View Profile
    • DevDB forums
Re: Question, regarding Weapon Render Order
« Reply #7 on: June 07, 2011, 09:17:58 AM »

I see custom vulcan guns?  ;D

Trylobot

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1170
    • View Profile
    • Github profile
Re: Question, regarding Weapon Render Order
« Reply #8 on: June 07, 2011, 09:45:37 AM »

Yeah  ;D

I call them Ultra-Capacity Vulcans, they are the same power and firing rate as small-size vulcans, but they have something like 2000 rounds, and require a medium slot. I made them to replace flak cannons; although flak is much more effective, they run out of ammo very quickly in a sustained sortie with no shields.
Logged

Avan

  • Admiral
  • *****
  • Posts: 1399
  • Pioneer of Starfarer Modding
    • View Profile
    • DevDB forums
Re: Question, regarding Weapon Render Order
« Reply #9 on: June 07, 2011, 09:47:32 AM »

The ammo indicators dont show for values over 999 :(

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: Question, regarding Weapon Render Order
« Reply #10 on: June 07, 2011, 10:29:39 AM »

So a cyclone turret will render over just about anything while a light machine gun hardpoint will render at the very bottom?

Yeah, though the part about missiles is new and isn't in any released build.

I definitely had a case where a Large Turret was rendering behind a Medium Turret; are you sure?

Pretty sure. The code is simple, looks correct, and I haven't seen a problem with it...

Maybe the large "turret" was actually in a hardpoint slot?


That would be fantastic, just for predictability's sake

Ok, it's on the list.
Logged

Archduke Astro

  • Captain
  • ****
  • Posts: 456
  • 99 AU from anywhere
    • View Profile
Re: Question, regarding Weapon Render Order
« Reply #11 on: June 25, 2011, 09:52:21 PM »

The ammo indicators dont show for values over 999 :(
Alex, would you expand that ammo indicator from 3 to 4 digits in a later build, please? Thanks.
Logged
We thought our last moment had come
when we got a message up the voice pipe
saying that 'A' Turret magazine was on fire.....