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)

Pages: 1 2 3 [4] 5 6

Author Topic: Starsector PSA #1: Your Ship's Bounds Polygon Is Too Detailed  (Read 138226 times)

Amazigh

  • Captain
  • ****
  • Posts: 284
    • View Profile
Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
« Reply #45 on: September 09, 2012, 03:56:47 PM »

Just a bit of curiosity here, exactly HOW bad is it to have lots of points in your bounding poly?
Just how much more processor power does ship with ~100 points takes compared to one with ~8 points?
Is it really a huge difference in game speed?
note: I play on a laptop and the ships I've made, [all "criminally" complex] don't noticeably slow the game down to me.
Logged

K-64

  • Admiral
  • *****
  • Posts: 1117
    • View Profile
Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
« Reply #46 on: September 09, 2012, 04:00:28 PM »

From what I can tell, it does make a rather large difference. For example I was getting called on to reduce the amount of bounds on some of my ships when they were at the 25-30 (I think, can't remember exactly) mark. That's not to say I still don't err on the side of excess though
Logged

ValkyriaL

  • Admiral
  • *****
  • Posts: 2145
  • The Guru of Capital Ships.
    • View Profile
Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
« Reply #47 on: September 09, 2012, 04:04:53 PM »

It depends on how many ships with many bounds there is tbh. if you have a fighter wing of 6 fighters, all fighters have 20 bounds each and you have 20 wings of these fighters. that's alot

it isn't bad, but starfarer gets alot slower on massive scales for having to many bounds

max 4 bounds on fighters, you only need 3 really

max 6-10 on a frigate

and max around 10-*depends on ship size* on all others, otherwise it gets to much

the sprite i posed before you ended up a starbase, its 768x768 and has 28 bounds total around it.

just try to get it as absolutely low as possible without it looking wierd.
« Last Edit: September 09, 2012, 04:07:55 PM by ValkyriaL »
Logged

ValkyriaL

  • Admiral
  • *****
  • Posts: 2145
  • The Guru of Capital Ships.
    • View Profile
Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
« Reply #48 on: September 09, 2012, 04:11:04 PM »

BTW K-64 off topic, Do you have a weapon file for a flak burst weapon? ( shotgun flak cannon), would really love to look at it ^^, i saw a ship using something similar on Youtube but i cant find the video.
Logged

CrashToDesktop

  • Admiral
  • *****
  • Posts: 3876
  • Quartermaster
    • View Profile
Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
« Reply #49 on: September 09, 2012, 04:42:49 PM »

I could easily make one for you.

But anyways, I could probably fit even less than 28 bounds in that cap ship of yours and still make it look good.
Logged
Quote from: Trylobot
I am officially an epoch.
Quote from: Thaago
Note: please sacrifice your goats responsibly, look up the proper pronunciation of Alex's name. We wouldn't want some other project receiving mystic power.

K-64

  • Admiral
  • *****
  • Posts: 1117
    • View Profile
Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
« Reply #50 on: September 09, 2012, 04:54:31 PM »

BTW K-64 off topic, Do you have a weapon file for a flak burst weapon? ( shotgun flak cannon), would really love to look at it ^^, i saw a ship using something similar on Youtube but i cant find the video.

I don't have one on me, but it isn't that difficult to make. Just have multiple "barrels" for the weapon at regular angles from a negative point to the same value positive. And for burst, just put how many times you want it to fire

[/offtopic]
Logged

FlashFrozen

  • Admiral
  • *****
  • Posts: 988
    • View Profile
Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
« Reply #51 on: September 09, 2012, 05:50:59 PM »

Ha, I'm guilty on all charges for overly excessive amounts of bounds, Guess it really is just my dirty habits for little details,

Guess I could skimp on some details for sake of gameplay, but it's just so hard to notice the difference for me xD
Logged

ValkyriaL

  • Admiral
  • *****
  • Posts: 2145
  • The Guru of Capital Ships.
    • View Profile
Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
« Reply #52 on: September 09, 2012, 06:40:17 PM »

Its not a ship soldier, x) its a starbase. and i could probably remove 3 or so bounds per side yes. so 2-3 X4
Logged

CrashToDesktop

  • Admiral
  • *****
  • Posts: 3876
  • Quartermaster
    • View Profile
Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
« Reply #53 on: September 09, 2012, 06:48:51 PM »

