Polonius Ulf replied to Why do all enemies have the exact same attack pattern? November 27, 2021 @ 12:21:08 pm PST

Oooh! Ohh! I know! It's because they are using object oriented programming. C# is an O-O language.

An "object" is simply data and code that uses that data bundled together into a widget that lets programmers write statements like "monster.attack." (Except the mobs are state machines and may "decide" on actions like that for themselves, but such is the general idea)

In O-O there is also the concept of inheritance. An object can have descendants which inherit the characteristics of the parent.

So the answer to your question is that the ancestor of all mobs has that attack pattern, which every descendant mob then inherits. (That ancestor itself will descend from a common ancestor of all critters that dwell upon the map, including the player)

If they improve the tactics of the common ancestor, then every mob will inherit that improvement. If they make the common ancestor smarter, then ditto. For different mobs to have different patterns is a matter of adding or subtracting tactics farther down in the hierarchy.

Making the mobs smarter is something the devs probably don't intend to do until Valheim is largely complete and they are in the polishing phase.
9:13 pm, November 27, 2021
Polonius Ulf 0 comments 0 likes