How you keep this updated coliver. I started work on a similar stand alone single player game about a year ago. After putting it away some months ago your post has invigorated me to start back up.
It's written in VB.net (XML literals are a gas!). I played around with MY SQL for database stuff, but found that XML is much easier and simpler for the really small amount of data you need. I used another app I made to turn the COREdata into a known space xml db:
Code:
<Imperium Name="Charted Space">
<World Sector="eC">
<HexLocation>0101</HexLocation>
<Name>Zeycude</Name>
<UWP>C330698-9</UWP>
<Starport>C</Starport>
<Size>3</Size>
<Atmosphere>3</Atmosphere>
<Hydrosphere>0</Hydrosphere>
<Population>6</Population>
<Government>9</Government>
<LawLevel>8</LawLevel>
<TechLevel>9</TechLevel>
<Bases></Bases>
<TradeCodes>Na Ni Po De</TradeCodes>
<TravelZone></TravelZone>
<PBG>613</PBG>
<PopMultiplier>6</PopMultiplier>
<Belts>1</Belts>
<GasGiants>3</GasGiants>
<Allegiance>Zh</Allegiance>
<GDP>1380000000</GDP>
</World>
The travel codes are actually created while parsing the COREdata file into this xml file. (I have another xml file that is much larger that includes the BasePrice and CargoUCP)
The player can select Sector and then planet to start out on:
The ship is then selected. Another XML file:
Code:
<?xml version="1.0" encoding="utf-8"?>
<Ships>
<Ship Type="Type A Free Trader">
<ShipClass>Hero</ShipClass>
<Cost>37080000</Cost>
<ShipTons>200</ShipTons>
<IsStreamlined>True</IsStreamlined>
<JumpRating>1</JumpRating>
<JumpFuel>20</JumpFuel>
<HasScoops>True</HasScoops>
<HasPurification>False</HasPurification>
<ManeuverGs>1</ManeuverGs>
<PowerPlantFuel>10</PowerPlantFuel>
<ComputerModel>Model/1</ComputerModel>
<Cargo>82</Cargo>
<Staterooms>10</Staterooms>
<Passengers>6</Passengers>
<LowBerths>20</LowBerths>
<Crew>4</Crew>
<CrewDesc>Pilot, Engineer, Medic, and Steward</CrewDesc>
<CrewExpense>15000</CrewExpense>
<SmallCraft></SmallCraft>
</Ship>
This is the main interface, with a box containing the possible destinations within range:
The top left image icon (hand exchanging money) bring you to The Exchange:
I'm impressed that you are attempting to cover all the different trade sytems. Just doing CT/Merchant Prince is a handfull.
Also, like the log/noted sections and I agree a decent printing class is hard to do.
As far as calculating systems within jump range, here are the functions I used (it's in VB.net but I'm sure you can translate):
Code:
Public Function CalcDistance(ByVal SourceWorldLoc As String, ByVal DestWorldLoc As String)
Dim X1 As Integer
Dim X2 As Integer
Dim Y1 As Integer
Dim Y2 As Integer
Dim Xd As Integer
Dim yoff As Integer
Dim ymin As Integer
Dim ymax As Integer
Dim ymod As Integer
Dim distance As Integer
X1 = CInt(Microsoft.VisualBasic.Left(SourceWorldLoc, 2))
Y1 = CInt(Microsoft.VisualBasic.Right(SourceWorldLoc, 2))
X2 = CInt(Microsoft.VisualBasic.Left(DestWorldLoc, 2))
Y2 = CInt(Microsoft.VisualBasic.Right(DestWorldLoc, 2))
Xd = Math.Abs(X1 - X2)
yoff = Xd \ 2
If (X1 Mod 2 = 1) And (X2 Mod 2 = 0) Then yoff += 1
ymin = Y1 - yoff
ymax = ymin + Xd
ymod = 0
If Y2 < ymin Then ymod = ymin - Y2
If Y2 > ymax Then ymod = Y2 - ymax
distance = Xd + ymod
Return distance
End Function
Public Function HexArray(ByVal originWorldLoc As String, ByVal jumpNumber As Integer)
Dim returnedArray As New ArrayList()
Dim hexLoc As String
Dim Xorg As Integer = CInt(Microsoft.VisualBasic.Left(originWorldLoc, 2))
Dim yorg As Integer = CInt(Microsoft.VisualBasic.Right(originWorldLoc, 2))
For x = (Xorg - jumpNumber) To (Xorg + jumpNumber)
For y = (yorg - jumpNumber) To (yorg + jumpNumber)
hexLoc = CStr(Format(x, "00")) & CStr(Format(y, "00"))
returnedArray.Add(hexLoc)
Next
Next
Return returnedArray
End Function
Public Function JumpMap(ByVal originWorldLoc As String, ByVal jumpRange As Integer)
Dim reachableList As New ArrayList()
Dim reachable As New ArrayList()
reachable = HexArray(originWorldLoc, jumpRange)
For Each hexloc In reachable
If hexloc = originWorldLoc Then Continue For
Dim inRange As Integer
inRange = CalcDistance(originWorldLoc, hexloc)
If inRange <= jumpRange Then
reachableList.Add(hexloc)
End If
Next
Return reachableList
End Function
As you can see these three fuctions create a map of hex numbers within jump distance of the ships origin world. This reachableList of hex number is compared to the sector info and the listbox on the main view shows the possible destinations and jump distance.
I really only got about as far as navigating thru the sector, refueling, and buying trade goods. Still need to add freight, passengers and some mechanism to hire/fire crew members. Lots on the list...
Keep us up to date!