[Spoiler] FTL Profile/SavedGame Editor v27 (2018-01-12)

All your guides, strategy discussions, request for help on how to play go here. Please use [SPOILER] if relevant.
iceburg333
Posts: 67
Joined: Tue Jun 25, 2013 8:52 pm
Contact:

FTL Editor v16 - Questions from an excited noob

Postby iceburg333 » Mon Jul 01, 2013 2:46 pm

Hey Vhati!
First off, the profile/save editor you and ComaToes have made is awesome. While I'm still trying to beat the game without cheating (and so haven't used your editor for actual playing), I have used it to create OP ships to test with as I edit the game's XML files and I have to say the program is really well done!
My name is Iceburg, I'm a modder for Skyrim. My mods can be found here, and I have a facebook page here. Skyrim's programming language is very similar to Java, albeit simpler and less complete.

I found FTL on a summer sale and It's captured my imagination. I've poured over the XML files and read through Captain Shooby's thread, as well as every FTL modding guide I've found. I have ideas for mods, but I realized I couldn't complete them (or really even start them) without mod tools (Please Subset!) or learning some legit programming languages. I have a number of Ideas I could implement just by using the XML and save manipulation, and so when I saw your source code was available and that you were able to edit savegames using Java, I googled for Java tutorials. I found a excellent series of tutorials on Java with Eclipse (a program I am familiar with), and have started going through them. I've worked through the Total Beginner's tutorial (3 3/4 hours of screencast) as well as most of the persistance tutorial (3 hours of screencast). At this point I understand the basics of Java as well as how to save files and retrieve data from them, though I still feel pretty much like a noob.

Anyhow, I've imported your source into Eclipse and was looking through the compile errors I got. My first question is to where I could find the apache package/jar so that those imports won't fail. Would that be found inside an apache server install? (I used to have that installed, I'll re install it).
Edit: Found a org.apache.commons.logging package at the Apache Commons, but that's not an exact match for import org.apache.logging.log4j.LogManager;...
Edit2: I found log4j-1.2.17 on the Apache Commons page, and installed Eclipse Indigo so that Maven (never heard of it before) updated, and now my compile errors are gone; I just have some warnings. Yay! :D

My second question had to do with legality, of which I am a total noob. I see that the source code is available, and while I'm excited to look through it and learn from it, I am fiercely paranoid that other people will steal my work, and consequently, fiercely committed to not stealing other people's work. How does using your code as a base for code I would like to write work? I basically want to make a program that edit's the ship (a hanger bay) where you can use items like blue prints to edit or craft a ship: have 30 scrap and a warp core, you can make a Kestrel. Can I use your classes and methods to read and save the save files if I credit you and ComaToes, (and make my mod/program have the source code available), or is that bad? Basically, how does this sort of thing work/ what would your wishes be? (If I ever get good enough to do anything like that...) :D

Sorry for rambling. I'm very excited about this, and I've been having a blast learning java. I really appreciate the program you guys have made and how you've made it open source so people like me can read it! (and maybe some day contribute to it!)
Thanks!
Iceburg

ps. While I wait to hear from you, I'll continue working through the Java tutorials, as well as try to comb through the source in eclipse and see how much I can understand.
Image
Vhati
Posts: 792
Joined: Thu Oct 25, 2012 12:01 pm

Re: [Spoiler] FTL Editor v16 - Unlock ships, Edit SavedGames

Postby Vhati » Mon Jul 01, 2013 6:56 pm

iceburg333 wrote:The post seems to post, but is deleted within an hour or so.
Am I not allowed to post URLs?

Thread: Forum restrictions for new users

When a new topic or post is made, it will be checked by an automated system. If it is made by a user belonging to the new users group, contains links, or is otherwise suspected as spam, it will not appear on the forum. Instead it will be sent to a moderation queue where it will stay until a forum moderator approves it, or in cases of spam rejects the post. Except for the involvement of a human moderator, the process is automated and impersonal.
iceburg333
Posts: 67
Joined: Tue Jun 25, 2013 8:52 pm
Contact:

Re: [Spoiler] FTL Editor v16 - Unlock ships, Edit SavedGames

Postby iceburg333 » Mon Jul 01, 2013 11:45 pm

Thanks Vhati!
Your post + the link exactly answered my problem. I guess I'll just wait until the post shows up then. Thank you. :D
Ice

EDIT: My post has come through, along with a bunch of other test posts (hopefully a mod will delete them, sorry about that). Small update, I was able to find the proper jar file and installed eclipse indigo (which integrates with Maven) and so was able to remove the compiler errors from the source code. I'm hoping to spend more time looking through the code later this week.
Image
Vhati
Posts: 792
Joined: Thu Oct 25, 2012 12:01 pm

Re: [Spoiler] FTL Editor v16 - Unlock ships, Edit SavedGames

Postby Vhati » Tue Jul 02, 2013 6:14 am

iceburg333 wrote:My first question is to where I could find the apache package/jar so that those imports won't fail.
Maven manages compiling but also serves as a package manager of sorts. It automatically downloads libraries from repositories to meet project dependencies, so you don't have to scour the net.

I hadn't played with maven either before this project, but IIRC, all I had to do was install maven, open a prompt, cd to the project's dir, and run "mvn clean" then "mvn package". XML tells maven all it needs to know.

I assume Eclipse's maven plugin does something comparable, but I'm unfamiliar with that IDE.

Tip: After I got the source off github, I made a copy of the project directory to do all my tinkering and compiling in. When I was satisfied, I used WinMerge to copy the important changes into the original github folder for committing.


iceburg333 wrote:Can I use your classes and methods to read and save the save files if I credit you and ComaToes, (and make my mod/program have the source code available)
Sure. Have fun. :)
I hadn't designed the classes to be usable as an independent library, but they were intended to be a useful demonstration/documentation for other coders.

A lot of neat Java snippets in there, too. I guess if you lift entire class files, you can add a comment at the top about where you found them, but feel free to copy/port/paraphrase/mangle anything you want.

This was the first time I'd used JAXB to map XML to custom java objects. Viewing XML processing as deserialization was a little weird after being used to JDOM's tree of Elements. ;)
Vhati
Posts: 792
Joined: Thu Oct 25, 2012 12:01 pm

Re: FTL Editor v16 - Questions from an excited noob

Postby Vhati » Tue Jul 02, 2013 6:46 am

iceburg333 wrote:I basically want to make a program that edit's the ship (a hanger bay) where you can use items like blue prints to edit or craft a ship: have 30 scrap and a warp core, you can make a Kestrel.
I'm not sure what you mean by this.

The tool here modifies the state of a saved game, swapping out crew and such, and changing values, almost as if you'd legitimately played and lucked into a given situation. The game's resources aren't altered at all. So the Kestrel's hull has a fixed maxumim, for example, but this tool can add damage as if it had occurred in-game.


Have you seen kartoFlane's Superluminal ship editor?

The tool there ultimately edits the game's resources to create ship blueprints that didn't already exist. They will appear in the hangar for starting new games.
iceburg333
Posts: 67
Joined: Tue Jun 25, 2013 8:52 pm
Contact:

Re: [Spoiler] FTL Editor v16 - Unlock ships, Edit SavedGames

Postby iceburg333 » Tue Jul 02, 2013 12:16 pm

Vhati wrote:Maven manages compiling but also serves as a package manager of sorts. It automatically downloads libraries from repositories to meet project dependencies, so you don't have to scour the net.

I hadn't played with maven either before this project, but IIRC, all I had to do was install maven, open a prompt, cd to the project's dir, and run "mvn clean" then "mvn package". XML tells maven all it needs to know.

I assume Eclipse's maven plugin does something comparable, but I'm unfamiliar with that IDE.

