Author Topic: Map Generation - Linked Rings doesn't work correctly  (Read 217 times)

Offline Sounds

  • Full Member Mark II
  • ***
  • Posts: 173
Map Generation - Linked Rings doesn't work correctly
« on: January 15, 2020, 07:41:43 AM »
I thought I try the Linked Rings map today and discovered that it doesn't work very well with planet sizes less than 60. In fact in some case you can end up with maps where you can't reach all the planets

See the attached screen shot of an edge case. Where you can only got to one other planet off screen.

Offline Sounds

  • Full Member Mark II
  • ***
  • Posts: 173
Re: Map Generation - Linked Rings doesn't work correctly
« Reply #1 on: January 15, 2020, 07:49:27 AM »
Here's another example where you can only reach 3 other planets.

Offline Draco18s

  • Resident Velociraptor
  • Core Member Mark V
  • *****
  • Posts: 4,226
Re: Map Generation - Linked Rings doesn't work correctly
« Reply #2 on: January 15, 2020, 11:08:59 AM »
Oooh, interesting!
Thanks for the report (including seed and number of planets; very useful)

I think I know what's going on there and rather than spending gobs of effort fixing it (the way the generator was intended to link things) I think I'll toss Badger's "make sure the galaxy is connected, always" function at it instead and live with the results.

I'll be able to get to this tonight (I can add the code immediately, but not test it).

Offline Sounds

  • Full Member Mark II
  • ***
  • Posts: 173
Re: Map Generation - Linked Rings doesn't work correctly
« Reply #3 on: January 16, 2020, 09:18:37 AM »
Oooh, interesting!
Thanks for the report (including seed and number of planets; very useful)

I think I know what's going on there and rather than spending gobs of effort fixing it (the way the generator was intended to link things) I think I'll toss Badger's "make sure the galaxy is connected, always" function at it instead and live with the results.

I'll be able to get to this tonight (I can add the code immediately, but not test it).

FWIW, if you send me the code I could test locally?

Offline BadgerBadger

  • Arcen Volunteer
  • Hero Member Mark III
  • *****
  • Posts: 1,157
  • BadgerBadgerBadgerBadger
Re: Map Generation - Linked Rings doesn't work correctly
« Reply #4 on: January 16, 2020, 10:00:51 AM »
I suspect that Draco intends to put this call:
BadgerUtilityMethods.makeSureGalaxyIsFullyConnected(galaxy.Planets);
as the last line in
Mapgen_D18_LinkedRings::Generate(), which would be line 596 or so in MapGenerationDraco.cs

Offline Draco18s

  • Resident Velociraptor
  • Core Member Mark V
  • *****
  • Posts: 4,226
Re: Map Generation - Linked Rings doesn't work correctly
« Reply #5 on: January 16, 2020, 01:45:30 PM »
That thing Badger said.

Offline tadrinth

  • Sr. Member Mark III
  • ****
  • Posts: 479
Re: Map Generation - Linked Rings doesn't work correctly
« Reply #6 on: January 16, 2020, 03:00:11 PM »
Might be worth moving the functionality in makeSureGalaxyIsFullyConnected up into the game engine, so that it gets run for all maps.  That way if any other custom map types have this bug, they'll be fixed automatically.

Offline Draco18s

  • Resident Velociraptor
  • Core Member Mark V
  • *****
  • Posts: 4,226
Re: Map Generation - Linked Rings doesn't work correctly
« Reply #7 on: January 16, 2020, 03:49:26 PM »
Agreed.
The result seen here is due to some changes I made with regards to how it spaced the rings around the major loop to always be every-other rather than float based (so it would try and place every, say, 2.33 points, so: on, skip, on, skip, skip, on...) and placed the main ring planets further apart. But it had the effect of keeping those skipped planets too far away from the rings to reliablly link up.

Offline Sounds

  • Full Member Mark II
  • ***
  • Posts: 173
Re: Map Generation - Linked Rings doesn't work correctly
« Reply #8 on: January 16, 2020, 09:34:31 PM »
Tested. :)

Seems to work fine, but as you can see it only creates 10 planets - however if that's what was intended then no issue, but it would be great if the generated planets were in at least close number in total.


Offline Draco18s

  • Resident Velociraptor
  • Core Member Mark V
  • *****
  • Posts: 4,226
Re: Map Generation - Linked Rings doesn't work correctly
« Reply #9 on: January 16, 2020, 11:17:09 PM »
Yeah, I was poking at it this afternoon. I'm going to revert my recent changes and try again. :\
Basically what happened was, that because the number of planets was so low, the main "largest" ring got set to 2 planets (rather than the intended minimum of 10 or 12).

Offline Sounds

  • Full Member Mark II
  • ***
  • Posts: 173
Re: Map Generation - Linked Rings doesn't work correctly
« Reply #10 on: January 17, 2020, 02:27:21 AM »
Yeah, I was poking at it this afternoon. I'm going to revert my recent changes and try again. :\
Basically what happened was, that because the number of planets was so low, the main "largest" ring got set to 2 planets (rather than the intended minimum of 10 or 12).

No problem. I also noticed that even on larger planet sizes there's still a mismatch. The map design concept works well for a scenario / faction mod I'm working towards building in anticipation of coop multiplayer', so fingers crossed you can fix it. :)

Offline Draco18s

  • Resident Velociraptor
  • Core Member Mark V
  • *****
  • Posts: 4,226
Re: Map Generation - Linked Rings doesn't work correctly
« Reply #11 on: January 17, 2020, 09:42:16 AM »
No problem. I also noticed that even on larger planet sizes there's still a mismatch. The map design concept works well for a scenario / faction mod I'm working towards building in anticipation of coop multiplayer', so fingers crossed you can fix it. :)

I should be able to, just will take me another evening or two.
(And the count mis-match will take some more work)

Offline Draco18s

  • Resident Velociraptor
  • Core Member Mark V
  • *****
  • Posts: 4,226
Re: Map Generation - Linked Rings doesn't work correctly
« Reply #12 on: January 17, 2020, 10:19:36 PM »
Ended up scrapping everything and rewriting this generator from scratch. There were just a lot of things about it that were not working right and the code was a mess, so I just nuked it.

Offline Sounds

  • Full Member Mark II
  • ***
  • Posts: 173
Re: Map Generation - Linked Rings doesn't work correctly
« Reply #13 on: January 18, 2020, 10:12:04 AM »
Ended up scrapping everything and rewriting this generator from scratch. There were just a lot of things about it that were not working right and the code was a mess, so I just nuked it.
Did you do it from orbit? It's the only way to be sure. ;)

Offline Draco18s

  • Resident Velociraptor
  • Core Member Mark V
  • *****
  • Posts: 4,226
Re: Map Generation - Linked Rings doesn't work correctly
« Reply #14 on: January 18, 2020, 03:26:38 PM »
Ended up scrapping everything and rewriting this generator from scratch. There were just a lot of things about it that were not working right and the code was a mess, so I just nuked it.
Did you do it from orbit? It's the only way to be sure. ;)

No, I wasn't close enough to be gravitationally bound to it. ;)