Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2

Author Topic: Orbital Fleet Behavior  (Read 3857 times)

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 13696
    • View Profile
Orbital Fleet Behavior
« on: March 20, 2018, 03:38:42 PM »

Blog post here. Just a short look at something I was working on, this time around.
« Last Edit: March 20, 2018, 03:41:10 PM by Alex »
Logged

c plus one

  • Commander
  • ***
  • Posts: 143
  • 'Make Jumpgates Great Again'
    • View Profile
    • Email
Re: Orbital Fleet Behavior
« Reply #1 on: March 20, 2018, 03:41:56 PM »

An imminent dev blog-post! The suspense.

All fighters, report in. Red One standing by.....  :D
Logged
Quote from: Lopunny Zen
you are playing them wrong then..

Don't tell me I'm playing anything wrong in a singleplayer sandbox game. Just don't.

PCCL

  • Admiral
  • *****
  • Posts: 1993
  • still gunnyfreak
    • View Profile
Re: Orbital Fleet Behavior
« Reply #2 on: March 20, 2018, 03:45:38 PM »

does the player fleet factor into this? I imagine the AI wouldn't make us move our fleet, but would other fleets move out of our way?
Logged
mmm.... tartiflette

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 13696
    • View Profile
Re: Orbital Fleet Behavior
« Reply #3 on: March 20, 2018, 03:52:31 PM »

does the player fleet factor into this? I imagine the AI wouldn't make us move our fleet, but would other fleets move out of our way?

It actually doesn't factor in at all because it uses slightly different mechanics to orbit a planet.
Logged

Clockwork Owl

  • Admiral
  • *****
  • Posts: 751
    • View Profile
    • Starsector South Korean Community
    • Email
Re: Orbital Fleet Behavior
« Reply #4 on: March 20, 2018, 04:03:28 PM »

Woah, woah, woah... Another blogpost this fast? Are you working overtime or something?
Logged

Techhead

  • Commander
  • ***
  • Posts: 184
    • View Profile
    • Email
Re: Orbital Fleet Behavior
« Reply #5 on: March 20, 2018, 04:06:01 PM »

When I saw the second screenshot, I actually thought the ships looked too spread out, but after seeing the gif, I have to admit it looks great in motion.

The mini-blogposts when you have small things to talk about is nice, I think. I wouldn't mind reading more in the future.
Logged

Wyvern

  • Admiral
  • *****
  • Posts: 2193
    • View Profile
Re: Orbital Fleet Behavior
« Reply #6 on: March 20, 2018, 04:09:35 PM »

The mini-blogposts when you have small things to talk about is nice, I think. I wouldn't mind reading more in the future.
Agreed.

Not a lot to say about this one beyond 'neat effect' and 'tinkering with collective behavior is fun' - but worth saying both of those.
Logged
Wyvern is 100% correct about the math.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 13696
    • View Profile
Re: Orbital Fleet Behavior
« Reply #7 on: March 20, 2018, 04:40:03 PM »

Woah, woah, woah... Another blogpost this fast? Are you working overtime or something?

Hah, usually. Trying to be better about it, though; not great to overdo it in the long run. (Case in point: when I've got more energy, it's easier to do public-facing things like blog posts!)

When I saw the second screenshot, I actually thought the ships looked too spread out, but after seeing the gif, I have to admit it looks great in motion.

Funny, had a similar thought on looking at the screenshot. It really does need the circular motion to get a feel for it.

The mini-blogposts when you have small things to talk about is nice, I think. I wouldn't mind reading more in the future.

Thank you for the feedback! Was wondering about that myself.


Not a lot to say about this one beyond 'neat effect' and 'tinkering with collective behavior is fun' - but worth saying both of those.

Hah! Thank you for saying it :)
Logged

hawkeye

  • Ensign
  • *
  • Posts: 5
    • View Profile
Re: Orbital Fleet Behavior
« Reply #8 on: March 20, 2018, 05:50:58 PM »

Sounds like N^2 time complexity to me... that will get slow in a busy system.


I recommend a different approach:

Imagine radial lines going out from the station making many pie slices.
Now, slice those pies with circle cuts at various radius's from the station.

Fleets ask the station for a pie slice that fits their fleet size. (larger fleets being farther out around the station)

Given each ring of slices, the station gives them out in a pseudo random order.
The station doesn't need to know if a slot is still being occupied or not, it simply knows it's unlikely since it would've had to cycle through all the other slots in that ring before repeating the pseudo random selection.
If there are still issues, there are two extra measures you can take. One, favor rings that haven't been used as heavily if the ship is "close enough" to fit that orbit radius. Two, each time a ring completes a pseudo random cycle, offset the whole thing a half slice. This way, even if you filled it up again, the ships would only overlap 50%.

The result is trading O(n^2) processing for O(1) processing and O(1) memory.

Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 13696
    • View Profile
Re: Orbital Fleet Behavior
« Reply #9 on: March 20, 2018, 06:44:26 PM »

Hey - thank you for your suggestion!

Basically, it's getting a potential performance improvement in exchange for reduced behavior quality.

That might well be worthwhile if O(n^2) performance here was a real concern, but it's quite far from it. An extremely busy system might have 30, 40 fleets, and this should easily perform well enough with several hundred. In addition, if O(n^2) performance in the number of fleets was an issue, this would likely not be the main bottleneck; at that point I'd probably add a bin-lattice (such as the combat layer uses) to make "give me everything within a given radius" queries O(n^2) relative to the radius (divided by a constant) instead of to the number of fleets - and then use that across the board.
Logged

shoi

  • Ensign
  • *
  • Posts: 12
    • View Profile
    • Email
Re: Orbital Fleet Behavior
« Reply #10 on: March 20, 2018, 09:58:11 PM »

I don't know if this is weird but  I really appreciate the detail you went into on explaining the logic behind your algo. Cheers  ;D
Logged

Thaago

  • Admiral
  • *****
  • Posts: 3722
  • Quantum Mechanic
    • View Profile
    • Email
Re: Orbital Fleet Behavior
« Reply #11 on: March 20, 2018, 10:17:00 PM »

This was neat! Its always nice to read about the process, even in small cases.

Quote
... Like cars going down the right side of the road without having to talk about it. ...

What magical fantasy land do you live in? :P
Logged

The Soldier

  • Admiral
  • *****
  • Posts: 3731
  • Quartermaster
    • View Profile
Re: Orbital Fleet Behavior
« Reply #12 on: March 20, 2018, 10:59:05 PM »

I quite like these mini blog posts.  Keep it up!
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.

AxleMC131

  • Admiral
  • *****
  • Posts: 1391
  • Amateur World-Builder
    • View Profile
Re: Orbital Fleet Behavior
« Reply #13 on: March 21, 2018, 01:04:06 AM »

Short and sweet makes a good blog post on an otherwise busy day.  ;D

Also that gif of the fleets moving around in real time is simply beautiful.
Logged

Draba

  • Commander
  • ***
  • Posts: 187
    • View Profile
Re: Orbital Fleet Behavior
« Reply #14 on: March 21, 2018, 01:40:54 AM »

To me small mechanical tidbits like this are actually more interesting than the sweeping teasers.
One of those times when the logic is really simple but the resulting behavior could be mistaken for intelligence.
Logged
Pages: [1] 2