|Headline:||Going around in Circles. Pretty, Pretty circles|
|Date:||Sunday, April 21, 2019|
|Posted By:||Plaid Hatter Games|
On a Naval vessel, every space on the ship is given a number based on a Standardized Compartment Numbering Scheme. For a US Navy vessel, the number looks something like: O1-241-4. O1 tells you that it's the first deck above the main deck. 241 is a frame number, a rough distance from the front of the vessel. 4 tells you that the space is the second compartment from the centerline on the port side.
While that number system is kind of cool, it really only useful for a sea going vessel. The number scheme assumes a lot about the shape of the ship. Details I can't make use of because I have 6 spheres with no definite "front" or "port". Even "Up" and "Down" are subject to change.
The first few steps are pretty easy. I have 6 spheres. I can just label each of the Spheres with a letter, A-F. The levels are a pretty simple too. The lowest habitation level is deck 1. The Deck below that level is L1. The decks then count up from 1 to the top of the sphere, and from L1 down to the bottom of the sphere.
The head scratcher now is how to address areas on a deck. I wracked my head for a while before I came up with the solution. (Here's the code:)It's pretty algorithmic, but let me just show you a picture of it first, and then I'll explain:
The sytem is based on the idea that we want to divide each floor into roughly equal sized pieces. At the same time, you want to get a sense of how far from the center this region of deck is, and roughly what direction. I borrowed a little from the old concept of disk drives with tracks and sectors. The first number is a track number. The last three digits are the angle (in degrees) of the clockwise-most boundary of the region.
A Complete location would look like: A-1-3030. A - The A sphere. 1 - the lowermost habitation deck. 3 - track three. 030 - The sector that starts at 30 degrees.
Calculating how to break up the ship this way required quite a bit more math. I start with a unit area, equivilent to a circle that is 10 meters in radius. That works out to ~314 meters square, or ~3380 square feet.
Track 1 is never segmented. Between track 1 and track 2, and every other track to follow, we leave a 3 meter gap for a hallway. We also leave a 3 meter gap between the outermost track and the skin of the vessel. (This ensures that there are always 2 roads that can reach a sector. Important for emergency vehicles.)
All tracks (other than 1) must be divided into a number of sectors that is a multiple of 6. That formula gives us those nice 6 arterial roads you see. We then calculate how thick that track would have to be to provide an area for those divisions that is a rough approximation of our unit area, while still coming out to a nice round number.
From track 2 outward we add 6 new divisions with every track. When we reach the outermost track, we just run it out to the skin of the ship, subtract our safety corridor, and then just pick a number of sectors that is divisible by 6 and gives us our closest approximation to our unit area per sector. The outer tracks are going to be the sloppiest, but every systems has its limitations.
What is really nice is this system nicely handles nuances like the fact the radius of the floor is constantly changing. Take this case (L14, where the sphere is curving the most):
Or this (L20, the deck at the bottom of the sphere):
I could give someone a sector number, and they would be able to find where on the ship to go to get to that sector.
Here are all of the decks from my run of the sector-izer: