Skip to content

Random townies exploration#1801

Merged
manuq merged 7 commits intomainfrom
random-townies
Feb 20, 2026
Merged

Random townies exploration#1801
manuq merged 7 commits intomainfrom
random-townies

Conversation

@manuq
Copy link
Collaborator

@manuq manuq commented Dec 30, 2025

This pull request adds components that make possible the creation of characters from different body parts or props. Also adds one sample character "townie" and replaces some NPCs from Fray's End with it. Townie is made of:

  • Legs: 3 variants
  • Body: 3 variants
  • Head: 5 variants
  • Hair: 5 variants

Also applies cel-shading recolor to 2 parts (body and head) for a random skin tone.

A "zoo" test scene is also provided as initial documentation.


Add RandomTextureSpriteBehavior

Reusing the sprite_frames_exported_textures addon.

This behavior node can be configured with an array of textures, and
provides a tool button to randomize the parent AnimatedSprite2D texture.


SpriteFramesHelper: Allow to call it without an "old base texture"

Only if this parameter is passed, the existing safeguard is checked.
That is, that the new texture and the old one share the same base
texture.


SpriteFramesHelper: Remove unused parameter from _get_base_texture auxiliary function

This parameter is not used by the auxiliary function at all.

Also, remove the double negation and check for FileAccess.file_exists()
directly.


CelShadingRecolor: Expose set_random_skin_color() function

To be able to call it from other scripts.


Add character randomizer script

A single button to randomize various aspects of a character. For now,
the skin tone and the textures of a stack of AnimatedSprite2D that
compose the character with parts like: legs, body, head, hair, head
prop.

Also provides a way to flip the character horizontally. And a way to
start the current animation of each part at a random frame, but all
using the same random frame. The caveat of having multiple parts is that
existing logic like the RandomFrameSpriteBehavior don't work for an
array of sprites, so some things have to be reimplemented.


Add random townie character

Draw the character in Aseprite as layers. Each layer has a part variant
and offset encoded in its name. For example:

  • "head_003" for variant 3 of the character head.

  • "body_002.dy_-12" for variant 2 of the character body,
    and an offset of -12 in the Y axis.

Export each part variant as PNG. Create a scene with one
AnimatedSprite2D node per part. Use the character sprite randomizer to
randomly set the multiple PNGs of each part. Also use the cel-shading
node and material in each part with skin. Add the character randomizer
to the root node.

Also add a test scene with multiple townies instantiated. Add talker
behavior to them and some dialogue explanation.


Use random-generated townies in Fray's End

Replace Talker and rename it to TutorialGuy, adding an
InteractArea and a TalkBehavior for the tutorial dialogue.

In the same way, replace the Farmer. Edit the dialogue to
not use npc_name variable.

Replace other NPCs by random townies: FarmersPartner,
GardenerA, and GardenerB.

@github-actions
Copy link

Play this branch at https://play.threadbare.game/branches/endlessm/random-townies.

(This launches the game from the start, not directly at the change(s) in this pull request.)

@manuq
Copy link
Collaborator Author

manuq commented Dec 31, 2025

Reusing the sprite_frames_exported_textures addon.

This behavior node can be configured with an array of textures, and
provides a tool button to randomize the parent AnimatedSprite2D texture.
Only if this parameter is passed, the existing safeguard is checked.
That is, that the new texture and the old one share the same base
texture.
…xiliary function

This parameter is not used by the auxiliary function at all.

Also, remove the double negation and check for FileAccess.file_exists()
directly.
To be able to call it from other scripts.
A single button to randomize various aspects of a character. For now,
the skin tone and the textures of a stack of AnimatedSprite2D that
compose the character with parts like: legs, body, head, hair, head
prop.

Also provides a way to flip the character horizontally. And a way to
start the current animation of each part at a random frame, but all
using the same random frame. The caveat of having multiple parts is that
existing logic like the RandomFrameSpriteBehavior don't work for an
array of sprites, so some things have to be reimplemented.
manuq and others added 2 commits February 20, 2026 18:16
Draw the character in Aseprite as layers. Each layer has a part variant
and offset encoded in its name. For example:

- "head_003" for variant 3 of the character head.

- "body_002.dy_-12" for variant 2 of the character body,
  and an offset of -12 in the Y axis.

Export each part variant as PNG. Create a scene with one
AnimatedSprite2D node per part. Use the character sprite randomizer to
randomly set the multiple PNGs of each part. Also use the cel-shading
node and material in each part with skin. Add the character randomizer
to the root node.

Also add a test scene with multiple townies instantiated. Add talker
behavior to them and some dialogue explanation.
Replace Talker and rename it to TutorialGuy, adding an
InteractArea and a TalkBehavior for the tutorial dialogue.

In the same way, replace the Farmer. Edit the dialogue to
not use npc_name variable.

Replace other NPCs by random townies: FarmersPartner,
GardenerA, and GardenerB.
@manuq manuq marked this pull request as ready for review February 20, 2026 21:29
@manuq manuq requested a review from a team as a code owner February 20, 2026 21:29
@manuq manuq merged commit 95cee89 into main Feb 20, 2026
6 checks passed
@manuq manuq deleted the random-townies branch February 20, 2026 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant