extends RefCounted # Forgejo #129 / #133: the quest chain. # # One place, in order, and nothing but data. GameState answers each goal and # QuestDirector reads each line out; neither of them knows what the quests # ARE, so adding one here is the whole job of adding one. # # Two rules the chain obeys, both learned from the game rather than chosen: # # 1. Nothing here may ask for something the player cannot yet reach. The # sharp edge is RESEARCH POINTS - they come only from conquering a # planet (GameState.mark_garrison_enemy_destroyed), so every node with a # research_points cost sits after `conquest` below. Ore-only nodes - # Shipyards, Logistics - may come before it. # 2. A quest names ONE goal, and the brief says what it will take. Asking # for a gas burner is asking for the Power Systems research too; that # belongs in the sentence, not in a second entry, or the chain turns # into a list of errands. # # The whole story turns on `mothership`: the fleet builds a transmitter, # calls the World Ship, and hears nothing - not because the array is weak # but because the breach put them further out than anyone has been. Every # quest after it is a search. # There is nobody left to talk to, so the quests are the ship talking to # itself - the same voice the prologue ends on (IntroDirector.SHIP_LOG). const SPEAKER: String = "KESTREL - LOG" # Goal kinds. Each is one line in GameState.quest_progress(). const GOAL_RESOURCE: String = "resource" const GOAL_BUILDING: String = "building" const GOAL_FLEET_VESSEL: String = "fleet_vessel" const GOAL_VESSEL_UNLOCKED: String = "vessel_unlocked" const GOAL_EXPLORE: String = "explore" const GOAL_PLANET_VISITS: String = "planet_visits" const GOAL_PLANET_KINDS: String = "planet_kinds" const GOAL_CONQUERED: String = "conquered" # #141: researching a doctrine, as a step of its own. The chain used to fold # it into the brief of the thing it unlocks ("spend ore on Shipyards, then # put a crafter down"), which asks the player to do two unrelated things - # open a menu they have never opened, and place a structure - off one line. const GOAL_RESEARCH: String = "research" # #156: what is in the BANK, which is a different question from what the # player can lay hands on. GOAL_RESOURCE counts the hold as well, and the # hold is exactly what this quest is about being too small. const GOAL_BANKED: String = "banked" # #163: a vessel actually STATIONED at an outpost. Building one and crewing it # are two different acts - the chain teaches the second, because an empty # outpost holds nothing and the player has no reason to discover the hangar # that fills it. const GOAL_GARRISONED: String = "garrisoned" # #216 made transporters and repair drones things the player builds and # assigns, which is two steps nothing in the game explained. These are the # goals that teach them: one vessel of a type existing ANYWHERE, and one # actually standing at the structure that uses it. const GOAL_VESSEL_BUILT: String = "vessel_built" const GOAL_STATION_CREW: String = "station_crew" # #219 made a berth in the fleet a structure that has to be SUPPLIED, and a # player who learns that by watching a vessel destroyed has learned it the # expensive way. This goal is "there are resources sitting in the thing", # which is the step to teach before the berth is ever crewed. const GOAL_BUILDING_STOCK: String = "building_stock" # One NAMED world, rather than "four different kinds". The tentacle world is # a place the story sends the player to, so the chain has to be able to say # "go there" and know when they have. const GOAL_WORLD_VISITED: String = "world_visited" # #167: which quests carry the STORY, marked `"important": true` below. # # Most of the chain is teaching: bank some ore, place a crafter, open the # hangar. A teaching quest handed to a player who has already done the thing # has nothing to teach, and stopping the game twice to say so - once for the # brief, once for the answer - is two dialogs about nothing. Those are # skipped (GameState._advance_quests); they still land in the DONE list, so # the player sees they were credited rather than lost. # # The ones marked here are different. They are the search for the World Ship # - the wreck we start in, the call that gets no answer, the first world, the # ground somebody else was already holding, the survey, the trail - and their # lines are the plot rather than instructions. Those are read out whether the # goal was already met or not, because skipping one drops a piece of the # story on the floor. const CHAIN: Array = [ { "id": "first_ore", "title": "SALVAGE", "objective": "Break asteroids for 5 ore", "goal": {"kind": GOAL_RESOURCE, "resource": "ore", "amount": 5}, "brief": "The hull holds. The reactor runs. Everything else we had is on the far side of that hole. These rocks carry ore. Break some, and we can start again.", "done": "Five ore in the hold. It is not much, but it is a start.", "important": true, }, { # #142: the gap this fills was a real one. "Collect 5 ore" was # followed straight by "build the mothership", which costs twenty - # so the first thing the chain ever asked for was four times what it # had just taught, with nothing saying so. "id": "stockpile", "title": "THE PILE", "objective": "Break asteroids for 20 ore", "goal": {"kind": GOAL_RESOURCE, "resource": "ore", "amount": 20}, "brief": "Now do that four more times. Five ore builds nothing, and there is nothing else out here to spend it on yet.", "done": "Twenty in the hold. Now we can build something.", }, { "id": "mothership", "title": "A PLACE TO STAND", "objective": "Build the mothership", "goal": {"kind": GOAL_BUILDING, "building": "mothership"}, "brief": "A ship is not a base. Build the mothership. It carries the only transmitter big enough to call the World Ship.", # The hinge of the whole chain (#129): the answer to "we built the # transmitter" is that the transmitter was never the problem. "done": "The mothership is online. Calling the World Ship. Calling. Nothing comes back, and the transmitter is not at fault. The breach threw us further out than any signal of ours will carry. So we find their trail ourselves, or we never find them.", "important": true, }, { "id": "chart", "title": "DEAD RECKONING", "objective": "Chart 30 sectors", "goal": {"kind": GOAL_EXPLORE, "sectors": 30}, "brief": "So we search. Fly, and the map fills in behind us. Their course is somewhere in it.", "done": "Thirty sectors charted. No sign of the World Ship, but the map behind us is no longer blank.", "important": true, }, { # #141: its own step, and the first time the chain sends anyone into # the research tree at all - so the brief says where the tree IS. # Every later quest that needs a doctrine only mentions it in # passing, which is enough once the player has been there once. "id": "shipyards", "title": "SHIPYARDS", "objective": "Research the Shipyards doctrine", "goal": {"kind": GOAL_RESEARCH, "node": "shipyards"}, "brief": "One ship cannot chart a whole sky, and we have forgotten how to build more. The mothership holds the archive. Go aboard and research Shipyards.", "done": "Shipyard plans recovered. There is more in that archive, if we go back for it.", }, { "id": "crafter", "title": "A YARD OF OUR OWN", "objective": "Build a ship crafter", "goal": {"kind": GOAL_BUILDING, "building": "ship_crafter"}, "brief": "Now build a ship crafter. Ore goes in, ships come out. It is the only way this fleet grows past the one hull that came through the breach.", "done": "The yard is running. We can build our own ships now.", }, { "id": "planetfall", "title": "PLANETFALL", "objective": "Land on a planet", "goal": {"kind": GOAL_PLANET_VISITS, "count": 1}, "brief": "There are worlds out here. Fly the fleet close to one and land on it. A surface holds more than all this empty dark.", "done": "We are down on solid ground. Whatever else this place is, it is somewhere.", "important": true, }, { "id": "conquest", "title": "GROUND HELD", "objective": "Destroy every defender on one planet", "goal": {"kind": GOAL_CONQUERED, "count": 1}, "brief": "Something reached this surface before us, and it is still holding it. Kill what is defending it and the planet is ours. What we pull out of their camps is worth more than the ore.", # Says out loud where research points come from, because nothing # else in the game does. "done": "The planet is ours. Their machines gave us research data, the first we have had. Every doctrine worth having will cost some.", "important": true, }, { # #156: the extractor is the first thing the chain asks for that # cannot be paid for out of a single hold. An interceptor carries 20 # and the fleet is small; the mothership is where anything larger # than one trip has to accumulate, and nothing had ever said so. "id": "deposit", "title": "THE HOLD IS SMALL", "objective": "Bank 60 ore at the mothership", "goal": {"kind": GOAL_BANKED, "resource": "ore", "amount": 60}, "brief": "Each ship carries twenty units and no more, and we are going to need more than twenty. Fly what we have back to the mothership and unload it. What is stored there stays there.", "done": "Sixty in the vault. A hold empties on the next trip out. A vault does not. Everything from here on depends on that.", }, { # #219 moved fleet capacity onto the Fleet Office, so a second hull # became impossible until one is standing - this quest used to sit # before the crafter and could not be finished at all. The three # steps below it are the ones that make it reachable, in the order # the player has to do them. # # The office is asked for AFTER banking is taught: it costs more ore # than one hull can carry in a single trip. "id": "berth_authority", "title": "BERTH AUTHORITY", "objective": "Research the Berth Authority doctrine", "goal": {"kind": GOAL_RESEARCH, "node": "berth_authority"}, "brief": "We fly alone because we have nowhere to keep anyone else. Research Berth Authority - it costs ore and no research data - and we can build the offices that hold a berth.", "done": "We can build Fleet Offices now. Each one is a berth, and each one has to be paid for.", }, { "id": "fleet_office", "title": "A BERTH", "objective": "Build a Fleet Office", "goal": {"kind": GOAL_BUILDING, "building": "fleet_office"}, "brief": "Put up a Fleet Office. It buys room in the fleet for one more vessel - not the vessel, the room.", "done": "One berth stands ready. It is empty, and it is already hungry.", }, { "id": "office_stocked", "title": "PAID IN ADVANCE", "objective": "Put 20 ore into the Fleet Office", "goal": {"kind": GOAL_BUILDING_STOCK, "building": "fleet_office", "resource": "ore", "amount": 20}, "brief": "A berth is not free to hold. The office spends resources on the vessel in it, over and over, and takes them from its OWN store - fly to it and transfer ore in before you crew it.", # Said plainly, because the alternative way to learn it is to watch a # vessel you paid for be destroyed. "done": "The office has something to spend. Keep it that way: an office that runs dry loses the vessel it was keeping, and it will not be given back.", "important": true, }, { "id": "second_hull", "title": "A SECOND HULL", "objective": "Fly two vessels at once", "goal": {"kind": GOAL_FLEET_VESSEL, "vessel": "interceptor", "count": 2}, "brief": "The berth is open and stocked. Order an interceptor at the yard and crew it. Two ships is not a fleet, but it is twice what we flew out of the breach with.", "done": "Two ships in formation. It has been a long time since we flew with company.", }, { "id": "extractor", "title": "STANDING MINE", "objective": "Build an extractor on a planet", "goal": {"kind": GOAL_BUILDING, "building": "extractor"}, "brief": "Research Logistics, then place an extractor on a planet. It keeps digging whether we are standing over it or not.", "done": "The extractor is digging. The ore will be waiting when we come back for it.", }, { "id": "gas", "title": "THE HEAVY AIR", "objective": "Bring back 25 gas", "goal": {"kind": GOAL_RESOURCE, "resource": "gas", "amount": 25}, "brief": "The striped worlds are full of gas, and gas is the only thing out here that burns. Take the fleet into one and fill the tanks.", "done": "Twenty-five gas aboard. Now we need something that can burn it.", }, { "id": "hub", "title": "FREIGHT", "objective": "Build a transport hub", "goal": {"kind": GOAL_BUILDING, "building": "transport_hub"}, "brief": "Hauling every load ourselves is slow. Research Freight Handling and build a transport hub. It runs the routes for us - once there is something in it to fly them.", "done": "The hub is up. It is empty, though: the vessels that fly its routes are ours to build.", }, { # #216 took the free transporters away, so the hub above arrives empty # and the player has to be told what to do about it. Two steps, not # one: building a vessel and assigning it are separate acts in # separate places, and a single quest covering both leaves whoever # missed the second one staring at a hub that does nothing. "id": "transporter_built", "title": "ROLLING STOCK", "objective": "Build a transporter at a ship crafter", "goal": {"kind": GOAL_VESSEL_BUILT, "vessel": "transporter", "count": 1}, "brief": "The hub has no vessels of its own. Order a transporter at a ship crafter - the hub being built is what puts it on the list - and it will fly to the mothership when it is done.", "done": "A transporter is parked at the mothership. It is no use to anyone there.", }, { "id": "transporter_assigned", "title": "PUT TO WORK", "objective": "Assign a transporter to the transport hub", "goal": {"kind": GOAL_STATION_CREW, "capability": "transport_hub", "count": 1}, "brief": "Open the hub and ask it for one transporter. It will fly out from the mothership on its own and start running the routes.", # The wear is the part a player will not guess, and finding out by # watching a route quietly stop is a bad way to learn it. "done": "The hub is working. That transporter will wear out after a run of trips, and the hub will not replace it - watch its condition and build another before it goes.", "important": true, }, { "id": "lab", "title": "SHIP SCIENCE", "objective": "Build a ship lab", "goal": {"kind": GOAL_BUILDING, "building": "ship_lab"}, "brief": "Research Vessel Science and build a ship lab. It makes the ships we fly better, and it opens designs we have never built.", "done": "The lab is open.", }, { # Bombers hang off the transporter pair because they are the first # thing the player builds for a REASON rather than because the chain # said so - and the ship lab above is where a vessel is unlocked, so # it has to come first. "id": "bomber_research", "title": "ORDNANCE", "objective": "Unlock the Gas Bomber", "goal": {"kind": GOAL_VESSEL_UNLOCKED, "vessel": "gas_bomber"}, "brief": "Interceptor fire is one hull at a time. Unlock the Gas Bomber at the ship lab - it costs gas and research data - and we can clear a whole camp at once.", "done": "The bomber is on the crafter's list. It throws a charge that blooms where it lands.", }, { "id": "bomber_built", "title": "A HEAVY HAND", "objective": "Fly a Gas Bomber", "goal": {"kind": GOAL_FLEET_VESSEL, "vessel": "gas_bomber", "count": 1}, "brief": "Order one at a crafter and crew it. Aim it by dragging from its button; the further you drag, the further it throws.", "done": "We are carrying ordnance now. Ground that took a long fight before takes one throw.", }, { "id": "planet_scanner", "title": "LISTENING POST", "objective": "Build a planet scanner", "goal": {"kind": GOAL_BUILDING, "building": "planet_scanner"}, "brief": "Blind searching is wasting our reach. Research Deep-Space Scanning at the mothership, then build a planet scanner. Give it a world signature and it will put the nearest match on our map.", "done": "The scanner is listening. Now we can choose where the search goes next.", }, { # The scanner earns its place here: it is the only way to FIND a # research lab world, and a lab world is the only thing that pays # research data in quantity. Before the burner, because everything # past it wants data the player has no reliable way to get yet. "id": "lab_world", "title": "SOMETHING WORTH TAKING", "objective": "Find and take a research lab world", "goal": {"kind": GOAL_CONQUERED, "definition": "research_lab", "count": 1}, "brief": "Scan for a research lab. Whatever was working there left its data behind, and taking one pays far better than an ordinary world - every doctrine worth having is waiting on it.", "done": "Their lab is ours, and so is what they were working on. That is where research data comes from: take the worlds that have it.", "important": true, }, { "id": "burner", "title": "POWER", "objective": "Build a gas burner", "goal": {"kind": GOAL_BUILDING, "building": "gas_burner"}, "brief": "Research Power Systems and build a gas burner. Gas in, energy out. The better weapons run on energy.", "done": "The burner is lit. This fleet has power again for the first time since the breach.", }, { "id": "shield", "title": "A NEW HULL", "objective": "Unlock the shield vessel", "goal": {"kind": GOAL_VESSEL_UNLOCKED, "vessel": "shield"}, "brief": "The archive holds a shield ship. Unlock it at the lab. So far the fleet has taken every hit on bare hull.", "done": "The shield ship is unlocked. There is more than one design in that archive.", }, { "id": "outpost", "title": "FORWARD BASES", "objective": "Build an outpost", "goal": {"kind": GOAL_BUILDING, "building": "outpost"}, "brief": "We cannot be everywhere at once. Research Forward Bases and build an outpost. Ships stationed there hold ground we are not standing on.", "done": "The outpost is up. That is one place we no longer have to fly back to.", }, { "id": "garrison", "title": "STANDING WATCH", "objective": "Station a vessel at the outpost", "goal": {"kind": GOAL_GARRISONED, "count": 1}, "brief": "An empty outpost is only a building. Open its hangar and station a ship there. It will hold that ground whether we are there or not.", "done": "The outpost has a crew. It watches that approach now, so we do not have to.", }, { "id": "worlds", "title": "THE SURVEY", "objective": "Land on four different kinds of world", "goal": {"kind": GOAL_PLANET_KINDS, "count": 4}, "brief": "Rock, gas, the abandoned labs, and the lightless wells. Use the scanner and land on all four kinds of world. If the World Ship came this way, it passed something.", "done": "Four kinds of world surveyed. No convoy—but their signatures resolve a fifth signal, hidden inside something alive.", "important": true, }, { "id": "propulser", "title": "A LONGER REACH", "objective": "Build an Energy Propulser vessel", "goal": {"kind": GOAL_FLEET_VESSEL, "vessel": "distorder", "count": 1}, "brief": "The trail may run far beyond this cluster. Unlock an Energy Propulser at the ship lab, build one at the yard, and crew it. Its drive will let the whole fleet search faster.", "done": "The Energy Propulser is in formation. We can cast the search wider now.", }, { "id": "trail", "title": "THE TRAIL", "objective": "Chart 150 sectors", "goal": {"kind": GOAL_EXPLORE, "sectors": 150}, "brief": "Then we search wider. A hundred and fifty sectors, and every one of them looked at properly. They are out there somewhere.", "done": "A hundred and fifty sectors charted, and still no trail - but the scanner has been carrying a signature it could not place, and now there is enough of the map behind us to place it.", "important": true, }, { # The scanner will not offer this world until this quest is live: it # is a destination the story hands over, not something to stumble # into while looking for ore. See GameState.scanner_can_find_boss(). "id": "tentacles", "title": "THE SIGNATURE", "objective": "Land on the tentacle world", "goal": {"kind": GOAL_WORLD_VISITED, "definition": "boss"}, "brief": "One signature on the scanner matches nothing we have charted, and everything near it is dead. Scan for it and go down there. Whatever is holding that world is what has been out here with us the whole time.", "done": "We are on the surface, and it is awake. It has been waiting a long time for someone to come down.", "important": true, }, { "id": "warden", "title": "THE WARDEN", "objective": "Destroy the Warden", "goal": {"kind": GOAL_CONQUERED, "definition": "boss", "count": 1}, "brief": "It is between us and everything past this place. Bring what the fleet has - the beam reaches furthest, the bomb hits hardest - and take its world off it.", "done": "The Warden is dead and its world is ours. Whatever it was keeping out there, nothing is keeping it any more.", "important": true, }, ] static func count() -> int: return CHAIN.size() # Where a quest sits in the chain, or -1 for an id that is not in it. Used to # gate world state on the story having reached a point (#: the tentacle world # is hidden from the scanner until the chain sends the player after it). static func index_of(quest_id: String) -> int: for i in range(CHAIN.size()): if String(CHAIN[i].id) == quest_id: return i return -1 static func at(index: int) -> Dictionary: if index < 0 or index >= CHAIN.size(): return {} return CHAIN[index] # #167: whether a quest's lines are the story rather than instructions. Only # these are said when the goal was already met the moment it was handed out. static func is_important(quest: Dictionary) -> bool: return bool(quest.get("important", false)) static func by_id(id: String) -> Dictionary: for quest in CHAIN: if String(quest.id) == id: return quest return {}