[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:

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

Postby iceburg333 » Fri Jul 12, 2013 3:14 pm

Haha, thank you! You solved my next problem before I could ask! I had removed the null pointer exception, but my image wasn't showing up, and I believe your post was the reason why. :D
I'm currently working through a java swing tutorial, but when I get done I'll come back and work on implementing this.
Thanks Vhati! :D


EDIT: So I was in the middle of typing a message to you explaining why I didn't get what was going on, when I figured it out! So now I have terribly large pictures of ships, but it worked! :D Once I learn better gui stuff I'll work on resizing them, but for now I'll clean up the code and push it to GitHub. Thank you so much for helping me with that part!

Now, about:
Vhati wrote:Tip: An ImageIcon that's constructed directly from a path-string caches the image... somewhere. In big apps, it can be inconvenient to later clear old images (link, more info). So I try to avoid that method.

ImageIO.read() doesn't do that. Each read() returns a unique image object that dies on its own when abandoned (When a cache is needed, a HashMap<String,BufferedImage> will suffice).
More relevant to your project, ImageIO can read a stream from DataManager.


Pics like the Krestel ship will be used over and over again in all likelihood as the player probably will have a lot of the same ship saves, so I shouldn't buffer them, but I should cache them, correct? (Or do I need to buffer them in order to cache them!?) I've made a background that I'm going to try to display that's the size of the ship select background (1280 by 700 or so), so I'll definitely buffer that guy.

EDIT: Here's a shot of the progress. It's coming along!!! :D
Image
Vhati
Posts: 792
Joined: Thu Oct 25, 2012 12:01 pm

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

Postby Vhati » Sat Jul 13, 2013 1:32 am

iceburg333 wrote:Pics like the Krestel ship will be used over and over again in all likelihood as the player probably will have a lot of the same ship saves, so I shouldn't buffer them, but I should cache them, correct? (Or do I need to buffer them in order to cache them!?)
That boolean thing is only to tweak ImageIO's read(). It doesn't affect any other part of your code.

To add caching, look at the comments in my previous post. A HashMap is all you need. Just before reading a requested image, check if the map already has it, and return immediately with that. If it's not in there, go ahead and read(), then put the image in the map before returning.

You may want a getScaledResourceImage(innerPath, width, height) method that calls getResourceImage() and only caches the tiny pics: HashMap< String, HashMap<Dimension,BufferedImage> > if you wanna handle multiple sizes.

Maybe add a boolean shouldThisGetCached arg to getResourceImage() if you want to cache unscaled images too, but only sometimes.


iceburg333 wrote:I've made a background that I'm going to try to display that's the size of the ship select background (1280 by 700 or so), so I'll definitely buffer that guy.
I don't know how large is large enough to justify setting ImageIO.setUseCache(true).

Unless you happen to get better performance by turning it on (usually introducing disk thrashing just slows things down), don't bother until you get OutOfMemoryErrors (like 3500x5000 and 5000x7000).
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 13, 2013 7:11 pm

Vhati:
Thank you! Hashmap had me confused at first, but I believe I have it working now, after reading through both of your posts a couple times. :) Literally everything is working inside eclipse. And I've got the manifest correct so it depends on FTLEditor's jar. However, I'm having trouble accessing the background image from inside the jar (though it works fine in eclipse).

The rest of the code is available on github.
My googling is turning up lots of getclass().getresource() stuff, but whatever I use doesn't seem to work. My png is in the root jar/resource folder.
Would you be willing to help me with this (hopefully) last brain teaser?
I'll keep googling around.
Thanks again Vhati!
Ice

EDIT: Got it working! I'll be uploading the program itself/updating github. Once done I'll post a link to the thread for the new program. :D
You rock Vhati!

EDIT 2: You still rock, but my program actually doesn't work yet. It tries to read the profile file like a save and crashes, so I need to fix that real fast, lol. :D
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 15, 2013 6:18 pm

Alright, just wanted to let you know that I've finally released it! Here's the thread for Spacedock! I also made a WIP thread so I won't clutter this one up anymore.
Thank you so much for your help!
Ice
Image
Mogh
Posts: 2
Joined: Mon Jul 22, 2013 10:31 pm

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

Postby Mogh » Mon Jul 22, 2013 10:38 pm