I hate to say it, but that's -10. ;D Needs parenthises.

Anyways, Thunder is an excellent example of good bounds usage, just three bounds! :)
Logged
Quote from: Trylobot
I am officially an epoch.
Quote from: Thaago
Note: please sacrifice your goats responsibly, look up the proper pronunciation of Alex's name. We wouldn't want some other project receiving mystic power.

xanderh

  • Commander
  • ***
  • Posts: 136
    • View Profile
Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
« Reply #54 on: September 10, 2012, 01:12:44 AM »

I hate to say it, but that's -10. ;D Needs parenthises.

Anyways, Thunder is an excellent example of good bounds usage, just three bounds! :)

No, you just read it wrong. 2-3 ship bounds per side, with 4 sides.
Logged

TJJ

  • Admiral
  • *****
  • Posts: 1905
    • View Profile
Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
« Reply #55 on: September 10, 2012, 01:14:47 AM »

Just a bit of curiosity here, exactly HOW bad is it to have lots of points in your bounding poly?
Just how much more processor power does ship with ~100 points takes compared to one with ~8 points?
Is it really a huge difference in game speed?
note: I play on a laptop and the ships I've made, [all "criminally" complex] don't noticeably slow the game down to me.

If Alex is doing a simple bounding circle,or AABB check before the more detailed polygonal check, then it shouldn't make much difference at all.

That might be an optimization he hasn't bothered with yet though; same for spatial partitioning.

Imo overly simplifying the collision bounds at this stage is premature optimisation given the alpha status of the game.
Logged

Trylobot

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1170
    • View Profile
    • Github profile
Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
« Reply #56 on: September 10, 2012, 07:14:24 AM »

If Alex is doing a simple bounding circle,or AABB check before the more detailed polygonal check, then it shouldn't make much difference at all.

He is. This came up before; he's doing a bounding circle, and the bounds polygon is actually optional. The bounds polygon does come into play if you are taking a lot of fire.

So worst case in Starfarer is a lot of complex capital ships firing a lot of pea-shooters at each other en masse. Can't get around the detailed collision checks in that case.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
« Reply #57 on: September 10, 2012, 01:45:51 PM »

If Alex is doing a simple bounding circle,or AABB check before the more detailed polygonal check, then it shouldn't make much difference at all.

That might be an optimization he hasn't bothered with yet though; same for spatial partitioning.

Imo overly simplifying the collision bounds at this stage is premature optimisation given the alpha status of the game.

The game is doing both a bounding circle check (that's what "collisionRadius" is for) and uses spatial partitioning. Both because they were found to be necessary, not "just in case" - though a bounding circle check is the sort of thing you can code in about 5 minutes, anyway.

So worst case in Starfarer is a lot of complex capital ships firing a lot of pea-shooters at each other en masse. Can't get around the detailed collision checks in that case.

Even worse when a beam is shooting at something, or when multiple ships are within each other's collisionRadius but not actually colliding - which can happen a lot, and means detailed checks every single frame, to the tune of n^2 relative to the number of bounds segments.

So, when a pair of Wasp wings fires at a ship, having a 150+ vertex bounds polygon will make a very real difference. More of a difference on lower-end computers, obviously. I'm not going to say it's a huge deal - but it's something, and since detailed bounds are completely unnecessary, and more work to boot...
Logged

TJJ

  • Admiral
  • *****
  • Posts: 1905
    • View Profile
Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
« Reply #58 on: September 10, 2012, 02:10:19 PM »

I notice the collision bounds are arbitrary polygons.
Do you preprocess them down into convex polys so SAT (separating axis theorem) can be used for cheaply detecting intersections?

I've never implemented it myself, but the simple genius behind SAT has always tempted me to find a use for it.
Logged

Trylobot

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1170
    • View Profile
    • Github profile
Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
« Reply #59 on: September 10, 2012, 02:39:27 PM »

SAT is neat. But how difficult is it to create set of convex polygons from an arbitrary polygon? Is that a solved problem?

EDIT: Aaaand I just answered my own question.
http://www.touchmypixel.com/blog_examples/190608_ear_clipping/
« Last Edit: September 10, 2012, 02:41:19 PM by Trylobot »
Logged
Pages: 1 2 3 [4] 5 6