After a good coding day I’m proud to say that it looks like the good end to begin with (downside-up), I’ve come up with a good file formatting:
<Mission> <MissionCode></MissionCode> <!-- Mission unique code --> <MissionTitle><MissionTitle/> <MissionType></MissionType> <!-- Secondary,Primary,PrimaryChoice (autosave), Generic --> <Prerequisite> <SystemName></SystemName> <SystemFaction></SystemFaction> <PlanetName></PlanetName> <PlanetFaction></PlanetFaction> <PlanetType></PlanetType> <!-- sand, ocean, ice, void,... --> <PlanetLevel></PlanetLevel> <PlayerStanding></PlayerStanding> <!-- combat rating--> <PlayerFactionStanding> <Faction></Faction> <Standing></Standing> <!-- Faction behaviors --> </PlayerFactionStanding> <Count> <Ship> <ShipType></ShipType> <ShipFaction></ShipFaction> </Ship> <FreeCargo></FreeCargo> <CargoObject></CargoObject> <Equipment></Equipment> <Money></Money> <Number></Number> <Sign></Sign> <!-- used to get "at most" or "at least" info --> </Count> </Prerequisite> <MissionText></MissionText> <MissionChoices> <Choice> <Label></Label> <Code></Code> <!-- empty if last mission in the stream --> <File></File> <!-- empty if same file --> </Choice> </MissionChoices> <MissionActions> <SummonShip> <Type></Type> <Faction></Faction> <Number></Number> </SummonShip> <Money></Money> <CargoObject> <Object></Object> <Sign></Sign> <!-- used to know if adding or removing (end of a transport mission) --> </CargoObject> <Equipment></Equipment> <Ship></Ship> <FactionStanding> <Faction></Faction> <Sign></Sign> <!-- always + or - 1 in standing --> </FactionStanding> <PlayerStanding></PlayerStanding> </MissionActions> </Mission>
Each element inside the big parts (Prerequisites, Choices, Actions) being removable or duplicable to allow good flexibility. You can put several missions from the same « mission stream » in the same file to avoid having thousands of mission files.
With this format I can for example:
– make an empty mission for summoning pirate ships
– make a new mission to check for their destruction, output a text of thanks from the planet
– make a new mission to check landing on the right planet and link to another mission while giving the player a new ship
I think it’ll be flexible enough to allow every mission we want for the moment…
I use several objects to describe this in the code:
– a Mission object, cursor on the actual mission info in a set mission stream.
– a MissionCheck, that is contained in a list in the Mission object, each on contains the info of his own check and the means to check itself for completion.
– a MissionChoice, (because a good small structure is sometimes better than linking lists logically) to store the infos on the next mission-code/file for each end-mission choice.
And now I’m up to the MissionManager which will store all the missions and ask them to check their completion conditions every 2-3 seconds (not necessary to check it every update I think).
Next post will be about the gameplay aspect of missions as I was asked about it 😉