Tip: After I got the source off github, I made a copy of the project directory to do all my tinkering and compiling in. When I was satisfied, I used WinMerge to copy the important changes into the original github folder for committing.


Ah thank you! I figured Maven had something to do with packing, but had no idea it worked with compiling as well. As someone who has grown by just modding Skyrim with their dedicated tools, the 'real programming' world still seems rather magical and mysterious. :D
If you don't mind, what IDE is IIRC? I learned eclipse a while back while learning html/css/basics of cold fusion, and so it's the only IDE I'm familiar with. One of its release packages had maven installed and once I downloaded it it probably did what you did manually.

I'm also a github noob, but if/when I get that far along in the program, I'll delve into that as well and check out WinMerge. :D


Vhati wrote:Sure. Have fun. :)
I hadn't designed the classes to be usable as an independent library, but they were intended to be a useful demonstration/documentation for other coders.

A lot of neat Java snippets in there, too. I guess if you lift entire class files, you can add a comment at the top about where you found them, but feel free to copy/port/paraphrase/mangle anything you want.


Dude, that's awesome! I'm so happy lol. I had the thought this morning as I was getting out of bed that I could make your jar a library mine would depend upon. The classes looked public, but I still don't know enough about Java to know that they weren't designed to be usable as independent libraries: If I can I'll use it as a library. Otherwise any classes I use I'll comment in the credits at the top, as well as credit you in the readme etc.

This is perfect. I've almost gone through all the java tutorials, so to have access to a java program/source that I can learn from and experiment with, that is on the subject that has me inspired, that has someone really knowledgeable that I may be able to ask questions to*, with resources parallel to what I need to do... it's awesome. Thank you! :D

*I don't want to bug or exasperate you; I've had my fair share of newbs ask me for all sorts of my time answering their questions, only to watch them disappear after I do a bunch of work for them. I don't want to be that sort of noob...

Vhati wrote:This was the first time I'd used JAXB to map XML to custom java objects. Viewing XML processing as deserialization was a little weird after being used to JDOM's tree of Elements. ;)


I'll admit this bit went mostly over my head. I'm not familiar with JAXB, though I do understand that the save files are serialized (they are xml as well?) From your link I *think* I get what JDOM does. In the tutorial series on persistence we used Xstream, but that was just to write to/get from xml, which it sounds like JDOM doesn't do so much as allow you to view the xml in your IDE as java objects?

Vhati wrote:I'm not sure what you mean by this.
The tool here modifies the state of a saved game, swapping out crew and such, and changing values, almost as if you'd legitimately played and lucked into a given situation. The game's resources aren't altered at all. So the Kestrel's hull has a fixed maxumim, for example, but this tool can add damage as if it had occurred in-game.

Have you seen kartoFlane's Superluminal ship editor?

The tool there ultimately edits the game's resources to create ship blueprints that didn't already exist. They will appear in the hangar for starting new games.


Yes! Superluminal's ship editor is awesome, and I've spent some time tinkering with it. However, that is used to make "New Ships" or "Custom Ships". My thought is that instead of the player starting each play through with a vanilla ship that they are just given, that they should have to "construct" that same premade ship. The hanger wouldn't let you add rooms or move systems. I wouldn't be adding anything new/modifying resources or layouts, but instead requiring the player to pay for that vanilla ship. Imagine your program, except you can't modify the crew or add that teleporter room (activate it/ turn the boolean from false to true) without paying resources gathered in your last playthrough (and stored at the hanger). The hanger would work like your program, changing values of a saved game. Basically: to make a save editor that wouldn't be 'cheating', but worked for. It sounds terribly unbalanced now, but I have an idea on how to balance it, but figure I need to do first things first.
Thanks again Vhati!
Ice
Image
boa13
Posts: 829
Joined: Mon Sep 17, 2012 11:42 pm
Location: Nantes, France

