Deník vývojáře

Za oponou hudby: Jak jsme vytvořili algoritmus kvality skladeb

Feb 9, 20267 min čtení

Deník vývojáře o navrhování spravedlivých, napínavých a strategických mechanik kvality skladeb s deterministickým RNG.

How does Road to Headliner decide if your song is a hit or a dud? In this developer diary, we pull back the curtain on one of the game's most important systems: the song quality algorithm.

The Design Challenge

We wanted song quality to feel fair but unpredictable — just like real music. The best musicians and studios should consistently produce better results, but there should always be room for surprise. A garage band can write a masterpiece, and an expensive studio session can produce a mediocre track.

The Quality Formula

Song quality is calculated from several factors:

  • Musician Skill Average: The raw talent of your band members. This is the biggest factor and the one you have most control over through recruitment and rehearsal
  • Band Cohesion: How well your band works together. A cohesive band writes better songs
  • Idea Quality: The raw concept that was developed during rehearsal. Some ideas are inherently stronger than others
  • Studio Tier: Higher-tier studios provide a quality bonus (better equipment, experienced engineers)
  • Producer Bonus: If you've hired a Producer, they add a consistent quality bump

The Randomness Factor

Here's where it gets interesting. We use a deterministic random number generator (HMAC-SHA256) to add controlled variance:

  • 8% chance of a Lucky Break: +15 quality bonus. This represents those magical studio sessions where everything clicks
  • 5% chance of a Dud: -20 quality penalty. Sometimes the chemistry just isn't there

This means even an excellent band can have an off day, and a struggling band can catch lightning in a bottle. The deterministic RNG ensures these results are reproducible and not exploitable.

Chain Bonuses

When your band performs the same type of action repeatedly, they get into a flow state:

  • 3 consecutive same-type actions: +3 quality
  • 4 consecutive: +6 quality
  • 5 consecutive: +9 quality
  • 6+: +12 quality

This reflects the real-world phenomenon of creative momentum. Musicians who rehearse daily write better than those who rehearse sporadically. Bands on a recording streak produce cohesive albums.

Why We Chose This System

We explored several alternatives before settling on the current approach:

Pure RNG (rejected): Too random. Players felt helpless when bad rolls ruined their strategy. The frustration outweighed the excitement of good rolls.

Pure Deterministic (rejected): Too predictable. Once players figured out the formula, there were no surprises. The game became a spreadsheet exercise.

Weighted Deterministic + Variance (chosen): The best of both worlds. Your decisions (recruiting good musicians, rehearsing, using good studios) meaningfully improve outcomes, but there's always enough variance to keep things exciting.

The Impact on Gameplay

Song quality affects everything downstream:

  • Chart Performance: Higher quality songs climb higher on the charts
  • Streaming Revenue: Quality directly multiplies passive income
  • Fan Conversion: Higher quality songs attract more fans when played live
  • Show Revenue: Setlist quality factors into show performance

This creates a satisfying feedback loop: invest in quality → get better outcomes → invest more in quality. But the variance means you can't just optimize mechanically — you need to adapt when a lucky break gives you an unexpected hit or a dud forces you to change plans.

What We Learned

The biggest lesson from playtesting was that perceived fairness matters more than mathematical fairness. Our early versions had the same average outcomes but higher variance. Players who got unlucky felt the system was rigged, even though statistically it wasn't.

We solved this by:
- Reducing extreme outcomes (no -50 quality duds)
- Making the primary factor (musician skill) more influential than randomness
- Adding chain bonuses that reward consistent play
- Displaying quality factors transparently so players understand why outcomes vary

We believe the current system strikes the right balance: strategic enough to reward smart play, random enough to create memorable moments, and transparent enough to feel fair.