dstrelau / nimble.monster

0 stars 0 forks source link

Making bestiary.yaml manageable #1

Open Faaab opened 3 days ago

Faaab commented 3 days ago

Hey there! The website looks fantastic 😊 I’d love to contribute to the code when I can find the time.

I was writing up some technical thoughts on the Nimble Discord when I realized, β€œThis would probably make more sense on GitHub!” πŸ˜…

You’ve done a great job with the bestiary’s data structureβ€”it’s really accessible, even for non-coders, with minimal guidance. And it’s clear and straightforward to work with, which is awesome. I did want to suggest a small change for scalability: having all monsters in a single YAML file could become a bit tricky to manage as the project grows, especially if you want to programmatically add or modify monsters down the line.

Here’s a solution I was thinking about:

This would look like:

/monsters
   β”œβ”€β”€ hobgoblins
   β”‚   β”œβ”€β”€ family.yaml
   β”‚   β”œβ”€β”€ hobgoblin-soldier.yaml
   β”‚   └── ...
   β”œβ”€β”€ beasts
   β”‚   β”œβ”€β”€ family.yaml
   β”‚   └── owlbear.yaml
   β”œβ”€β”€ plants
   β”‚   β”œβ”€β”€ family.yaml
   β”‚   └── spore-octopus.yaml
   └── elementals-fire
       β”œβ”€β”€ family.yaml
       β”œβ”€β”€ emberling.yaml
       └── ...

A family.yaml file would look something like this:

# hobgoblins/family.yaml
name: Hobgoblins
slug: hobgoblins
ability:
  name: Hammer the Gap
  description: Once per round as a reaction, make a melee attack against a hero damaged by another creature for free.

Monster files would be really nice and short as well:

# hobgoblins/hobgoblin-soldier.yaml
name: Hobgoblin Soldier
slug: hobgoblin-soldier
level: "1"
armor: H
hp: 15
actions:
  - name: Longsword
    damage: "1d8+1"
  - name: Longbow
    damage: "1d8+1"
    range: "10-120"

This setup makes it easy to add new families or monsters without editing a large YAML fileβ€”just drop in a new folder or file as needed! You’d only need a simple function to loop through the folders and read in all the families and monsters. I’d be happy to work on a script for that if time allows.

This approach also sets you up for future scalability if the monster list grows large, as it would make lazy loading easier down the road. But that’s probably a ways off 😊

Let me know what you think!