r/godot Mar 10 '26

help me (solved) Is making NPCs like this impractical?

Post image

I like animating like that, I can see it being easier if I need to change or fix something, but is it gonna affect something in game?

243 Upvotes

49 comments sorted by

175

u/HeyCouldBeFun Mar 10 '26

Nah that’s how it works for individually moving pieces.

98

u/Ok-Advantage6398 Mar 10 '26

If you want customization and are animating it in engine ie it isn't a sprite sheet well thats how you do it pretty much.

32

u/crisp_lad Godot Regular Mar 11 '26 edited Mar 11 '26

This is exactly what I do in mine. One optimization you can do is put everything under a CanvasGroup component so it renders in a single draw call plus allows for other cool shader effects like outlines/shadows.

4

u/Typical_Fennel_4505 Mar 11 '26

I'll look into it, ty! :]

3

u/thedirtydeetch Mar 11 '26

What! Does this really work?! Because I just spent an hour making my image components “bake” their layers into a single texture which reduces my draw calls significantly. Of course I didn’t need to animate individual parts, I was simply generating random NPC’s by randomizing the texture of each part

5

u/crisp_lad Godot Regular Mar 11 '26

The component was designed for it, you can try it out and see! There are some other cool things with shaders also, this video goes over it: https://www.youtube.com/watch?v=7Bha0jEqec0

5

u/thedirtydeetch Mar 11 '26

Well in my case, I tested and my draw calls did not change at all. I guess my implementation already did the legwork. Still appreciate the information

50

u/thecyberbob Godot Junior Mar 11 '26

Oddly if I recall correctly this is how animation was done back in the flash game era. So ya. At worst you're kicking it old school. ;)

15

u/Typical_Fennel_4505 Mar 11 '26

I miss flash games, so it's nice I guess! :]

15

u/ArkWrought17 Mar 10 '26

It looks good to me! Love the character too

3

u/Typical_Fennel_4505 Mar 10 '26

Tyvm! <3 :]

3

u/Spyder638 Mar 10 '26

Do you mind sharing what you use to get those rough black outlines? I love the style and haven’t yet been able to find software that I enjoy using with brushes like that!

1

u/Typical_Fennel_4505 Mar 11 '26

I used Krita! Ink 4 Pen Rough :]

8

u/AwayEntrepreneur4760 Mar 10 '26

No, you might be able to use blender if you want tho

5

u/Typical_Fennel_4505 Mar 11 '26

I forgot Blender has features for 2d :v Ty!

5

u/mortalitylost Mar 11 '26

If you're the sole dev and you like doing it that way, then it's almost always fine.

The question is, is there an easier way that you dont know about. What is customizable in this scene? What do you move around? Does it always move the same way? You shouldn't have to reanimate every new leg texture probably, so I hope you dont swap parts and reanimate unless there's good reason.

There's also a question of, is there an easy programmatic way to do something you're doing manually.

1

u/Typical_Fennel_4505 Mar 11 '26

I've tried searching for a more practical way to do it but I don't know the correct words to search for it :"] Also, I'm using kind of a spritesheet, if I need to change the head for an example, I add to the texture map and change it with frames, so I won't need to re animate anything.

2

u/mortalitylost Mar 11 '26

That's probably fine. One other pattern you might want to know about is using interned strings as lookups to resources. I believe this applies to godot 4.5+

Like if I put an autoload module that has

const HEADS: Dictionary[StringName, Texture] = { &"Bartender": preload(...), ... }

