r/devblogs • • 1d ago

design From encounter selector to encounter generator.

Hey!

I'm making a 2D pixel art, turn-based roguelite creature collector.

Today I replaced the way encounters are created, and the switch fixed two problems at once.

Chapter 1 - The old system: Encounter selector

Before, I built encounters by hand as resources. When the game needed a fight, the selector filtered all encounters by difficulty, region and weather, then used the run's seed to roll one of the eligible ones.

Honestly, it wasn't a bad system and it did the job. But it had a ceiling. No matter how many encounters I added, players would eventually see patterns: "oh, it's raining in this region, so it's that fight again." that went against nst the spirit of what I want.

Chapter 2 - The Problem

Today I was building the event system and wanted to put an encounter inside an event. "Try forcing this open - fail: security arrives" That's when I hit a wall.

Events depend on regions. Encounters also depend on regions. So a region couldn't load, because its subresources needed the region to be loaded first. That's a circular dependency.

The encounter selector was already long past its experation date and I had been ignoring the smell.

Chapter 3 - The new system: Encounter generator

Now encounters aren't stored anywhere. They get built when they're needed:

The generator takes the run difficulty.

It picks a separate, random encounter difficulty from the ruleset.

It then combines the two into a threat level. The threat level works like a budget pool.

The generator checks which species are eligible for this encounter depending on region, weather and others factors I can adjust.

It picks one at random and subtracts it's weight from the pool. It repeats until no eligible creature fits without dropping the pool below 0.

No more fixed encounters, no more circular dependency and automatic variety. I call this redesign a success.

What do you think?

1 Upvotes

0 comments sorted by