Fractal Softworks Forum

Starsector => Mods => Modding => Topic started by: Trylobot on September 04, 2012, 06:25:44 PM

Title: Starsector PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Trylobot on September 04, 2012, 06:25:44 PM
Modders,

I've noticed folks going overboard on their bounds polygons. What I mean by this is: "using more coordinates than absolutely necessary to evoke a convincing level of hit-detection in-game."

The question you should now be asking is: "gee Trylobot, if you're so smart, what the heck should I be doing instead? I haven't noticed any problems."

Good question modders, I'm glad you asked. The problems you haven't noticed are insidious. They don't really affect anything at small scales. But when your ships are used en-masse, say in a mod compilation like U.'s Corvus or similar, these super-complex bounds polygons will slow down the computers belonging to the "economy / mid-range" level. In other words, not hardcore gaming machines like you and I are so fond of. And you should be worried about this, because these folks are technically your audience. You're going to all this work, authoring this mod, ostensibly so that as many people as possible can play it. So you want to Optimize.

Best optimization: consider removing literally every bounds coordinate you currently have and making a new one from scratch. If you want to look at perfection, load up some of the vanilla ships and look at their level of detail. Then think to yourself, "self, if the bounds polygon looks like this, and in-game I didn't notice anything funny, then isn't this enough?" The answer is yes. Yes it is. Use as few bounds coordinates as possible to look right, and not a single one more. It's better for the game, better for performance, and better for the perceived quality of your mod.

