Author Topic: FTL and ship design mods?  (Read 24896 times)

Offline roguevagabond

  • Newbie
  • *
  • Posts: 2
FTL and ship design mods?
« on: April 19, 2015, 05:12:20 pm »
Are there any AI War mods which allow standard ships to travel between systems with a warp, jump, or hyperdrive rather then via wormholes? and are there any which allow the players to create their own ship designs?

Offline Dominus Arbitrationis

  • Arcen Games Contractor
  • Arcen Staff
  • Sr. Member Mark III
  • *****
  • Posts: 479
Re: FTL and ship design mods?
« Reply #1 on: April 19, 2015, 05:26:50 pm »
I highly doubt you'll find any mods that advanced for the first one, and the second one doesn't seem like something anyone has really wanted to do ever. I could be wrong though.
Come help out at the Wiki!

Have ideas or bug reports for one of Arcen's games or any part of the site? Use  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games and site better!

Offline Aklyon

  • Core Member
  • *****
  • Posts: 2,089
Re: FTL and ship design mods?
« Reply #2 on: April 19, 2015, 05:28:44 pm »
The closest you'll get are modular starships and Champions.

Offline Red.Queen

  • Full Member Mark II
  • ***
  • Posts: 191
  • Mad Hacker
Re: FTL and ship design mods?
« Reply #3 on: April 19, 2015, 07:45:48 pm »
Hi Roguevagabond,

I can think of a way to approximate the direct-jump thing.  Teleraiders can hop from wormhole to wormhole so fast they're almost uncatchable (barring things like Black Hole Machines), and I'm not sure, but the Spirecraft Jumpship might be able to do long-distance hops.  Not sure on the last one as I haven't played with it yet.

Depending on how the ships have their abilities assigned, it would theoretically be possible to assign one of these teleport abilities to another ship.

AI War is a Unity-based game, which isn't too friendly to modding, but not impossible if you're stubborn enough and willing to get into the world of Assembly language programming.  Not many people are.  I am one of the few however.  8) (If anyone here is a fan of "Sir, You Are Being Hunted", you might be thinking my nickname is familiar -- I am the same Red Queen who's the lone lunatic modder in that community, and all my work there is done in a flavor of Assembly.)

Anyway, I'm enjoying AI War quite a bit, and it's pretty inevitable that I eventually start modding my favorite games, so you guys may see me start tinkering with this one at some point, once I've decided I have enough experience with the vanilla game, its balance, and its mechanics that I can make informed decisions about what I might like to do.

The only downside (well, assuming you don't consider working in Assembly a downside, which sane people do) is that keeping mods updated for stuff built on Unity is an unholy nightmare, it's a 100% manual job of patching the .dll that contains most of the game's "things wot do stuff" instructions, all by hand.  In something like Notepad.  :-\  It's a very 1985 kind of workflow.  The frequency with which Arcen tends to patch will be a big factor in whether or not I get into anything heavy-duty.

EDIT -- I would also only release modded files with Arcen's permission, especially as it would require posting modified copies of a major .dll.  That's more invasive than writing a companion plug-in, and not all devs are comfortable with people doing that.  Last thing I would want to do is annoy them.

Parting note -- Wow, the relevant .dll for this game is 3.5 megabytes.  Sir was 1.3ish and disassembled into over a million lines of code filling a 14 megabyte plain text file.  AI War would probably become between 3 and 4 million lines of code then.  Intriguing.  Must resist urge to throw it in a decompiler and read the C# until I don't think I will have too many spoilers from doing so...
« Last Edit: April 19, 2015, 07:49:19 pm by Red.Queen »
Infiltrating hostile AI networks to rewrite reality.

[[Hacks available from this unit found on the AI War Modding subforum.]]

Offline Aklyon

  • Core Member
  • *****
  • Posts: 2,089
Re: FTL and ship design mods?
« Reply #4 on: April 19, 2015, 08:38:40 pm »
Arcen code (libraries in particular) has been related to a lumber mill at maximum speed with minimum support before by keith, Red Queen. You'd get more spoilers reading the journal xml files than whatever such a thing decompiles into, I'd think. :)

Offline Red.Queen

  • Full Member Mark II
  • ***
  • Posts: 191
  • Mad Hacker
Re: FTL and ship design mods?
« Reply #5 on: April 19, 2015, 09:03:16 pm »
I'm pretty sure a normal person would have interpreted that as "Abandon hope, all ye who enter here", but all I heard was "See that mountain?  Everyone avoids it, it's too dangerous.  <whisper>  Climb it.  You know you want to.;)

No illusions that it would be easy though, I recall coming across an old post by Keith when he was preparing a big overhaul of some of the core AI and admitting it took *him* two weeks of reading it before he was willing to touch the thing.  On the other hand, that also hints at a glorious cornucopia of interesting systems to occupy myself studying from the inside for quite a long time, in addition to observing and theorizing while I play...  <drool>