Re: [Spoiler] FTL Editor v16 - Unlock ships, Edit SavedGames

Postby boa13 » Tue Jul 02, 2013 8:52 pm

iceburg333 wrote:Ah thank you! I figured Maven had something to do with packing, but had no idea it worked with compiling as well.


It also runs your unit tests, does your code quality measurements, deploys your application to remote servers, builds your project web site (well, the automatically generated pages), etc. :)
Forum janitor — If you spot spam, PM me the URL and/or the username of the spammer.
I have powers, moderator powers. I am not keen on using them, but will do so if needed.
Vhati
Posts: 792
Joined: Thu Oct 25, 2012 12:01 pm

Re: [Spoiler] FTL Editor v16 - Unlock ships, Edit SavedGames

Postby Vhati » Tue Jul 02, 2013 10:44 pm

iceburg333 wrote:
Vhati wrote:IIRC, all I had to do was...
If you don't mind, what IDE is IIRC?

If I Recall Correctly :P

I just use a Windows command prompt (or *.bat scripts) and a plain text editor.


iceburg333 wrote:The classes looked public, but I still don't know enough about Java to know that they weren't designed to be usable as independent libraries
There's *technically* no difference: you *can* write your own class with a main(), then call anything you want from the net.blerf.ftl package: just include the editor's jar in your classpath.

In Java, "public" just means objects can call stuff on each other... I guess omitting the "public" keyword restricts access to 'only objects within the same package', but *shrug* I never bother being that protective.

I only meant I hadn't explicitly tried to minimize classes' interdependency, to allow someone to construct/call one object in isolation for some other purpose without modifying the editor's code.


iceburg333 wrote:it sounds like JDOM doesn't do so much as allow you to view the xml [...] as java objects?
Right. The JDOM library just read XML and returned a hierarchy of Element objects representing the document, each of which which contained Element children, and so on. And each Element had methods that returned attributes and such.

(De)serialization/persistence is focused on dumping objects from memory to xml (typically) and later (after exiting the app, or across a network) reversing that process to recreate the objects. Standardized save/load basically.

iceburg333 wrote:I do understand that the save files are serialized (they are xml as well?)
continue.sav is a proprietary binary format.
Most of my work involved reverse-engineering and documenting what each byte means: run FTL, change one thing in-game, save+quit, compare this save with one from minutes earlier using a hex editor.

ComaToes did the same to figure out profile.sav.
The only XML FTL uses is inside resource.dat and data.dat.


iceburg333 wrote:This is perfect. I've almost gone through all the java tutorials, so to have access to a java program/source that I can learn from and experiment with, that is on the subject that has me inspired, that has someone really knowledgeable that I may be able to ask questions to, with resources parallel to what I need to do... it's awesome. Thank you!
That's what opensource development is all about. 8-)


EDIT: BTW, WinMerge opens two text files or directories and highlights what's different between them. Extraordinarily useful on its own. No relation to github.
iceburg333
Posts: 67
Joined: Tue Jun 25, 2013 8:52 pm
Contact:

Re: [Spoiler] FTL Editor v16 - Unlock ships, Edit SavedGames

Postby iceburg333 » Fri Jul 05, 2013 12:54 pm

boa13 wrote:It also runs your unit tests, does your code quality measurements, deploys your application to remote servers, builds your project web site (well, the automatically generated pages), etc.

Dang, sounds like it does everything! :D

Vhati wrote:
iceburg333 wrote:
Vhati wrote:IIRC, all I had to do was...
If you don't mind, what IDE is IIRC?

If I Recall Correctly :P

I just use a Windows command prompt (or *.bat scripts) and a plain text editor.

Haha, I totally thought that was some crazy IDE or something, lol. That's CRAZY that you did what you did with just a plain text editor. I read that a lot of people advocate that, but to do so you must really have to know your stuff. :D


