Page 2 of 2

Re: Questions About Event Namespaces

Posted: Mon May 13, 2013 11:19 pm
by rhaining
I have a similar question. I'm posting it in this thread as the folks here may know the answers.

I'm interested in doing some detailed statistical anlysis on FTL event data. (For example, given you are in X sector type, and the beacon appears with Y icon, what are the different types of events it could be, and how likely is each event?)

Unfortunately the event data is a bit of a mess making it hard to fully reverse-engineer what is possible. Here are my specific questions:

1. Is "sectorDescription" (found in sector_data.xml) the ONLY way the game uses to generate in-game events? I ask because "eventCounts" (in newEvents.xml) appears to do the same thing, and given that it's called "newEvents.xml", you'd think it was newer. As near as I can tell, "newEvents.xml" was hacked up for a convention or some such and a big chunk of the content in this file is no longer used, including "eventCounts".

2. Assuming "sectorDescription" is the only thing used, are the list of events in this element the exact list of events that will appear in the sector -- no more, no less? I ask because "eventCounts" has a comment that implies additional beacons will be added from a hard-coded random list.

3. Do quests overwrite events that used to be at those beacons? If so, do they only overwrite certain types of events? If not, can you get the 2nd half of a quest w/o activating the quest?

4. Is there a way to determine which elements can be called directly from the game and which can only be reached via other XML elements? Some of these events appear completely unreachable and unused, but OTOH, the game appears to hardcode entry points into these data files, so it's difficult to say if any given section is reachable or not.

5. Is the sector "STANDARD_SPACE" ever used?

Any hints about how to precisely deterime the event pool for a given sector are appreciated. Any hints about how to cull event files of events that cannot be reached during normal gameplay are also appreciated.

Re: Questions About Event Namespaces

Posted: Tue May 14, 2013 1:06 am
by rhaining
P.S.: A very quick/dirty/tiny survey of ~15 sector pics leads me to this theory:

A sector will have 20-24 beacons in it including entrance and exit. Entrance will always be empty (no event) except in sector 8 (special event for final mission prep). Non-nebula exit usually (always?) has an event but it will not be a hostile ship encounter (which implies the exit beacon event is taken from a different pool). Nebula exit will always be empty (no event). For all other beacons, the game does this:

* Create a temporary holding container.
* For each "event" element for that sector type, choose a random number between min and max (inclusive and uniformly distributed, not normally distributed). Add this number of that event type to the temp container.
* For each non-entrance, non-exit beacon, randomly choose one out of the temp container and remove it from the container. If the event container is empty, assign a NEUTRAL class event to that beacon instead.

So if the container has more than (number of beacons in sector minus 2), some events in the container will be unused. And if the container has less than (number of beacons in sector minus 2), the remainder will be NEUTRAL.

Can anyone confirm/deny this theory? And/or provide the exact algorithm used?

Re: Questions About Event Namespaces

Posted: Tue May 14, 2013 10:56 am
by kartoFlane
I've very little experience with events, so I won't be able to answer any of the questions, but if I recall correctly the STANDARD_SPACE is the sector in which the game starts.
Also, maybe you can find something of use in JLPH's modding documentation

Re: Questions About Event Namespaces

Posted: Tue May 14, 2013 11:27 am
by Metzelmax
Kieve wrote:
It might even be possible to create a loop that way, though I'm not certain if it could be infinite or not. "Sell 1 Missile for 2 Scrap" - "Would you like to sell more? Y/N"
There's a lot of possibility there I haven't explored or experimented with yet.
I tried a loop just yesterday... doesnt work. The event should load itself over and over again until you chose to quit. But the game crashed once you hit START at the ship selection. I think the reason why it doesnt work would be how ftl loads sectors.
I dont know that, but I think it loads all events of an sector before you enter it, so that way stuff like reveal map works. That means it has to load every branch of the event. Which means again: if you have a loop within your events, you create an infinite loop which leads to an overflow and crash.

Re: Questions About Event Namespaces

Posted: Tue May 14, 2013 9:57 pm
by rhaining
Thanks for that link (JLPH modding doc). You're right, it doesn't answer my questions, but it's an excellent resource!