Gah, if it's not other people tempting me to do this stuff, it's me tempting myself talking through my thoughts on it!
Infiltrating hostile AI networks to rewrite reality.

[[Hacks available from this unit found on the AI War Modding subforum.]]

Offline topper

  • Sr. Member
  • ****
  • Posts: 307
Re: FTL and ship design mods?
« Reply #6 on: April 19, 2015, 09:13:28 pm »
You are probably both happier if you put the suggestions (both for ideas and for new ships you want) on Mantis and wait for the next AI War expansion.  :P  But really, if they are good ideas then they have a decent chance of being in the next expansion, and there is always another expansion in the works. :D

The ship artwork is theoretically moddable already, but I doubt ship stats can be easily changed. Making an entirely new warping mechanic has got to be nearly impossible. I get the feeling your next comment is "challenge accepted" :)

Offline Pumpkin

  • Hero Member Mark III
  • *****
  • Posts: 1,201
  • Neinzul Gardener Enclave
Re: FTL and ship design mods?
« Reply #7 on: April 20, 2015, 04:15:35 am »
AI War is a Unity-based game, which isn't too friendly to modding, but not impossible if you're stubborn enough and willing to get into the world of Assembly language programming.  Not many people are.  I am one of the few however.  8) (If anyone here is a fan of "Sir, You Are Being Hunted", you might be thinking my nickname is familiar -- I am the same Red Queen who's the lone lunatic modder in that community, and all my work there is done in a flavor of Assembly.)
:o

However, according to this, Chris/Keith totally assume the fact that AI War isn't mod-friendly. And a disassembler-based mod/patch has been attempted before, AAR here.
Please excuse my english: I'm not a native speaker. Don't hesitate to correct me.

Offline Red.Queen

  • Full Member Mark II
  • ***
  • Posts: 191
  • Mad Hacker
Re: FTL and ship design mods?
« Reply #8 on: April 21, 2015, 08:35:30 pm »
You are probably both happier if you put the suggestions (both for ideas and for new ships you want) on Mantis and wait for the next AI War expansion.  :P  But really, if they are good ideas then they have a decent chance of being in the next expansion, and there is always another expansion in the works. :D

Definitely the sane approach, especially for the long term.  :)

Quote
The ship artwork is theoretically moddable already

Indeed.  And if someone finds a graphic they want to extract/replace that's not loose, but locked up in one of the .assets container files, I can point them at an excellent modder-made tool for pulling/replacing them, as well as give some tips on how to do it.  Technically works on just about everything in there.

Quote
but I doubt ship stats can be easily changed. Making an entirely new warping mechanic has got to be nearly impossible. I get the feeling your next comment is "challenge accepted" :)

Sighhhhhh...

Challenge accepted (to at least pop the top and evaluate feasibility of some sort of proof of concept as a test) ...