Vhati wrote:There's *technically* no difference: you *can* write your own class with a main(), then call anything you want from the net.blerf.ftl package: just include the editor's jar in your classpath.

In Java, "public" just means objects can call stuff on each other... I guess omitting the "public" keyword restricts access to 'only objects within the same package', but *shrug* I never bother being that protective.

I only meant I hadn't explicitly tried to minimize classes' interdependency, to allow someone to construct/call one object in isolation for some other purpose without modifying the editor's code.

That makes sense. And I can understand your rational, the save editor would be pretty much a standalone program that normally wouldn't be used for anything else. I just thought that since the only things we can edit are adding new events, items, and adding saves, I'd need to learn to edit saves to do anything really unique.


Vhati wrote:Right. The JDOM library just read XML and returned a hierarchy of Element objects representing the document, each of which which contained Element children, and so on. And each Element had methods that returned attributes and such.

(De)serialization/persistence is focused on dumping objects from memory to xml (typically) and later (after exiting the app, or across a network) reversing that process to recreate the objects. Standardized save/load basically.

Makes sense. :)

Vhati wrote:continue.sav is a proprietary binary format.
Most of my work involved reverse-engineering and documenting what each byte means: run FTL, change one thing in-game, save+quit, compare this save with one from minutes earlier using a hex editor.

ComaToes did the same to figure out profile.sav.
The only XML FTL uses is inside resource.dat and data.dat.

I used a cheat gene on a SNES emulator to give myself unlimited lives once, so I understand the premise, but doing that for an entire save file, figuring out all the classes and fields, and then putting it into Java must have been crazy!

Vhati wrote:That's what opensource development is all about. 8-)

EDIT: BTW, WinMerge opens two text files or directories and highlights what's different between them. Extraordinarily useful on its own. No relation to github.

Yay! Then I'm digging open source development. :D
Alright, I'll check out WinMerge when my project is farther along (as well as try to better understand github.) I've finished the tutorial on persistence, so I'm going to work my way through the debugger tutorial, read through an article on creating a gui that I found, and then start going through your code. :D
Image
iceburg333
Posts: 67
Joined: Tue Jun 25, 2013 8:52 pm
Contact:

Re: [Spoiler] FTL Editor v16 - Unlock ships, Edit SavedGames

Postby iceburg333 » Sat Jul 06, 2013 4:39 pm

So far things are going really well, I'm understanding a lot of your code and learning tons. However, I've hit one snag that I'm banging my head against. I can't figure it out. Would you be able to help me?
I've created a readShipSavetest method that returns a ShipSave object. In my test class I have the code written:

Code: Select all

ShipSave ss2 =
         ShipSaveParser.readShipSavetest();

It's telling me that I "Cannot make a static reference to the non-static method readShipSavetest() from the type
ShipSaveParser". But why is ss2 static? Nothing in my test method is defined as static.
Thanks!
Iceburg

EDIT: I think I got it! My new code reads like this and I'm not getting compiler errors:

Code: Select all

   @Test
   public void ShipSaveParser() throws IOException {
      //save a ship to file
      ShipSave ss1 = createShipSave();
      String fileName = "testShipSave.sav";
      File testFile = new File(fileName);
      testFile.delete();
      assertFalse("File should not exist",
            testFile.exists());
      assertTrue("File should have been saved",
            ShipSaveParser.updateShipSave(ss1));
      //get the ship from file
      ShipSaveParser parser = new ShipSaveParser();
      ShipSaveParser.ShipSave ss2 = parser.readShipSave(testFile);;
      assertEquals("Enterprise", ss2.getPlayerShipName());
      assertEquals("NCC-1701-D", ss2.getPlayerShipBlueprintId());
   }

I'm trying to do test driven design... so next I need to finish the WIP functions that actually do what I'm testing.
I realize that this could end up spamming your thread with semi off topic stuff. Perhaps I should start a WIP thread...

Who is online

Users browsing this forum: No registered users and 9 guests