What's the source of your info that STANDARD_SPACE is used for the first sector? I ask because nothing in the data files indicates that is true, plus there are two hints that it's not true. STANDARD_SPACE has the name "Federation Space", which is never seen in the game. Also, there is a comment in the XML that says STANDARD_SPACE is a filler in case the real sector name cannot be found. Hints aren't definitive though, hence I'm trying to get confirmation. ... Hmm, these two links strongly imply that people have tested it and confirmed that the game always uses STANDARD_SPACE for sector 1. (Argh! A great game still but what a confusing mishmash of half-configurable stuff in the implementation! Can't wait for FTL:Overdrive!)

http://www.ftlgame.com/forum/viewtopic.php?p=9805

and

https://docs.google.com/document/pub?id ... mzX32GB-Dw

Re: Questions About Event Namespaces

Posted: Wed May 15, 2013 9:36 pm
by Vhati
rhaining wrote:3. Do quests overwrite events that used to be at those beacons?
If so, do they only overwrite certain types of events?
If not, can you get the 2nd half of a quest w/o activating the quest?
Been a while since I played, but IIRC editing a saved game, to add quest events to the current sector, clobbers normal events. So the same should apply to naturally spawned quests and delayed quests (which spawn in the following sector).

Dunno if certain beacons have a priority for becoming quest-flagged (besides avoiding the start and end ones).

Normal events aren't even stored in saved games; they're generated at runtime based on a saved random seed. The game is never saved mid-event (the aftermath may be saved: stores, ships, quests, etc).

Quests are different: event triggers that get attached to the nth beacon in a sector (a list of n's and names are saved). Delayed quests are merely a list of names, since they have no sector yet.

Quests' xml can be edited to reference any event name, even one that could otherwise spawn on its own via sectorDescription. And you can edit sectorDescription to reference an event previously only accessable via a quest.

Re: Questions About Event Namespaces

Posted: Wed May 15, 2013 10:48 pm
by 5thHorseman
Metzelmax wrote:
Kieve wrote:
It might even be possible to create a loop that way, though I'm not certain if it could be infinite or not. "Sell 1 Missile for 2 Scrap" - "Would you like to sell more? Y/N"
There's a lot of possibility there I haven't explored or experimented with yet.
I tried a loop just yesterday... doesnt work. The event should load itself over and over again until you chose to quit. But the game crashed once you hit START at the ship selection. I think the reason why it doesnt work would be how ftl loads sectors.
I dont know that, but I think it loads all events of an sector before you enter it, so that way stuff like reveal map works. That means it has to load every branch of the event. Which means again: if you have a loop within your events, you create an infinite loop which leads to an overflow and crash.
Interesting. Could you do something like this:

START: 7 options:
Sell 32 missiles -> Goto Sold32
Sell 16 missiles -> Goto Sold16
Sell 8 missiles -> Goto Sold8
Sell 4 missiles -> Goto Sold4
Sell 2 missiles -> Goto Sold2
Sell 1 missile -> End
No thanks -> End

Sold32: 6 options:
Sell 16 missiles -> Goto Sold16
Sell 8 missiles -> Goto Sold8
Sell 4 missiles -> Goto Sold4
Sell 2 missiles -> Goto Sold2
Sell 1 missile -> End
No thanks -> End

Sold16: 5 options:
Sell 8 missiles -> Goto Sold8
Sell 4 missiles -> Goto Sold4
Sell 2 missiles -> Goto Sold2
Sell 1 missile -> End
No thanks -> End

Sold8: 4 options:
Sell 4 missiles -> Goto Sold4
Sell 2 missiles -> Goto Sold2
Sell 1 missile -> End
No thanks -> End

Sold4: 3 options:
Sell 2 missiles -> Goto Sold2
Sell 1 missile -> End
No thanks -> End

Sold2: 2 option:
Sell 1 missile -> End
No thanks -> End

That way, you could sell any number up to 63. I don't think I've ever had that many :) Each time, the owner could say something like, "Thanks! Any chance you have any more to sell?"

Re: Questions About Event Namespaces

Posted: Tue May 21, 2013 1:51 pm
by Sleeper Service
rhaining wrote:What's the source of your info that STANDARD_SPACE is used for the first sector? I ask because nothing in the data files indicates that is true, plus there are two hints that it's not true. STANDARD_SPACE has the name "Federation Space", which is never seen in the game. Also, there is a comment in the XML that says STANDARD_SPACE is a filler in case the real sector name cannot be found. Hints aren't definitive though, hence I'm trying to get confirmation. ... Hmm, these two links strongly imply that people have tested it and confirmed that the game always uses STANDARD_SPACE for sector 1. (Argh! A great game still but what a confusing mishmash of half-configurable stuff in the implementation! Can't wait for FTL:Overdrive!)
I remember a frustrating test session in which I heavily modified STANDARD_SPACE with no results at all. So I also wonder if that is actually the sector that Is used as the first sector. If not, Id really like to know which it is. :roll: CIVILIAN_ ? Cause that didn't work as well although I could have messed other stuff up. Hardcoded?

(Also: is there any way to modify max amount of beacons per sector?)