I'm already about 95% done with such a project, but the remaining 5% is a killer, and I suspect I'll need to start over (again) with a still more rational model. I tend to write code in "drafts", ie write it once to figure out where the real problems are, then rewrite it differently to more elegantly solve those problems.Originally posted by robject:
Hey, Flight Commander man, perhaps we should put our Perl together and come up with a Book 6 extended star system generation program -- one specifically designed to take official sector data and churn out full system details in some format that is extremely easy for Perl to re-read in.
Were you able to find a formula, or did you use a table?Originally posted by robject:
My cut at the 'find the neighbouring hexes' problem .
Indeed it wasn't, that was a cut-n-paste tragedy on my part. I meant to direct that to kaladorn .Originally posted by robject:
Re: neighboring hexes. That wasn't my post.
It does...whence my laboriously-cobbled tables back on page three! It would be nicer to know a forumula to derive the locations, although the lookup table might be faster.However, the list of neighboring hexes might depend on whether the hex of origin is odd or even... beyond that I can't see far.
Cool, I'd be interested in comparing it speedwise to the table method. I tested your page against my code (slightly modified to handle boundaries), using a number of different hex locations, and came up with the same result sets, which is good.Originally posted by kaladorn:
I did not use a table, this is done programmatically. There are actually 8 different cases of interest and I have them modelled.
I'll clean up and comment the code and get it linked.
In using Far Trader's tables, and the following asumptions - the answer for your question about how far one needs to go to generate trade routes is:Originally posted by kaladorn:
Can you see a reason you'd want to use this for distances over 8 or 10 hexes? (I'm assuming that's where trade drops off the map in GT:FT).
So speed probably doesn't matter as any of ours solutions work here. I just liked mine because it didn't involve a distance calculation for each hex and then failing some of them.
Great idea!Originally posted by kaladorn:
If I can calculate the six vertices of the larger hexagon my 'radius' will create, I can immediately *infer* all of the hexes in between these six points, and then all the hexes they contain. I haven't tried this approach, but you can do it manually on paper.
The only time the efficiency of this function would matter (to me) is when generating the graph of systems reachable from other systems. Eg, if I want to generate routes from Regina to Kinorb, I need to know all the potential legs of the journey, which is where this function comes in.I'm not sure performance matters...
To find a route from A to B, you first need to find a way to get from A to somewhere else that might be B. To get to that somewhere else, you need to know hexes that are JN-reachable from A, whence the need for the JN neighborhood function.Originally posted by kaladorn:
In the other case, travel routes, I think this is *not* repeat *not* the approach to take. It is a very compute intensive solution to this problem. You may use it to find all points within "ship jump number" of a point along the way, but that still limits to six.