carenalgas / popochiu

Godot plugin to make point-and-click adventure games, inspired by tools like Adventure Game Studio and PowerQuest.
https://carenalgas.github.io/popochiu/
MIT License
214 stars 19 forks source link

Prop's hotspot autotrace #10

Open stickgrinder opened 2 years ago

stickgrinder commented 2 years ago

Benefit description

Tracing interaction polygons around props is tedious and time-consuming. This hinders rapid prototyping and iterative development.
Adding an auto-trace feature that does the bulk of the work would speed up the process and allow to move the graphics elements on the scene without perceivable impacts on the workflow.

Solution description

Popochiu can show a "Trace polygon" button (can be placed in the topbar alongside the other node-related tools) for the PopochiuClickable elements that have a texture attached (ex. props, characters), which automatically populates the polygon property in the CollisionPolygon2D node, based on the texture content.

The procedure will have to take into account the value of transparent pixels on the texture. Here are a couple of links that may be relevant as a base to implement this logic:

Exclusions

  1. This feature won't affect clickable with no sprites or other texture nodes, like Hotspots, for example.
  2. In the case of a multi-frame animation, we may probably just rely on the first frame and let the dev adjust the collider in case there is a big difference between frames of the animation.

Implications

  1. If #8 is implemented as described, each prop sprite will be as large as the whole background. The logic has to identify non-transparent pixels and ignore them to shape the collider.
  2. Always related to #8, if it's implemented, we should expose a flag (either global or for each prop) in the importer interface to trigger the auto-trace feature during the import, allowing a one-click room creation for those using Aseprite.
stickgrinder commented 2 years ago

A couple relevant links:

stickgrinder commented 3 months ago

@drbbgh worked on that and has a working POC.

The result works like a charm but introducing it is dependant on #243 and #238.

This should make its way into 2.1 anyway.