0
\$\begingroup\$

In a Tower Defense game, each hero (or character) has some skills. Each skill has some "chance of appearance" (CoA for short) when attacking enemies and if appeared it has some "hit accuracy" (i.e. hit on enemies) (HA for short) and has effects on the enemies (if hit by the skill) (EoH for short).

Examples:

Skill #1: Frost 1, CoA: 50%, HA: 100%, EoH: (1) slow enemy down for 4s and (2) yield 200 damage points.

Skill #2: Frost 2, CoA: 100%, HA: 50%, EoH: (1) make enemy frozen for 8s.

I first tried to breakdown skills into "atomic" effects and come up with tables as below:

enter image description here

All looks good?

But now we want to update Skill #1 a bit to make it more complicated:

Skill #1: Frost 1, CoA: 50%, HA: 100%, EoH: (1) slow enemy down by 40% for 4s and (2) yield 200 damage points. (Please pay attention to the 40% here!)

Or even coming up with more complicated skills:

Skill #3: Frost 3, CoA: 20%, HA: 100%, EoH: (1) frozen enemy for the first 4s then slow enemy down by 50% for next 4s and (2) yield 200 more damage points.

Skill #4: Frost 4, CoA: 10%, attack enemy 3 times continuously, each time: HA: 50%, EoH: (1) frozen enemy for the first 2s then slow enemy down by 50% for next 2s and (2) yield 400 more damage points.

Each effect now has more parameters to be specified -- which makes my current schema not fit anymore. Please help deal with this!

\$\endgroup\$
10
  • 1
    \$\begingroup\$ Why store static information like that in a database at all? \$\endgroup\$ – Philipp Apr 3 at 10:22
  • \$\begingroup\$ @Philipp I am a newbie in game development. Please give me some suggestions! \$\endgroup\$ – duong_dajgja Apr 3 at 10:23
  • 1
    \$\begingroup\$ Sure. Why do you think that wouldn't be possible? You could either implement the upgraded versions as separate spells or use the current spell level within the methods of the class for each spell. \$\endgroup\$ – Philipp Apr 3 at 11:29
  • 3
    \$\begingroup\$ My rule of thumb for databases in game development is that when your data fits into RAM and you do not need to persist partial changes to your data while the game is running, then you probably don't need a database. \$\endgroup\$ – Philipp Apr 3 at 11:32
  • 2
    \$\begingroup\$ I think that advice would make an upvote-worthy answer, Philipp. \$\endgroup\$ – DMGregory Apr 3 at 13:27