RIP my free time.  (Sanity's already long gone, programming in Assembly does that.)

:o

<lol>

Quote
However, according to this, Chris/Keith totally assume the fact that AI War isn't mod-friendly. And a disassembler-based mod/patch has been attempted before, AAR here.

Yup, spotted those, good to see that I'm not the only one crazy enough to slither up close to the metal and work that way when confronted with software that claims itself unmoddable.  Rara avis in terrorem.  And it's definitely true, anything built on Unity, unless the devs have made their own modloader component for it, isn't very mod-friendly.  Only disassembly or hex editing works, decompiling won't net you anything functional.

My usual workflow when hacking Unity games is to have four different utilities open, aside from Unity engine documentation a couple of sketchy MSIL references (there isn't that much on this language, humans don't generally use it).  There is also generally either caffeine or alcohol of some variety on my desk for modder fuel, and I probably have some flavor of industrial/noize pumping over my headphones.  Though, occasionally, it may be Baroque classical because Why Not.  Harpsichords and cellos rock too.

Telerik JustDecompile with a batch of relevant classes open in half a dozen tabs, set to display in C# so I can read and search through the vanilla code quickly -- this lets me trace what I'm interested in, find things I can potentially cannibalize, and generally better understand the big picture.  I have Visual Studio's DevPrompt open in the background for running ILASM/ILDASM to assemble and disassemble the C# code.

The gigantic raw .il file gets thrown into Notepad++ (there are no MSIL IDEs, it's all oldschool -- yeah, baby!) as an assembly reference, and then I open a copy in another tab that I actually start writing to.  More complex changes get written out in a temp tab first, and then folded in.  Lots of working copies are made, I have had times where I have had about 10-12 tabs open in Notepad++ as the code has evolved.  When it's time to check my work, I run ILASM to reassemble it (I'm skipping the !!fun!! that happens when it fails to assemble and how you troubleshoot that), and throw it into ILSpy, another decompiler.

ILSpy is set to display in C# mode.  I prefer to use ILSpy for testing as it decompiles slightly differently than Telerik, so it's like having a second opinion that something is legit, plus Telerik throws a fit if you have two files with the same name open, which is a bit of a problem when you want to compare the same class before and after.  Then I look for errors/anything that looks stupid -- just because it assembles, doesn't mean it turns into something comprehensible in the C# world.  Sometimes that's because it's just bad code, sometimes it's because it's "alien" -- some things that are perfectly valid to write in pure assembly that never has to migrate to a non-assembly world aren't comprehensible to a C# interpreter.

This cycle repeats until what's in ILSpy looks not-stupid, in which case it's time to back up the original .dll in the game folder and chuck in the modded .dll and see what goes wrong.  (Something always goes wrong.  If nothing seems to, I assume it's just something less obvious I haven't triggered yet that I will find at the most annoying possible moment later, generally about 30 seconds after I published whatever it was, necessitating an embarrassing immediate hotfix.)  Lather, rinse, repeat until it's in a good enough shape for playtesting and publishing with copious disclaimers.

Why did I just write all that?  Eh, whatever, it's there and it's staying.   :)
Infiltrating hostile AI networks to rewrite reality.

[[Hacks available from this unit found on the AI War Modding subforum.]]

Offline Red.Queen

  • Full Member Mark II
  • ***
  • Posts: 191
  • Mad Hacker
Re: FTL and ship design mods?
« Reply #9 on: April 29, 2015, 04:53:29 am »
For some reason, at the end of a tiring week when yawning my head off and waiting for the painkillers to finally kick in and do something about a headache, my brain decides that the best thing for me to do, rather than sleep, is to clear out Telerik and chuck AI War into the decompiler.

First impression?  Arcen's coding style is quite a bit different from the last few things I've looked at.  Odd mix of "this function name tells you literally everything that it does" vs. "this boolean's name is just 'number 12', go read 50 lines of code if you want to know what it's for".  Also, I can now say I have finally encountered classes so huge they take a full 2.5 seconds to open.  50,000+ lines in C# -- this is going to be *hilarious* in Assembly, if it clocks in at under 3.5M lines I will be amazed.  Navigating that is going to be an adventure.  Cue the "I see an electrical outlet and I'm gonna stick a fork in it" laugh.

Something something this game has Excel library functionality?  I wonder if that's how it does some of its "what's my best set of action options" sorting wizardry I remember seeing in a devblog post.  If so, that's the most inventive use of that bane-of-my-existence program I've ever seen.  (Ever seen some moron try to build a pseudo-website in Excel?  And then ask you to convert it to tiff images so it can be sent to a lawyer?  I HAVE.  Hate.)

HA!  I was right, Threat does ignore adjacent planet player fleet strength if it thinks it's engaged in combat.  What I saw in my last game was functioning normally as I suspected, there is still a hole that can be exploited to rope-a-dope the Threatfleet.  I can't wait to test exactly how far that deception can be pushed.

Oo planetary reinforcement seems to be influenced by how scary the stuff the player has nearby is, I thought I detected signs of this while playing, theories were right again.

These last two findings show I can actually play mind games with this AI.  I am going to get myself in so much trouble doing that and then miscalculating somehow.  It's going to be glorious.

Difficulty 9 is the last step before some AIP threshold stuff starts to scale non-linearly.

Right, I said I'd look at teleporting stuff, didn't I, time to stop rifling through the AI's brain for the moment and get back on topic.

Fascinating... I think teleportation might simply be handled via a couple of blocks buried in the main unit movement function, mostly an X/Y grid coordinate update bracketed by a fade out/in of the graphic and a cooldown on how frequently it can move.  I was expecting to find a dedicated teleportation function that gets called by the normal movement logic to override more ordinary movement, but apparently no.

Oh man, some of these single functions are just enormous, I can't wait to get this disassembled and see just how much space some of these reserve on the stack lol.  This thing just dwarfs the last game I worked on.

Found the classes where it sets a bunch of the individual unit properties, presumably importing them from the Unity prefab xmls packed in the .assets files.  It's like a text-based switchboard.  It even has a block where it just runs through all the ship types to see what it's looking at, helpfully showing me what all the internal names are and how to read them to ask the game "hey, uhhh what ship am I again?".  That will make manipulating individual ship properties so much less of a pain, shouldn't need to bother with hex editing prefabs and repacking them.  Good, because that was NOT happening, I hate hex editing.

I like this game as a player, and I am liking what I see under the hood as a modder, after getting past the initial shock of seeing single classes almost 60K lines long in C#.  I'm sure there are plenty of bear traps buried in stuff waiting for me to step in them as I wander about and mess with forces I don't fully comprehend, but eh.  I'm used to that.  Crashes are merely finger calisthenics for Alt+F4 and Ctrl+Alt+Del.

TL;DR: I can work with this.

Sometime when I am not falling asleep on my keyboard that is.  ;)
Infiltrating hostile AI networks to rewrite reality.

[[Hacks available from this unit found on the AI War Modding subforum.]]

Offline Pumpkin

  • Hero Member Mark III
  • *****
  • Posts: 1,201
  • Neinzul Gardener Enclave
Re: FTL and ship design mods?
« Reply #10 on: April 29, 2015, 08:50:14 am »
I'm looking forward to see Keith finding this post! :D
Please excuse my english: I'm not a native speaker. Don't hesitate to correct me.

Offline Aklyon

  • Core Member
  • *****
  • Posts: 2,089
Re: FTL and ship design mods?
« Reply #11 on: April 29, 2015, 12:49:14 pm »
IIRC, the excel functionality is either broken or it crashed something before, but it spits out a gianthuge pile of ships and stats and someone used it to update the wiki once before Dominus was here on the forums.

Offline Red.Queen

  • Full Member Mark II
  • ***
  • Posts: 191
  • Mad Hacker
Re: FTL and ship design mods?
« Reply #12 on: April 30, 2015, 02:39:09 am »
I'm looking forward to see Keith finding this post! :D

 8)

