Questions here: an inquiry thread! [Updated Sep 15th, 2014]

Discuss and distribute tools and methods for modding. Moderator - Grognak
User avatar
stylesrj
Posts: 3644
Joined: Tue Jul 08, 2014 7:54 am

Re: Questions here: an inquiry thread! [Updated Sep 15th, 2014]

Postby stylesrj » Sat Feb 20, 2016 9:30 pm

I think healing only works for bombs. The healing beam was tried before and it just doesn't work.

See if it works for lasers or missiles though. I can't remember if that was still fine and it's just beams that don't do any healing.
sleepz8
Posts: 73
Joined: Thu Feb 04, 2016 11:25 am

Re: Questions here: an inquiry thread! [Updated Sep 15th, 2014]

Postby sleepz8 » Sat Feb 20, 2016 9:35 pm

Gah!! Probably should have checked BEFORE making animations >:( Any ideas what I could use them for :D?
https://www.dropbox.com/s/f6uybx7fi2e3dep/healbeam.png?dl=0

EDIT: re-purposed it as a poison beam. Strange how it can do positive crew damage but not negative.......
sul
Posts: 121
Joined: Sat Jan 30, 2016 4:22 pm

Re: Questions here: an inquiry thread! [Updated Sep 15th, 2014]

Postby sul » Mon Feb 29, 2016 7:27 am

Guys, I have a very technical question on events. Do you have some tricks to simplify the structure of big-complex events, to avoid overloading ?

So I got into writing events for fun, and I made some huuuges structures. For example a browser similar to the one of the Mod testing environment:
viewtopic.php?t=22613
When I test some of them (at first beacon), the game takes forever to charges, or even freezes. It is not that the events have tipos (I checked several times), they are just too huge to load. I am so sad my browser was fun :(

First some definitions so we agree (and you can correct me):
- An event is a"XML tree". It can loosely look like that for example (sorry for the extra dots):

......................|-->event2-->event3-->event10-->event11-->event12-->event13
event0-->event1--|.........................................................|
......................|-->event4-->|-->event5-->-->|....................|----->|-->event8
......................................|...................|-->event7-->event6-- >|
......................................|-->event6-->-->|............................|-->event7

- The event tree starts from a root (event0), with possible branches (for example event0-->event1), bifurcations (event1-->event2 or event1-->event4), regroupments (event5-->event7 and event6-->event7), etc. The most important rule is that you can never loop back to a former event.
- Bifurcations (|) in particular can be either be "selected" or "random". For a selected bifurcation the player chooses next event through a choice list, while for random bifurcations the next event is randomly picked from an eventList.

Now a complex event can have a huge XML tree structure, which is too heavy to load. With respect to that, I found that:
- Branches are not costly. This makes sense as you just browse unique events.
- Selected bifurcations are EXTREMELY COSTLY. I observed that on a tree having selected bifurcations with something like 2-8 choices, each calling 2-8 new choices, regrouping eventually, etc: it wasnt too complex, but still it simply didnt load. The Mod testing environment is a milder example where that happens.
- Oddly enough, random bifurcations are NOT COSTLY AT ALL. I observed that on a tree with a random bifurcation having like 50 random possibilities (branches were regrouped just afterwards), that was repeated like 200 times, it just works like a breeze (its the mod SCRAMBLE on my page).

So my questions are :
- Is there some tricks to make "selected bifurcations" more lightweight ?
- Why are "selected bifurcations" much more costly than "random bifurcations" ? It shouldnt necessarily be the case, that just puzzles me.
- All those finds are from messing around with the code, but maybe there is a proper XML documentation you can redirect me too.
User avatar
kartoFlane
Posts: 1488
Joined: Mon Jan 14, 2013 10:20 pm

Re: Questions here: an inquiry thread! [Updated Sep 15th, 2014]

Postby kartoFlane » Mon Feb 29, 2016 3:04 pm

Ad Q1:
None that I'm aware of. Maybe making shallower event trees, but that doesn't really help your problem, I guess :P

Ad Q2:
Possibly it could be caused by the way FTL loads events, I guess. The currently accepted theory is that FTL preloads all possible event paths during loading (which is why we can't have event loops), but I suppose they're stored in some kind of compressed form. Once you actually get to a point where the event path might potentially be activated (ie. choice in an event), it might be transformed into an expanded format that, say, contains the complete game state after the event actions have been performed. And maybe child events of that one event. So if you have an event with 8 choices, you have like 8 gamestates you have to keep in memory, which might somehow exhaust the preallocated memory, I guess...?

It's pure theorycrafting on my part, to be honest I've no idea why anyone would ever program a game in such a way, instead of having events apply the changes after they're actually selected by the player. Also creating events on-demand instead of preloading them makes much more sense IMO. Even assuming such an inefficient way of handling event data, it's still pretty unlikely that it'd be capable of exhausting memory, but that's the only reason I could think of.

Ad Q3:
XML docs won't help you here, I think. If FTL passes the initial loading screen, then it successfully parsed all XML files. What happens after that stage is completely up to the game.
Superluminal2 - a ship editor for FTL
sul
Posts: 121
Joined: Sat Jan 30, 2016 4:22 pm

Re: Questions here: an inquiry thread! [Updated Sep 15th, 2014]

Postby sul » Tue Mar 01, 2016 1:39 am

kartoFlane wrote:Ad Q1:
None that I'm aware of. Maybe making shallower event trees, but that doesn't really help your problem, I guess :P

Ad Q2:
Possibly it could be caused by the way FTL loads events, I guess. The currently accepted theory is that FTL preloads all possible event paths during loading (which is why we can't have event loops), but I suppose they're stored in some kind of compressed form. Once you actually get to a point where the event path might potentially be activated (ie. choice in an event), it might be transformed into an expanded format that, say, contains the complete game state after the event actions have been performed. And maybe child events of that one event. So if you have an event with 8 choices, you have like 8 gamestates you have to keep in memory, which might somehow exhaust the preallocated memory, I guess...?

It's pure theorycrafting on my part, to be honest I've no idea why anyone would ever program a game in such a way, instead of having events apply the changes after they're actually selected by the player. Also creating events on-demand instead of preloading them makes much more sense IMO. Even assuming such an inefficient way of handling event data, it's still pretty unlikely that it'd be capable of exhausting memory, but that's the only reason I could think of.

Ad Q3:
XML docs won't help you here, I think. If FTL passes the initial loading screen, then it successfully parsed all XML files. What happens after that stage is completely up to the game.

Thanks kartoFlame for that detailed answer, it is very helpful. So that means the FTL code is kind of quirky I guess, no documentation except from trial and error. Now I have this random though that it is REGROUPING selected bifurcations that is actually costly, which means you could actually build a complex tree if you avoid it (but it is a challenge). I will try that next and see how it goes.
Edit: kartoFlame, so after several tests I can confirm this at least: regrouping selected bifurcations is what is extremely costly (regrouping random bifurcations is not). I made a huge tree (20mb of text, procedurally generated using linux bash) without it, it has all the other features (selected bifurcations, random bifurcations, regroupment of random bifurcations, etc) and works like a charm. If you regroup selected bifurcations only once in that tree than it overloads.
Last edited by sul on Thu Mar 03, 2016 7:44 pm, edited 2 times in total.
sleepz8
Posts: 73
Joined: Thu Feb 04, 2016 11:25 am

Re: Questions here: an inquiry thread! [Updated Sep 15th, 2014]

Postby sleepz8 » Thu Mar 03, 2016 12:20 pm

I'm trying to make a custom event involving fighting a custom Mantis ship, then gaining a custom weapon. I've spent a while fiddling around but I can't get it working.

In 'events_mantis.xml.append' i've got:

Code: Select all

<eventList name="MANTIS_BOSS">
   <event load="MANTIS_BOSS_CHOICE"/>
</eventList>

<event name="MANTIS_BOSS_CHOICE">
   <text>You come across a graveyard of ships. They all have massive damage, maybe you should leave?</text>
   <choice>
      <text>Explore the debris.</text>
      <event load="MANTIS_BOSS_FIGHT"/>
   </choice>
   <choice>
      <text>It's too dangerous, prepare to jump.</text>
   </choice>
</event>   
<event name="MANTIS_BOSS_FIGHT">   
   <text>As you begin to fly deeper through the wreckage, your sensors pick up a faint heat signature. As you get closer to the source, a damaged Mantis ship appears. It's large and it's weapons are powering up!!</text>
   <ship load="MANTIS_BOSS_WRECK" hostile="true"/>
</event>
<ship name="MANTIS_BOSS_WRECK" auto_blueprint="MANTIS_BOSS_WRECK">
   <destroyed>
      <text>Finally the Mantis vessel breaks into pieces under your superior firepower. Your crew search the remains and find and interesting weapon, it doesn't take them long to get it working!</text>
      <weapon name="LASER_MANTIS_CHARGE"/>
      <autoReward level="HIGH">standard</autoReward>
   </destroyed>
   <deadCrew>
      <text>Sensors no longer detect any life signatures. Your crew search the vessel and find and interesting weapon, it doesn't take them long to get it working!</text>
      <weapon name="LASER_MANTIS_CHARGE"/>
      <autoReward level="HIGH">standard</autoReward>
   </deadCrew>
</ship>


In 'sector_data.xml.append' i've put this under '<startEvent>' in both "MANTIS_SECTOR" and "MANTIS_HOME":

Code: Select all

<event name="MANTIS_BOSS" min="1" max="1"/>


Any idea why this doesn't work? Thanks in advance!
meklozz
Posts: 350
Joined: Wed Sep 23, 2015 9:11 am

Re: Questions here: an inquiry thread! [Updated Sep 15th, 2014]

Postby meklozz » Thu Mar 03, 2016 1:11 pm

Look like your sector_data is improperly structured, vanilla looks like:

Code: Select all

<startEvent>START_BEACON_MANTIS</startEvent>


@edit Wait, you actually mean 'under'. Sorry, let me take a better look at this.
How can you tell it isn't working? You'd have to get through an entire mantis sector to check, right? I'm not sure why put the initial event in a list, either? And I think the general convention is to put ships in ship_events? Can't say for sure if this will change things. I'll try and test this out.

@edit2 I believe that this:

Code: Select all

   <choice>
      <text>It's too dangerous, prepare to jump.</text>
   </choice>

Needs an <event/> tag to work.

@edit3 I mean <event/> with the slash at the end, wrote the other way around before, sorry.
sleepz8
Posts: 73
Joined: Thu Feb 04, 2016 11:25 am

Re: Questions here: an inquiry thread! [Updated Sep 15th, 2014]

Postby sleepz8 » Thu Mar 03, 2016 3:20 pm

Thanks a bunch! I took the event out of the event list which I had created, moved the ship to event_ship and added the <event/> and it works!!!

And yes, I used the 'disable fleet' mod and searched every planet in a mantis sector :L
User avatar
elijahdb
Posts: 303
Joined: Wed Dec 30, 2015 2:31 pm

Re: Questions here: an inquiry thread! [Updated Sep 15th, 2014]

Postby elijahdb » Sat Mar 05, 2016 1:26 pm

I'm trying to make a beam and I was wondering how do I make it a chain weapon?

Here's my blueprint if this helps.

Code: Select all

<weaponBlueprint name="ZOLTAN_BEAM_1">
   <type>BEAM</type>
   <title>Zoltan Breach Beam I</title>
   <short>Zoltan Bre. Beam I</short>
   <desc>A rapidly charging beam that pierces shields over time, but only does system damage.</desc>
   <tooltip>Pierces extra shield layer per charge.</tooltip>
   <damage>0</damage>
   <sysDamage>4</sysDamage>
   <sp>1</sp>                 
   <fireChance>1</fireChance>
   <breachChance>5</breachChance>
   <speed>3</speed>
   <cooldown>12</cooldown>
   <power>3</power>
   <cost>65</cost>
   <bp>2</bp>
   <rarity>0</rarity>
   <image>In Progress</image>
   <weaponArt>In Progress</weaponArt>
</weaponBlueprint>
I've created Type C Hulls for the enemy Mantis, Slug, Rock, and Zoltan ships, and anyone can use these for a mod.
Check out the details here.
User avatar
RAD-82
Posts: 796
Joined: Sat Nov 09, 2013 12:16 am

Re: Questions here: an inquiry thread! [Updated Sep 15th, 2014]

Postby RAD-82 » Sat Mar 05, 2016 6:48 pm

Chain effects are only known to alter damage or cooldown. Shield piercing is likely impossible.
Image
Junkyard has FTL mods, mostly ships and a few other things.