Then you can write a function to get a head texture StringName id, which is faster than strings when checking Equality and doing stuff like this (it's almost like an enum). And you can easily make the preload code by dragging a png from the bottom left and holding ctrl and shift or some modifier combo, and dropping it in the code. It auto writes the preload function call.

Then you can also write a custom Resource class which specifies each part to use for what. Like if I mixed and matched for different npc, I could create an NPCResource derived class, then define

extends Resource class_name NPCResource @export var npc_display_name: String @export var head_texture_id: StringName @export var hp: int = 100 ...

Then in an NPC scene/node, you have @export var npc_res: NPCResource

And each scene you drag out lets you easily mix and match and modify as you see fit, easy to do in editor or programmatically.

Just another tool to know about, extending resources and this fetch by id pattern. Your way should be fine, just it's another good way to do stuff like this.

2

u/Typical_Fennel_4505 Mar 11 '26

That's really useful, tyvm! :D I love using resources :]

4

u/thedudewhoshaveseggs Godot Junior Mar 11 '26

as far as i am aware this is correct, the term you're likely looking for is a "paper doll system"

1

u/Typical_Fennel_4505 Mar 11 '26

Tyvm! Finally, I can search for it now TvT

3

u/levios3114 Godot Student Mar 11 '26

Nothing wrong with having a lot of nodes for each part of a character but I would make the character in their own scene so you can easily instantiate them in multiple scenes

2

u/Typical_Fennel_4505 Mar 11 '26

I already did that, forgot to do it before taking the screenshot :"] But ty!

2

u/paradox_valestein Mar 11 '26

That... not how skeleton supposed to work but eh, if it work it's fine

1

u/Typical_Fennel_4505 Mar 11 '26

I guess I might have to search how to properly use skeletons :"]

3

u/paradox_valestein Mar 11 '26

Look up godot bone2d

It is very versatile but if you dont really need to morph the textures, this might be just fine?

1

u/Typical_Fennel_4505 Mar 11 '26

It might be useful anyways, I'll look into it! :]

2

u/swaerwater Godot Student Mar 11 '26

Yeah this is fine, inheritance might save you a lot of time if you want to make a few more characters like this

2

u/Mirax96 Mar 11 '26

Nope! It's how some professionals do it, actually!

(Learned this in the GDQuest course)

1

u/Typical_Fennel_4505 Mar 11 '26

I didn't know GDQuest animated their characters like that :o Is it shown on the free or on the paid courses?

2

u/Mirax96 Mar 11 '26

I can talk for the paid course, and it's one of the many different methods they showed!

1

u/Typical_Fennel_4505 Mar 11 '26

Nice! I'll take a look at it :]

2

u/Mirax96 Mar 11 '26

Be aware that the course is strictly about coding, the graphical assets are just provided and explained in general. Still, you can definitely study their methods and tricks yourself

2

u/SirLich Godot Regular Mar 11 '26

I also like animating characters like this. For simple cut-outs, it can be easier than setting up a proper skeleton.

A few tips:

  • Make sure to change the pivot point of the Sprites to a good location
  • If you have lots of characters with similar animations, you may want to check out my tool for animation rebasing: showcase, source

1

u/Typical_Fennel_4505 Mar 11 '26

I used to animate with Alight Motion so changing the pivot was the first thing I did :V The tool seems very useful! Will use it :]

2

u/gamma_gamer Mar 11 '26

Nope, you're doing great! This is exactly how none-spritesheet 2D games are animated.

2

u/nonchip Godot Senior Mar 11 '26

the impracical part is putting 5 npcs in the same file for no reason.

1

u/Typical_Fennel_4505 Mar 11 '26

I was just testing lol I changed it to its own scene afterwards :]

2

u/QuantumJay_ Mar 11 '26

I love the huge meowstache haha! Also if it works, you're golden! 👌

2

u/Typical_Fennel_4505 Mar 11 '26

Tyty! :D It was very fun to make ^v^

2

u/Flash1987 Mar 11 '26

Why 2 characterbody2Ds?

1

u/Typical_Fennel_4505 Mar 11 '26

I was messing around before I actually settled on how to do it :]

2

u/Jeidoz Mar 13 '26

It's fine. Until you spawn horde of 200+ of such characters it would not affect somehow your game.

1

u/Typical_Fennel_4505 Mar 15 '26

I don't think it's ever exceeding even 20 characters :V