How to use custom reference points in sprites?

I am using TexturePacker to generate my sprite-sheet and texture-atlas file (using the JSON output format). Alongside that I have a “.aa” file describing my animations which I manually created. This setup is pretty much as it is done with the zombie-animations in the demo and works great (after I have learned that sprite-rotating is not supported by MonoGame.Extended currently).

Now for some animations I need to specify reference points in the frame to render other sprites to. For example when picking up objects, displaying a weapon or showing effects. I am aware of pivot-points in TexturePacker, but as far as I understood, this is used for other purposes and is limited to one point per frame. In fact I need to be able to setup multiple custom points (or even areas) per frame.

I am wondering how this could be done most efficiently. I do not see anything that fits my needs in the “.aa” format or the texture-atlas. So my best guess is to add the attributes I need to the “.aa” file and extend the currently used “Astrid Animator Importer/Processor”. However this means manually adjusting these points whenever the sprites change and overriding the Importer/Processor seems no easy task to me. Also to me setting these reference points in a sprite seems such a basic functionality that I guess there has to be a best-practice way on how to do this. Maybe I am currently thinking in the wrong direction. How are you handling reference-points in your 2D animations?

I understand where you’re coming from and I think it’s quite a good idea. It would be nice if you could set custom point in the animation file as you described.

Unfortunately, I think it would be quite a bit of work to get this working and I have quite a few things on the to-do list already. (I do plan to revisit sprite animations at some point in the future, but no set date).

Honestly, I’ve never actually seen this functionality in similar software. The first one that popped into my head was Aseprite which by the looks of it doesn’t do anything like that.

In my experience it’s pretty common to solve these kinds of problems by using some hand rolled custom logic. For example, you could have a “special” frame in the animation that just has some black pixels on it representing the different reference points. You might be surprised how well this works, because you can simply draw the pixels at the right spot in your favorite paint program. You can even use different colored pixels to represent different things.

Another common approach is to simply draw all your art the same way and position the weapons “by convention”. In other words, the reference points are not specific to the artwork, but rather hard coded into the game logic. In small games, this approach has the lowest overhead.

Keep in mind that unless you actually plan on making hundreds of different assets for your game then these simple approaches are often the best. If you do have a much larger goal in mind, building the custom tools yourself might be worth it.