[DGD] Out of curiosity...

Felix A. Croes felix at dworkin.nl
Mon May 25 22:01:43 CEST 1998


> I was playing with the idea of making a really fat Auto-object. Putting in
> environment-functions, inventory handling, action handling, all possible
> string and array functions (strstr, filter_array etc) and all other stuff I
> want to have easy access to. 
>
> I am sure it is a bad idea, but exactly how bad is the idea resource-wise?
>
> It won't add many more global variables to the file compared to an auto-object
> with env/inv, actions and security, but an obscene amount of extra functions. 
>
> What would this cost me in terms of memory and performance?

There is an obscure cost associated with functions in the auto object
that are neither static nor private: all such functions have a cost of
two bytes a piece in <every> inheriting object's program.  This is also
true for non-private functions in all other (i.e. non-auto) objects.

Normally, this is not much of a problem.  However, if you were to have
200 such functions in the auto object, every other program in the game
but that of the driver object would become 400 bytes larger.

Felix



More information about the DGD mailing list