I already have some ideas brewing in my head for stuff to try.  I'll do a proof of concept with switching on teleportation for a normally non-teleporter first, since that's how this got started, and it'll be a way of checking to make sure my tools don't have some issue with handling disassembly/reassembly of this much code.

After that, it'll be time for me to go ahead and start filling the Blueprints folder in my working area with notes on potential stuff to build/alter that my brain is already starting to chew on.  I really need to sit down and actually open a Github repository for my stuff one of these days but time spent learning Git is time not spent learning Assembly/Lua/whatever language my current project needs...

IIRC, the excel functionality is either broken or it crashed something before, but it spits out a gianthuge pile of ships and stats and someone used it to update the wiki once before Dominus was here on the forums.

Good to know.  I'll probably run into a reference to whatever it is for at some point while diving the codebase.

***

Incidentally the sheer amount of logging this game does is incredible.  I knew it could do a lot just from the advanced logging snips I've seen posted around the forum, but damn.  Not quite the same impact as when you actually see all the instructions for it threaded through the actual working code.

Yeah, I just blissed out a bit on logging code of all things...  I get a bit excited when I have some beautiful new mystery to vivisect and tinker with.  It's fun from a practical perspective of "I get to play with fun results" and also from a development perspective of "I get to see how everything works and I get to absorb new techniques and new ideas."
Infiltrating hostile AI networks to rewrite reality.

[[Hacks available from this unit found on the AI War Modding subforum.]]

Offline Red.Queen

  • Full Member Mark II
  • ***
  • Posts: 191
  • Mad Hacker
Re: FTL and ship design mods?
« Reply #13 on: April 30, 2015, 08:37:38 pm »
Test case:  Upgrade Fighters with basic Teleportation to demonstrate feasibility of manipulating ship properties.

Disassembly: Success.  1.04M lines, 42 megabyte output.  Big fat file.

Arcen's odd coding style has the amusing result that certain functions are actually *less verbose* in MSIL than they are in C#.

Huh, never seen some of these operators before.  Open up some references in case I need 'em.  New stuff to learn.  Cool.

Large numerical values mean output is split between decimal and hexadecimal.  Arsepain.  I hate you sometimes ILDASM.

Arcen's sometimes-generic function and variable names make my usual tricks for finding what I want based off the C# less effective.  I am going to have to make heavy use of bookmarking and other assists to move around this stuff in any half-reasonable fashion.

Target acquired and relevant code inserted.  Hope I didn't just break stuff!

Reassembly: Success.

Weakness of ILSpy vs. Telerik discovered, ILSpy takes 3x longer to decompile huge classes.  That's going to suck in the future.

Visual sanity check passed, time to fire it up and see what goes wrong.

Game starts ok.

Savegame loads ok.

Mouseover nearest fighter -- "Teleporting" appears in the abilities list. Cool.



Click on Fighter and right-click in circles around my home command station.  Poof poof poof poof.  Chuckle.

***TEST OK.***

Proof of concept file attached with instructions in the .zip.

Initial Modding Test:  Success.
Infiltrating hostile AI networks to rewrite reality.

[[Hacks available from this unit found on the AI War Modding subforum.]]

Offline Aklyon

  • Core Member
  • *****
  • Posts: 2,089
Re: FTL and ship design mods?
« Reply #14 on: April 30, 2015, 08:46:35 pm »
Is it effecting only player fighters though, or also the AI's fighters?