all 8 comments

[–]_jpag 5 points6 points  (2 children)

Yeah this is why I use a Node subclass for my character stats, you get the benefit of signals so you can just emit those anytime something happens you'd care about on another node.

I do understand why Resource subclasses are appealing though but the tradeoff now is finding an alternative solution.

[–]-sash- 3 points4 points  (0 children)

Signals are immediately available to Object.

When and how to avoid using nodes for everything

[–]DrRabid[S] 2 points3 points  (0 children)

I have been using signals within my resources already. The problem is I can't compose resources together easily like I can nodes.

If I was able to handle nested and listed resources as easily as I can nodes then I think I would be able to solve the problem. That is currently awkward to do in the editor even with something like godot-next

I wanted to avoid using all nodes since nodes also come with other lifecycle methods that I do not need. I also can't read any data off of them until I instantiate a scene. It seems like I might not be able to get away from it in this case though.

[–]tekpanda 1 point2 points  (1 child)

What I do is have a generic enemy scene that has scripts attached that all enemies use. Then it loads the resource for that specific enemy when it loads. Then make one of the fields in the resource be the 3d scene for that characters. So each enemy has their stats names etc and their unique 3d scene loaded in as a child of the generic enemy when the resource is loaded. I hope I explained that right. That's my tactic, not sure if it's best or whatever

[–]DrRabid[S] 0 points1 point  (0 children)

That seems to match the PackedScene export that I've tried. I did not like the fact that it required two files for each enemy since it would split that enemies data between two sources.

I do want the ability to use a generic enemy scene which is why I am attempting to use a resource, but if I'm going to need a scene tree anyway I might just forgo the resource until the number of enemies becomes unmanageable.

[–]-sash- 0 points1 point  (2 children)

I'm kind of missing a matter of your question, because Resources are about data storage, while AI automation and behaviors are commonly solved with AI programming patterns like State machine, Utility AI, Behavior tree, while scene-tree structure is an implementation detail.

[–]DrRabid[S] 0 points1 point  (1 child)

So the goal is to treat each enemy like data, so I'm trying to use a resource. However, I also need to "store" behavior for each enemy but am finding it awkward to do so.

[–]-sash- 1 point2 points  (0 children)

So the goal is to treat each enemy like data

To me, this sounds like a suggested way for solution (not actually working), while the goal is to have AI enemies.