Fractal Softworks Forum

Please login or register.

Login with username, password and session length

Author Topic: Resolving the correct sprite(s) for a ship  (Read 1413 times)

redlynx

  • Ensign
  • *
  • Posts: 11
    • View Profile
    • Sector Loadouts
Resolving the correct sprite(s) for a ship
« on: January 07, 2019, 08:25:58 PM »

Hi all,

I am having some trouble understanding the general file structure and how to resolve sprites for a given ship (outside of a mod). Here's what I am trying to achive - I would like to resolve a sprite for a given ship by id. The general structure is (almost) clear, too - we have ship_data.csv as a collection of all available entities, and each ship furthermore has one or more possible hulls (inside the data/hulls directory). For any given hull, the *.ship JSON contains a token called spriteName, pointing to the correct sprite (inside the graphics/ships directory).

Take the Hammerhead, for example - the ship's id is 'hammerhead', so there is a 'hammerhead.ship' in the hulls directory. The spriteName attribute points to graphics/ships/hammerhead/hammerhead_base.png. In addition, there is a skin for the Hammerhead D - hammerhead_d.skin, pointing to graphics/ships/hammerhead/hammerhead_damaged.png.

However, when trying to resolve each ship using said algorithm, I encounter some inconsistencies. Take the Cerberus, for example - there just isn't any cerberus.ship JSON, but two variants in the data/hulls/skins. Again, both JSONs point to the respective sprite. So, when trying to resolve the available sprites for each ship (by id), should I change my algorithm to:

* First, try to find {shipId}.ship in data/hulls. If it exists, add the sprite from its spriteName attribute.
* Find any {shipId}*.ship in data/hulls/skins. For each file encountered, add respective sprites.

Is there anything wrong with that attempt? Thanks in advance.

Logged
https://sectorloadouts.info -- create and share your favorite loadouts! (BETA)

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: Resolving the correct sprite(s) for a ship
« Reply #1 on: January 07, 2019, 09:22:20 PM »

Hi!

The name of the .ship file or the ship's png does not have to follow any particular convention. It generally does, but in some cases - as you noted - there are inconsistencies, either for historical reasons or for ... reasons.

The way it works is the game will load all .ship files from a set of folders. Then it'll go from there; nowhere in this process does it rely on the ship hull's ID to figure out a filename.
Logged

redlynx

  • Ensign
  • *
  • Posts: 11
    • View Profile
    • Sector Loadouts
Re: Resolving the correct sprite(s) for a ship
« Reply #2 on: January 07, 2019, 10:30:02 PM »

Thanks, Alex. I just learned that the Cerberus apparently was called warhound at some point (well yeah, it's a big Hound). I will rely on the *.ship files, then.
Logged
https://sectorloadouts.info -- create and share your favorite loadouts! (BETA)