Hi! I just picked up Spacedock and this editor but I'm having some problems. The first time I ran "FTLProfileEditor-v16.jar" it had me search out my data file, and I did so. But now any time I run it it does nothing. In task manager I can see Java start up for a second, then it just blinks off. No crash or error or anything.

Similar issue with Stardock. First time I ran it it had me find the data file, fine, but now when I run it I get the message "Error parsing FTL files"

Any suggestions? I assume Stardock isn't working because the editor isn't working, so I chose this thread in which to post.

I'd attach the log generated by the emergency launcher, but I'm not allowed apparently.

::edit::

Ah, actually, even though this is mostly Greek to me it looks like it's crashing loading blueprints. I have a mod that adds ships, this must not be compatible. Bummer.
Vhati
Posts: 792
Joined: Thu Oct 25, 2012 12:01 pm

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

Postby Vhati » Tue Jul 23, 2013 5:27 pm

Mogh wrote:Ah, actually, even though this is mostly Greek to me it looks like it's crashing loading blueprints. I have a mod that adds ships, this must not be compatible. Bummer.

Yeah, that'd do it.

You can nag the mod's author to fix it, using the Mod Manager's "Validate" button to list problems.
Mogh
Posts: 2
Joined: Mon Jul 22, 2013 10:31 pm

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

Postby Mogh » Wed Jul 24, 2013 2:39 am

Will do. Thanks for the reply!
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 27, 2013 4:36 pm

Hey Vhati!
I've been working on improving my program on its thread, and updating sourcecode on github.
Per KartoFlane's suggestion, I'm working on removing my dependancy on FTL Profile Editor by copying the libraries I need into my jar.
At this point I have your code packed into my jar and things work well. However, I'm having trouble with the apachi logger dependency. I have your source code working in eclipse as I managed to get Maven working. However, when I remove my dependency on your jar, I now need to make my code dependant on the apachi logger jars. When I run my program from inside eclipse, it runs but I get this error and no log info works:

Code: Select all

log4j:WARN No appenders could be found for logger (org.iceburg.ftl.homeworld.core.FTLHomeworld).
log4j:WARN Please initialize the log4j system properly.

Running it as a jar outside eclipse yeilds the following error:

Code: Select all

G:\Jar Exports>java -jar FTLHomeworld.jar
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/LogM
anager
        at org.iceburg.ftl.homeworld.core.FTLHomeworld.<clinit>(FTLHomeworld.jav
a:50)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.LogManager
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 1 more

I'm guessing that the secret lies in moving your log4j2.xmls over to my project, or doing some kind of maven transfer/transfusion.
Would you be willing/able to help me / point me in the right direction? I've been trying to manually install the apachi logger jar, but I can't seem to find the exact version you used / understand exactly what to do. Any pointing in the right direction would be greatly appreciated!
Thanks,
Ice

EDIT: I went ahead and commented out all of the log lines. Crude, barbaric, but it worked. I'd still love to know how to do this properly, but I can move on, so I don't want to pressure / nag you.
Thanks,
Ice
Image
Scarythings
Posts: 1
Joined: Wed Jul 31, 2013 5:24 am

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

Postby Scarythings » Wed Jul 31, 2013 5:28 am

Hello!
I encountered an error, I checked the log and this is what I got. The .jar isn't launching anything I locate the file and it just closes.

15:22:49.094 [main] DEBUG net.blerf.ftl.FTLProfileEditor - FTL Editor v16
15:22:49.095 [main] DEBUG net.blerf.ftl.FTLProfileEditor - Windows 7 6.1 x86
15:22:49.095 [main] DEBUG net.blerf.ftl.FTLProfileEditor - Java HotSpot(TM) Client VM, 1.7.0_25
15:22:49.130 [main] DEBUG net.blerf.ftl.FTLProfileEditor - FTL dats path was not located automatically. Prompting user for location.
Vhati
Posts: 792
Joined: Thu Oct 25, 2012 12:01 pm

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

Postby Vhati » Thu Aug 01, 2013 4:21 am

Scarythings wrote:Hello!
I encountered an error, I checked the log and this is what I got. [...] I locate the file and it just closes.
The log just ends there?

And it asks again to find "data.dat" every time?

Who is online

Users browsing this forum: No registered users and 16 guests