This entry is part 6 of 9 in the series Artificial Galaxies

So we’ve got a great framework in place (if I do say so myself!) and it’s pretty neat. I’ve created a bunch of ships, and have them flying to random stars.

But what about territories? You know, you got your group of stars, and you wanna represent to the rest of the galaxy that “Hey! This is MY territory. Woe unto those who transgress into it! I am the mighty Nabzorg Empire and not to be messed with!!”

So the polygonal border, first picture above, is pretty neat how it gets it. It grabs the outermost stars that will form a convex polygon. For a refresher, here’s the difference between convex and concave:

Which works out fine for now, except a few niggling items:

  • It will disregard whether you OWN any of the encompassed stars, it just grabs the outermost of the ones you do own and makes a polygon around the territory. Great and all, except what happens if you colonize one across the whole map? Then it’ll include that one too lol!! That could make for some funny looking territories.
  • Territories can overlap. Sure, we can check to see if a star exists in someone else’s territory polygon, but what about line intersects? Hmm gonna have to dig in to the maths library…
  • ……hmmm, those are the only two big ones I can think of right now. Not a super big deal, but at least it doesn’t crash

So next I tried the segmented maps popularized(?) by the first Star Trek: Starfleet Command game:

Well heck, this is gonna take more math work. The above is sort of similar to what’s known as a Voronoi mapping, and Delaunnay triangulation. Here’s another more simple view of what we’re after:

Ideally, we’d have our star in the center of the area, colored in with whichever empire owned it. Then the borders would be nice and distinct. EXCEPT I can’t seem to make it run properly (which is why I took so long with this post!) dang it. But its’ like they say, perfection is the enemy of progress or productivity. Besides, hopefully we’re both learning, dear reader. 🙂 

PS: Aliens

Series Navigation<< Ships, Galaxy functions, and more!Serialization, loading and saving! >>