EDIT: Here's an example from Ghoti:
Spoiler
(http://i.imgur.com/2hvPiFZ.png)
[close]

This concludes a Public Service Announcement.

Update: April 19, 2013 - PRO TIP from Vinya
Use your image editor's "Pixelate" effect, and give a size of 5 (or higher). When setting up your ship's bounds, use this pixelated version of your ship. That way you won't be as inclined to include unnecessary details in the polygon.

Update: Addendum from Astro with illustrations (http://fractalsoftworks.com/forum/index.php?topic=4270.msg66788#msg66788)

Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Wriath on September 04, 2012, 07:42:34 PM
I've got one of those trash rigs, thanks for putting this out here Try, hope to see people follow the advice.
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: xenoargh on September 04, 2012, 07:59:26 PM
Can you give us some rough guidelines, i.e., what targets to shoot for per size?
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: The Soldier on September 04, 2012, 08:06:17 PM
Just get the general shape of it.
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: xenoargh on September 04, 2012, 08:13:00 PM
I'd like some numbers; I'm already skipping a lot of little details, I just want to know if I'm getting close-enough or if I need to redo my bounds again :)
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Ghoti on September 04, 2012, 08:13:16 PM
Thanks for reminding me to fix up some other bounding boxes.

Quick tip. You're unlikely to need more than 6 vertices for fighters. if you can get away with 4 (preferably 3!), you're good!

I just want to know if I'm getting close-enough or if I need to redo my bounds again :)

judgement call, refer to handy picture:

[attachment deleted by admin]
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: xenoargh on September 04, 2012, 08:27:29 PM
Ah, I'm mainly OK then, I was being pretty conservative with the later ones.  Might have to go back and redo the first ones though :)
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Trylobot on September 04, 2012, 08:53:04 PM
Ghoti, you are spot on. Perfect.

judgement call, refer to handy picture:
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: K-64 on September 04, 2012, 08:53:20 PM
Any particular numbers for each class? Just so folks (possibly including myself, I am rather known for being... excessive with bounds :P) know whereabouts to try and keep within. It's all well and good saying "Keep them bounds nice and simple", but it won't be much use unless there are some hard numbers out there
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Trylobot on September 04, 2012, 08:58:48 PM
To xenoargh and K-64: Sorry guys! There are no such numbers. I'm not being facetious here. I mean literally; there is no correct or easy answer to this.

I'll put it absolutely as simple & clear as I can: as few as possible. If you can get away with 3, use 3. If you think "no, that misses an entire section," add 2-3 more. If you get it "pretty close" with that many, you're probably good. To be sure, go and playtest it in game. Err on the side of fewer, and only add more if you see in-game weirdness.
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Psycho Society on September 04, 2012, 10:29:44 PM
You're defining a shape, so unless all your ships are regular polygons, no one can tell you how many points to use. Just keep it simple, dang guys.
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Okim on September 05, 2012, 12:24:42 AM
Hm. I`ll check my ships now.
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: XpanD on September 05, 2012, 01:58:20 AM
Great info, thanks! I know that my Positron mod had some overly detailed bounds - I'll make sure the Worksmen ships are a bit nicer to slower machines. ;)
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: ValkyriaL on September 05, 2012, 04:07:47 AM
Heh...one of my old fighters have 70 bounds in total... a bit to much XD

EDIT: Woah.... the first ship i made have 332 bounds in total... Better fix that >.>
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Cycerin on September 05, 2012, 05:01:30 PM
I'm mad guilty of this. Going to take a look again when I resume working on my mod.
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Wriath on September 05, 2012, 10:01:36 PM
Yeah I noticed some fps lag with your ships Cyc, but they're too sexy to complain.
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: ValkyriaL on September 06, 2012, 04:28:53 AM
Imagine the amount of bounds i had on this before i saw this post  ;) the ship is almost 700 pixels long
(http://i.imgur.com/nYHiD.png)

Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: TheHappyFace on September 06, 2012, 06:29:46 AM
Imagine the amount of bounds i had on this before i saw this post  ;) the ship is almost 700 pixels long
(http://i.imgur.com/nYHiD.png)



more than my calculator can handle i guess  ;)
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Trylobot on September 06, 2012, 08:26:54 AM
ValkyriaL, I think a mere 8 coordinates would be the optimal number for that particular ship. Maybe you can make that your goal.
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: ValkyriaL on September 06, 2012, 08:35:11 AM
i could probably get it to 6 mirrored, but that wouldn't make sense :P since it would go deep in and really far out on some parts. 12 mirrored if i want it to look good and still have low number of bounds.

EDIT: 28 bounds mirrored and now it it follows the ship's shape to some extent. there will only be one of this ship on the map at a time, maybe 2 so i don't think a little extra bounds on one ship will do much, its a hell lot better than before, think this ship had around 150-200 bounds in total.

(http://i.imgur.com/aDkmz.png)
removed a few bounds on this one as well, its got 40 in total and i have less bounds than the onslaught have on his, i could probably get lower. my frigates and fighters all have 3-6 bounds each, i think im good :)
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Brainbread on September 06, 2012, 10:48:48 AM
i could probably get it to 6 mirrored, but that wouldn't make sense :P since it would go deep in and really far out on some parts. 12 mirrored if i want it to look good and still have low number of bounds.

EDIT: 28 bounds mirrored and now it it follows the ship's shape to some extent. there will only be one of this ship on the map at a time, maybe 2 so i don't think a little extra bounds on one ship will do much, its a hell lot better than before, think this ship had around 150-200 bounds in total.

(http://i.imgur.com/aDkmz.png)
removed a few bounds on this one as well, its got 40 in total and i have less bounds than the onslaught have on his, i could probably get lower. my frigates and fighters all have 3-6 bounds each, i think im good :)

(http://i45.tinypic.com/117vdlc.jpg)

I think you can get it down without anyone noticing.
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: ValkyriaL on September 06, 2012, 11:08:57 AM
:O but what about the hole in the front? that's + 4 bounds, and the rear flak mount? thats + 1 per side and the middle 2 armor side plates? another + 1 per side. then i think it would be awesome. so 18 bounds total? =D

(http://i.imgur.com/2nY9C.png)
how about this? i woulden't call that to many bounds. =/
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: LazyWizard on September 06, 2012, 11:23:20 AM
:O but what about the hole in the front? that's + 4 bounds, and the rear flak mount? thats + 1 per side and the middle 2 armor side plates? another + 1 per side. then i think it would be awesome. so 18 bounds total? =D

You don't want an exact outline of your ship, just an approximation. The chances of a projectile being fired at the perfect range and angle to travel between the arms and fade away before hitting anything is so remote that it's not worth worrying about. Same thing with the concavities on the side - try to imagine a projectile path that could enter that area and still miss. ;)
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: ValkyriaL on September 06, 2012, 11:27:20 AM
Changed the pic :P edit that comment o yrs! >.< but ok il fix the hole then =( but i can see it ahead of me, a shell just hitting mid air. even if the chance is slim
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Alex on September 06, 2012, 11:28:52 AM
For the hole in the front, I think 1 extra vertex would do it - a triangular-shaped cutout will work just fine.

General note, from personal experience with this: having bounds inside the sprite's visual border is much better than having them outside. A "hey, this got hit where there's what looks like empty space" can be pretty noticeable. "Hey, this got hit 10 pixels inside the boundary" pretty much never is.

(http://i45.tinypic.com/117vdlc.jpg)

So, for this, consider what it'd look like if a beam weapon was hitting where the bounds cross empty space. I'd probably add around 5 more points and edge some boundaries in where necessary. Actually, I'd edge most of the vertices in a fair bit - for example, if all the engine nozzles are slightly outside the bounds, that's never going to get noticed.

An extra few vertices won't make a relevant difference in performance - it's when you start going overboard and trying to be pixel-perfect that you can run into trouble.
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Ghoti on September 06, 2012, 12:39:35 PM
I disagree with SOME of the opinions in this thread. After some testing, I'm noticing problems with the way lasers carve across. Of course since I'm looking for it, I see the problem, but it IS there.

Taking into consideration that this ship likely has a higher fleet point cost, won't be prolific, and is well under the number of verts of vanilla ships. I believe these are the optimal bounds.

Same thing for his frankenslaught. I believe these bounds are optimal.

[attachment deleted by admin]
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: ValkyriaL on September 06, 2012, 01:10:54 PM
I luuuuuve mah frankenslaught =D

and yes, they have a very high FP cost since my faction is a quality over quantity superpower

the cruiser costs 18 FP

frankenslaught "LOLZ" costs 40 FP


(Some parts of this post removed. You should know why.) ~ Trylobot
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Trylobot on September 06, 2012, 11:05:12 PM
ValkyriaL: Don't take this the wrong way, but you have rather missed the point of this thread. Primarily it was to educate you on the theory of how to create your own bounds polygons. Secondarily, to provide some concrete examples. Ghoti has been more than generous to provide the examples that he has already done.

Asking for one of us to do it for you rather defeats the point, don't you think? Why don't you give it an honest try yourself, before just giving up? You have a wealth of information before you. Read it, understand it, give it a try.

The worst case scenario is still not that bad. Heed these universal words, true for all videogames:
If it looks right, it is right.

In this case it means: make your own bounds, playtest them in game, and decide for yourself if it is correct.

Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: mendonca on September 07, 2012, 01:31:36 AM
Just checked mine, which weren't too bad thankfully. Perhaps the Orca is a bit overengineered, but I don't think I really got the Clam right, at all:

(https://dl.dropbox.com/u/66536185/clam_bounds.png)

 :o

Oh dear ... just goes to show how weird the bounds can be and you largely get away with it ...
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: TJJ on September 07, 2012, 01:41:59 AM
I wonder how good the results would be from an automated process.

Edge detect -> generate vectors -> iteratively flatten

Would be quite easy to implement.
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Ghoti on September 07, 2012, 06:28:22 AM
(https://dl.dropbox.com/u/66536185/clam_bounds.png)
I thought this was a joke
Spoiler
(http://dl.dropbox.com/u/6581181/notajoke.jpg)
THIS WAS NOT A JOKE.
[close]
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: mendonca on September 07, 2012, 06:57:01 AM
My beautiful trans-dimensional Clam.

That demonstrates clearly how fiddly it was in a time when we had to set the bounds manually!

(You don't know how good you've got it! In my day ... blah blah blah)

(But really, I shouldn't have got it that wrong)
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Brainbread on September 07, 2012, 07:32:53 AM
My beautiful trans-dimensional Clam.

That demonstrates clearly how fiddly it was in a time when we had to set the bounds manually!

(You don't know how good you've got it! In my day ... blah blah blah)

(But really, I shouldn't have got it that wrong)

No wonder the bloody thing was so hard to kill.

I think you should leave it. Its the most beautiful thing I've ever seen.
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Ghoti on September 07, 2012, 07:51:58 AM
I think you should leave it. Its the most beautiful thing I've ever seen.
(http://dl.dropbox.com/u/6581181/bestideaever.jpg)
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Trylobot on September 07, 2012, 07:53:09 AM
I am laughing so hard right now I think I hurt a lung
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Archduke Astro on September 07, 2012, 11:12:57 AM
Like Trylobot, I also feel like I'm gonna barf up a couple of ribs from so much laughter. The ISS Edvard Munch is right on target!
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Ghoti on September 07, 2012, 12:31:49 PM
Gentlemen.
Spoiler
(http://dl.dropbox.com/u/6581181/screamer/1gentlemen.jpg)
(http://dl.dropbox.com/u/6581181/screamer/2lets.jpg)
(http://dl.dropbox.com/u/6581181/screamer/3rock.jpg)
[close]

and yes
Spoiler
(http://dl.dropbox.com/u/6581181/screamer/4andyes.jpg)
[close]
http://www.mediafire.com/?gb2ktknxosj2kfp

This isn't nearly as funny as nyan cat though  >:(
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Archduke Astro on September 07, 2012, 12:50:56 PM
The energy weapons coming out of the eyes is what brings it all together.
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Archduke Astro on September 07, 2012, 01:12:03 PM
Addendum to the Public Service Announcement:

There's been some worry here about the desire to have hard guidelines about how many boundary-box vertices are enough vs. too much. To echo Trylobot's advice, there can be no absolute limits here because the solution is not a single number value; it's a relative range of effect, dependent upon the complexity of the sprite in question. But total surrender to the over-intricate aesthetics of any given modded-made sprite is definitely not in anyone's best interests.

At this point in the discussion, I thought it would be helpful to provide some concrete examples of what to aim for. Here are some examples of the bounds polygons for official Starfarer units. These guides should help greatly -- please compare them to your own modder-made creations, and you'll quickly get a better feel for "how many is too many". Official ships often have quite a lot fewer bounds points than you might assume they do.....

Spoiler
(http://i1098.photobucket.com/albums/g372/mentor_of_arisia/starfarer/official%20bounds%20polygons/Apogeebounds.jpg)
[close]
This is a superb example of what Alex mentioned about keeping the bounds well inside of the sprite. And I bet some of you are shocked that a shape as visually irregular as this sprite can be satisfactorily bounded within only 19 vertices. Designers of 100-plus vertex bounds, please take note.

Spoiler
(http://i1098.photobucket.com/albums/g372/mentor_of_arisia/starfarer/official%20bounds%20polygons/Aurorabounds.jpg)
[close]
Oh, those lovely high-tech curves! Yet in bounds terms, it's treated like a hand-held gardening trowel. No computer performance hit from this bounds box!

Spoiler
(http://i1098.photobucket.com/albums/g372/mentor_of_arisia/starfarer/official%20bounds%20polygons/Conquestbounds.jpg)
[close]
Even with this fearsome hull, one can see a few places where this boundary box can be simplified further with no ill effects. Check out those side missile slots.

Spoiler
(http://i1098.photobucket.com/albums/g372/mentor_of_arisia/starfarer/official%20bounds%20polygons/Sunderbounds.jpg)
[close]
Perfect demonstration of what Alex meant when he counseled ValkyriaL about how to handle the gap in the bow: just zig-zag straight to the bottom, and right back out again.

Spoiler
(http://i1098.photobucket.com/albums/g372/mentor_of_arisia/starfarer/official%20bounds%20polygons/Tempestbounds.jpg)
[close]
It's a brick! :D Sure, it's a streamlined hull of pure awesome, but still a brick of only 5 bounds. Imitate it. ;)

Everyone can now see how when it comes to bounds, additional data does not necessarily equal additional useful information. Ships can and do get by just fine on surprisingly few boundary points. Coverage of engine exhausts does not need to be encyclopedic in its scope; that's often the first place one can delete several vertices from modder-made ships.

And even some official ships can afford to lose a few bounds, as we saw with the Conquest. The Astral is difficult to meaningfully slim down its vertex count further, while the Paragon can definitely afford to give up as many as 8 of them.

There are many customers of Fractal Softworks who do not fit the assumed profile of "serious gamer" from a hardware standpoint. It is very important to remember that. Even if someone does have a moderate-performance box  -- instead of a 10-year-old computer stuck with WinXP SP1 and only 1024MB RAM (how soon we forget) -- their graphics card may still be well behind the curve by a rather wide margin. For reasons of technical know-how as well as basic finance, many of these acceptable but unspectacular machines are unlikely to improve. It is not reasonable to cut these folks out of your audience when you spec out mods which include ships of fiendishly-clever but also unnecessary complexity.

The RAM, CPU and video card of many older computers thank you for your friendly restraint. ;D
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: ValkyriaL on September 08, 2012, 03:29:51 AM
The gap bound on the sunder is not in the middle. :O
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Trylobot on September 08, 2012, 09:24:26 AM
That's really all you took away from that, ValkyriaL?
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Ghoti on September 08, 2012, 09:30:17 AM
Hey. Leave my little buddy alone.  ;)
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Piroton on September 09, 2012, 03:25:24 AM
Hmm, is this okay for something that costs 34 fleet points? I'm kinda feeling that this should be a bit more detailed.

(http://i.imgur.com/ZsSi7.png)
Or is this also okay?
(http://i.imgur.com/1vB5M.png)
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: ValkyriaL on September 09, 2012, 03:46:01 AM
looks perfect
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: ValkyriaL on September 09, 2012, 05:21:35 AM
The more closed spaces the ship has, the more bounds matter (i think), i had to keep that in mind as well that i didn't need to put bounds in places where shells can't even hit to begin with :P

But im a little confused with this one.

(http://i.imgur.com/u4rrC.png)

I think im going to make it my faction's station or a mobile star base in a fleet, does stations need bounds? or they are just flying graphics. ??? 
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Amazigh 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.
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: K-64 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
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: ValkyriaL 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.
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: ValkyriaL 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.
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: The Soldier 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.
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: K-64 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]
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: FlashFrozen 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
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: ValkyriaL 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
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: The Soldier 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! :)
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: xanderh 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.
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: TJJ 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.
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Trylobot 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.
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Alex 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...
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: TJJ 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.
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Trylobot 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/ (http://www.touchmypixel.com/blog_examples/190608_ear_clipping/)
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Alex on September 10, 2012, 02:44:57 PM
Now that would be premature optimization :) Especially since having sensible bounds would be a good thing, regardless.

Also: correct me if I'm wrong, but that's actually used for detecting non-intersections, right? Which is good, but only goes so far. (Don't think it would do anything for beam-vs-bounds hit locations, etc).
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: TJJ on September 10, 2012, 03:28:12 PM
Oh absolutely, good bounds are always..... Good.
It just seemed a shame that some of these excellent sprites might be having their bounding polygons (perhaps unnecessarily) *over* optimised.

As for SAT, yes it doesn't give you an intersection point/line/volume it just quickly tells you whether poly-poly/poly-circle intersect (amazingly so if you have a good heuristic for selecting the separating axes)

The best article I've found on SAT is this :
http://www.sevenson.com.au/actionscript/sat/
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Thaago on September 12, 2012, 12:21:47 PM
Off topic, but thanks for posting/talking about SAT - I hadn't heard of it before. :)
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Erick Doe on September 21, 2012, 08:06:13 AM
Can weapons and engines located outside of bounds, but within collision radius,  still be damaged?
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: ValkyriaL on September 21, 2012, 11:05:34 AM
Yes they can. you can have them outside collision radius as well,  as long as a bound is somewhat nearby.
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Alex on September 21, 2012, 02:03:27 PM
Can weapons and engines located outside of bounds, but within collision radius,  still be damaged?

Depends on if they're close enough to the bounds to be on armor cells that take damage. Armor cells extend around the ship (conceptually, you can think of those outside the bounds as being on the underside of the ship) and subsystem damage is based on damage taken by the cell the subsystem (weapon/engine) is on.
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: JT on September 28, 2012, 04:40:05 PM
Being such a recent purchaser who was so wowed by one of the videos that I haven't even started playing the game yet before checking out the forums, I have to put in one reality check.

While over-complex bounds are of course nasty from a performance perspective, have people considered the option of having "lite" bounding boxes for "gentler" computers, and having full-on hardcore "I've got 10000 pixels!" bounding boxes for high-end rigs, and then releasing their mods with both options, or even a range of options in between? Have your cake and eat it too, so to speak: the people who insist that "perfection is the meaning of life" (where the journey is clearly the goal, because perfection can never be achieved) can have all of their endemic performance losses, the people who insist that "if it looks right, it's right" (like building contractors, right up until the thing collapses) can have their speedy optimised bounding boxes that allow holes to be blown in, well, holes.

I say this because once CPU power advances enough, perfect bounding boxes can be feasible in the long term. We're not facing a global gigahertz shortage within the next couple of decades, unlike certain other commodities. =)
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Trylobot on September 28, 2012, 09:50:29 PM
JT: Welcome to the forums! And as for your idea: I completely support it. It's up to the individual modders to implement of course, but I think options for gentler computers would be a very popular idea, especially for those mods that have a reputation of being especially taxing by default.
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Starlight on December 05, 2012, 06:01:39 PM
Interesting food for thought. 

Personally, I've tried to make my ships economical with their boundaries, but I have gotten a little fussy here and there.  I've not had any trouble with mine, but most of the computers I've tested on have been fairly decent.  If anyone else has had any trouble let me know and I'll refine a bit. 
Title: Re: Starfarer PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Sproginator on December 17, 2012, 03:32:03 AM
JT: Welcome to the forums! And as for your idea: I completely support it. It's up to the individual modders to implement of course, but I think options for gentler computers would be a very popular idea, especially for those mods that have a reputation of being especially taxing by default.
Agreed, Would be very useful for later developments in moddability :)
Title: Re: Starsector PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Vinya on April 06, 2013, 07:58:29 PM
A quick two-cents to chip in here.

My very roundabout way of doing bounds poly's:

If you're using an image editor that has a 'Pixelate' effect (Paint.net, Photoshoop, probably GIMP) can help a lot with the impending question of 'Should I Bound This?'.

Simply pixelate a copy of the image to some obscene ammount, do the bounds for that image, then revert back to the original image. This helps to just get the general shape of the ship without worrying too much about nostalgic or favorite details.

Sorry for the Necro, but it is a sticky thread >.>

Title: Re: Starsector PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Trylobot on April 06, 2013, 08:23:02 PM
That's a very good suggestion, Vinya, and it's actually along the same lines that "automatic bounds polygon derivation" is performed. So, bravo for the idea.
Title: Re: Starsector PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Vinya on April 17, 2013, 09:11:05 PM
Thank 'ye kindly. Glad to be of help. Maybe a good tip to add to the OP?
Title: Re: Starsector PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Deshara on May 06, 2016, 02:04:37 AM
The simple rule of thumb isn't concave over convex. There's no need to draw a polygon to catch a patch of outcropping detail if any shot that gets that close to the ship's hull is going to just hit the hull anyway.
Take for example the extruding fuel tanks on the s_kite where the missiles would be. No shot that gets within the curvature of the central hull and it's wingspan enough to touch those tanks is going to hit either the hull or the wings anyhow so there's no point to draw the tanks into the bounds
Title: Re: Starsector PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Shrugger on February 23, 2019, 11:14:01 PM
Old-as-*** machine here, thanks for this PSA. Performance is my #1 issue with Starsector.
Title: Re: Starsector PSA #1: Your Ship's Bounds Polygon Is Too Detailed
Post by: Takezzo on February 03, 2020, 07:25:10 AM
Old-as-*** machine here, thanks for this PSA. Performance is my #1 issue with Starsector.

Same here, Thank you guys i really appreciate that