Re: Coding monsters and items
- From: Radomir 'The Sheep' Dopieralski <sheep@xxxxxxxxxxxx>
- Date: Mon, 15 May 2006 18:39:29 +0000 (UTC)
At 15 May 2006 07:38:13 -0700,
Jeff Lait wrote:
Radomir 'The Sheep' Dopieralski wrote:
I'll point out that I disagree with your claim that having a flag that
is only set for one monster or only set for one object is "expensive".
It isn't.
Well, they are not necessarily expensive in terms of complexity of the
data files and their parser. But what they inevitably complicate is the
space of all possible monsters/items.
With a special case, you only have one special monster. With a flag, you
suddendly have 2*(number of flags so far) new potential monsters. And
even when you don't really use any of them, you usually take some care
to ensure that any combination of the flags at least doesn't crash your
program (and at most, that every combination is sane).
Besides, I had to think up some disadvantages of the approach -- for
balance ;)
It also forms my
counter argument to the complaint that special cased code is impossible
to follow the logic of. By requiring all the special cases related to
a behaviour exist in a single place, you can get a birds eye view of
their interaction.
Not impossible, but requires discipline and caution to maintain. And
that's additional work. Also note that the special case code usually
describes interactions, and thus can belong into several different
places. By putting all the special case code into one of the places,
you make it easier to analyze -- but at the same time you make all
the other places harder to analyze.
Every time you have to think of what you need to analyze and where
you want it to be easy for your convenience. This inevitably involves
decissions, and decissions are hard and often make you err. Of course,
programming is all about making those decissions -- but still you
can choose the easier path... ;)
--
Radomir `The Sheep' Dopieralski
.
- Follow-Ups:
- Re: Coding monsters and items
- From: Krice
- Re: Coding monsters and items
- From: Novus
- Re: Coding monsters and items
- References:
- Coding monsters and items
- From: Radomir 'The Sheep' Dopieralski
- Re: Coding monsters and items
- From: Jeff Lait
- Coding monsters and items
- Prev by Date: Re: Lines of Codes - how many is enough?
- Next by Date: Re: Coding monsters and items
- Previous by thread: Re: Coding monsters and items
- Next by thread: Re: Coding monsters and items
- Index(es):
Relevant Pages
|