[MUD-Dev] Re: let's call it a spellcraft

Adam J. Thornton adam at phoenix.Princeton.EDU
Thu Sep 24 18:09:05 CEST 1998


On Thu, Sep 24, 1998 at 12:52:59PM -0700, Brandon J. Rickman wrote:
> You are advocating a very rigid and inhumane programming practice.  Some
> thought should go into how numbers are important to the game, not to the
> CPU.  Player stats ranging into the thousands would be irritating, stats
> in the millions incomprehensible.  A player walking around with 2^31 coins
> in her pocket is still a bug, even if the code is bulletproof.

I think we're talking about two different things here.

The implementation of coin class shouldn't arbitrarily restrict the number
of coins to anything less than MAXINT.

However, constraints like 

if (player.current_capacity + item.bulk) < player.max_capacity) are both
useful and necessary.  Same with

int add_to_player_strength(player_t player) {
	if (player.strength < maxstrength(race(player))) {
            (player.strength)++;
	    return(1);
        } else {
            return(0);
        }
}

If memory is *really* at a premium and stats below 20 are the norm, maybe
it makes sense to define strength as an unsigned char rather than an int.
Even so, most compilers are going to align it for you anyway.  If Bob The
Dwarf has a strength of 14, then maybe it does make sense for Godzilla to
have a strength of 235,933.  Why not leave yourself the option?

Adam
--
adam at princeton.edu 
"There's a border to somewhere waiting, and a tank full of time." - J. Steinman




More information about the mud-dev-archive mailing list