Wizards and Warrors

Started by
23 comments, last by LorenzoGatti 6 years, 1 month ago
On 3/10/2018 at 11:05 PM, nhold said:

I think many of you are missing the fact that he specifically says he wants the error caught at compile time, something I don't agree is necessary, otherwise the problem is trivial.

Not only is it not necessary but it's flat out a bogus requirement. How exactly do you catch something at compile time that in most complex cases, would be loaded from a file at run time? You shouldn't know every item that you're ever going to try to equip in a game at compile time in order to stop it, that's a ridiculous sentiment.

Advertisement
1 hour ago, Satharis said:

Not only is it not necessary but it's flat out a bogus requirement.

The rest of his articles in this series aren't different, I think he is trying to solve these problems with his idea of idiomatic OOP and showing why that can be bad? I am not sure.

Engineering Manager at Deloitte Australia

5 hours ago, nhold said:

I think he is trying to solve these problems with his idea of idiomatic OOP and showing why that can be bad?

I think it's unfortunate that his articles featuring this strawman are so widespread. There are valid critiques of OOP techniques to be made, particularly around data-heavy systems like game content, this just isn't one of them.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

There's a principled way to exclude many bad designs for this type of problem: constraining the classes to be reasonable ones.

  • Character and Weapon are different enough to be two different acceptable classes, but...
  • Subclasses of Character and Weapon shall not exist, because the differences between them are trivial and ill-defined.
  • Formal representations of weapon and character "types" could be objects, enum values, constants or the like. Not classes, because there's only one class.
  • Also allowed: CharacterClass and WeaponType, shared by many Character or Weapon individuals either as a factory or template providing a default initial state or as a live read-only prototype.

This rules out bullshit inheritance hierarchies (all are bad!) and suggests, instead, giving every Character and every Weapon a set of tags and checking whether the tags are compatible. It could be done in two ways.

  • Simplified and ad-hoc: the set of tags is the same for characters and weapons (wizards and staves are tagged "easy", warriors and swords are tagged "cutting or piercing") and weapons can be used if character tags intersect weapon tags (allowing e.g. traditional D&D weapon restrictions: clerics, staves, maces and clubs tagged "blunt", warriors tagged "blunt" in order to use any weapon, daggers tagged both "easy" and "cutting or piercing"). Every system is likely to need separate and somewhat redundant tags.
  • Rule-based: tags describe the character or weapon freely ("weapon incompetence" for wizards, "vow not to draw blood" for clerics, "military training" for warriors) and an explicit rule table connects character and weapon tags. There would be some hope to reuse the tags for different purposes (e.g. character skills or weapon maintenance), but rules would be fairly complex.

 

Omae Wa Mou Shindeiru

This topic is closed to new replies.

Advertisement