1
\$\begingroup\$

To get started with game development I purchased some top-down sprite assets which come arranged in a grid, but to use them with a typical 2D rendering engine (I'm using Pixi.JS), I need a JSON file tracking the coordinates and dimensions of the grid the assets are arranged onto (which was not included in the package I purchased).

So I bought a license for TexturePacker thinking I would be able to somehow generate that JSON. I suppose I could write a program that generates the JSON file (since I do know the assets grid size for the PNG) but I'm wondering if I'm missing some easier way.

The thing is, I purchased probably ten different assets packs and most of them include many of their assets in a plain PNG grid layout with no JSON file tracking the dimensions of the grid. So it seems like a normal format. So I'm perplexed by the idea of having to manually separate the grid into separate PNG assets to then feed it to TexturePacker to re-combine the assets into a grid.

Is there an easier way?

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

I suppose I could write a program that generates the JSON file (since I do know the assets grid size for the PNG) but I'm wondering if I'm missing some easier way.

There might be some program that does that, but if you haven't already found one, I encourage you to write your own. Generating rectangles on a regular grid and writing JSON is a simple problem — and you may later be able to adapt the same code, that you're familiar with because you wrote it, to more "asset pipeline" problems as they come up.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ This is basically what I did. As silly as it sounds, breaking down grids into separate PNGs through ImageMagick and then back into grids through the TexturePacker, getting the JSON file with the metadata. \$\endgroup\$
    – J.Todd
    Jan 25, 2022 at 0:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .