Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Author Topic: Out of bounds exception when adding ship  (Read 5067 times)

SpecTRe_X

  • Ensign
  • *
  • Posts: 7
    • View Profile
Out of bounds exception when adding ship
« on: April 23, 2016, 03:33:55 PM »

Hi guys, I'd appreciate some help.

I created a mash-up of some Neutrino Corp ships for myself. I added the png and .ship files into their respective folders inside the Neutrino mod folder, filled its data into the CSV file, and tried running the game.

The loading bar fills all the way to the end then the game crashes with a 28784 error. Below is the section listing the issue:

Code
23338 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.ArrayIndexOutOfBoundsException: 28784
java.lang.ArrayIndexOutOfBoundsException: 28784
at com.fs.graphics.TextureLoader.super(Unknown Source)
at com.fs.graphics.TextureLoader.super(Unknown Source)
at com.fs.graphics.TextureLoader.super(Unknown Source)
at com.fs.graphics.TextureLoader.super(Unknown Source)
at com.fs.graphics.null.super(Unknown Source)
at com.fs.starfarer.loading.ResourceLoaderState.init(Unknown Source)
at com.fs.state.AppDriver.begin(Unknown Source)
at com.fs.starfarer.combat.CombatMain.main(Unknown Source)
at com.fs.starfarer.StarfarerLauncher$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

I made a custom ship for the Neutrino mod before in Starsector version ~6.1 and didn't have any of these issue, has something changed in the way this is handled since then?

Thanks in advance.
Logged

SpecTRe_X

  • Ensign
  • *
  • Posts: 7
    • View Profile
Re: Out of bounds exception when adding ship
« Reply #1 on: April 24, 2016, 04:10:03 AM »

After some testing I'm no closer to understanding what's going on. Things I've tested include the following:

  • Rebuilt the .ship file with 2 older versions of Trylobot's editor: no change
  • Piggy-backed rebuilt .ship files off of another ship's CSV data, in case CSV errors occurred in editing: no change
  • Plugged the .ship, and sprite files directly into the games respective folders, edited the ship CSV in notepad++: no change
  • Tried implementing the new ship in 6.2a using the ship editor for said version: throws a null error at beginning of load. editing the CSV in various programs makes no difference

I'm probably missing something really obvious. The last time I tried this it was far easier and worked on the first attempt.
Logged

TJJ

  • Admiral
  • *****
  • Posts: 1905
    • View Profile
Re: Out of bounds exception when adding ship
« Reply #2 on: April 24, 2016, 05:24:37 AM »

From that stacktrace alone, I'd wager there's something about the PNG that the texture loader doesn't like.
Try swapping it out for an image you know to work fine.

As for determining what it is the texture loader is barfing on, post your ship's image here.
Alternatively, there's Tweakpng; an excellent tool for inspecting the structure of PNG files.
Logged

SpecTRe_X

  • Ensign
  • *
  • Posts: 7
    • View Profile
Re: Out of bounds exception when adding ship
« Reply #3 on: April 24, 2016, 03:42:59 PM »

I hadn't thought of that, I was so fixated on the line that read "combatmain".

The png can be found here

and the display from tweakpng is attacked.

[attachment deleted by admin]
Logged

TJJ

  • Admiral
  • *****
  • Posts: 1905
    • View Profile
Re: Out of bounds exception when adding ship
« Reply #4 on: April 24, 2016, 05:47:49 PM »

64 bits per pixel (RGBA 16 bits per sample) seems like it could cause problems.
Logged

SpecTRe_X

  • Ensign
  • *
  • Posts: 7
    • View Profile
Re: Out of bounds exception when adding ship
« Reply #5 on: April 24, 2016, 09:04:38 PM »

What's odd is that another ship I mashed has the same bits/sample but has a lower dpi. I'll try lowering each separately and together then post back.

EDIT: I lowered the dpi to 240 and dropped the bits/sample to 8 but now I get the following:

Code
23749 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at com.fs.starfarer.loading.scripts.ScriptStore.o00000(Unknown Source)
at com.fs.starfarer.settings.StarfarerSettings.?0000(Unknown Source)
at com.fs.starfarer.combat.entities.Ship.<init>(Unknown Source)
at com.fs.starfarer.loading.specs.forsuper.o00000(Unknown Source)
at com.fs.starfarer.loading.specs.forsuper.o00000(Unknown Source)
at com.fs.starfarer.combat.CombatEngine.getPlayerShip(Unknown Source)
at com.fs.starfarer.combat.CombatEngine.advanceInner(Unknown Source)
at com.fs.starfarer.combat.CombatEngine.advance(Unknown Source)
at com.fs.starfarer.title.TitleScreenState.advance(Unknown Source)
at com.fs.starfarer.BaseGameState.traverse(Unknown Source)
at com.fs.state.AppDriver.begin(Unknown Source)
at com.fs.starfarer.combat.CombatMain.main(Unknown Source)
at com.fs.starfarer.StarfarerLauncher$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
« Last Edit: April 24, 2016, 10:46:31 PM by SpecTRe_X »
Logged

TJJ

  • Admiral
  • *****
  • Posts: 1905
    • View Profile
Re: Out of bounds exception when adding ship
« Reply #6 on: April 25, 2016, 05:15:05 AM »

I'd be very surprised if dpi had any impact; it's almost certainly ignored by the texture loader.
That new stacktrace looks like progress though.

Someone more experienced with adding ships will probably recognize the 2nd stacktrace & know the likely cause; I'd put my money on an error in the csv file.
Post the .ship & .csv files.

Incidentally, what does the starsector.log say immediately before the exception? That's usually a fairly good hint as to the cause.
Logged

Dark.Revenant

  • Admiral
  • *****
  • Posts: 2806
    • View Profile
    • Sc2Mafia
Re: Out of bounds exception when adding ship
« Reply #7 on: April 25, 2016, 08:56:12 AM »

It usually but not always means a fatal error happened during loading of a mod, causing the whole loading stack to implode later on.  Oftentimes it's a missing library or script that won't compile.
Logged

kazi

  • Admiral
  • *****
  • Posts: 714
    • View Profile
Re: Out of bounds exception when adding ship
« Reply #8 on: April 25, 2016, 03:49:13 PM »

Not sure if this is the issue, but iirc indexed PNGs are not compatible with Starsector. This is usually a little checkbox that easy to miss when exporting images as PNGs.
Logged

SpecTRe_X

  • Ensign
  • *
  • Posts: 7
    • View Profile
Re: Out of bounds exception when adding ship
« Reply #9 on: April 26, 2016, 05:06:18 AM »

After reading Dark's post I tried cycling through all the mods in case I left something unactivated that was actually required. When that didn't change anything I reset them to only neutrino and lazylib (to regenerate the log) and it started up like nothing had ever been wrong. There isn't some kind of cache folder, is there? I don't understand why it would just start working again.

I'll throw together another ship and see if it takes properly this time. I'm really at a loss and as happy as I am that it's working, I'd rather know why. Anyway, I'll post back after I put another ship in.
Logged

TJJ

  • Admiral
  • *****
  • Posts: 1905
    • View Profile
Re: Out of bounds exception when adding ship
« Reply #10 on: April 26, 2016, 05:52:44 AM »

There isn't some kind of cache folder, is there?

There is, but caching is disabled by default. (it was buggy)

enableScriptCaching in data/config/settings.json
Logged

SpecTRe_X

  • Ensign
  • *
  • Posts: 7
    • View Profile
Re: Out of bounds exception when adding ship
« Reply #11 on: April 27, 2016, 02:11:48 PM »

I added another ship and it's working fine so far. I'll have to look through and see if caching was enabled somewhere just to rule it out.

Thanks for taking the time to help guys.  :)
Logged