[Tutor] Module Packages

Zak Arntson zak at harlekin-maus.com
Thu Oct 30 09:37:20 EST 2003


>> In the one-file format, I have the following classes
>
> If you mean by one-file format that you have one
> class per file, can I ask why? If the classes are
> related its usually better to keep them together IMHO.

Sorry, I meant the entire program was in one file. It finally became
unmanageable and I wanted to break it up.

> Why separate Monsters from other Entities? And why
> separate Entities at all, why not just two modules, one
> for the Entities and another for the Game itself.

It's to ease the addition of new monsters. I'd like to be able to add
monsters very easily, so I'd like each one to be dealt with in its own
file. I'm planning on having about 52 different monsters (probably more),
so I don't want them all in the same file.

> Presumably you might reuse the Entity module but less
> likely to reuse the game?

Yes. I will reuse the Entity module a ton. It is the basis for monsters,
players, traps, special effects, anything that has a presence in the game.

> Exactly, its easier to use the module to hold all the class
> definitions. Fine grained file structures tend to be used
> in things like C++ and Java as a mechanism for controlling
> compilation times, but they add a lot of undue complexity
> to a project in my experience.

Right, but it's not to control compilation, it's to coding easier. Easier
to find a monster, and easier to add a new one.

> Alan G.

I hope I've made more sense of what I want to do. My eventual goal is to
make adding new features as easy as plopping in a .py file (say, for a
monster or a new level-building algorithm), and make it easier to find a
specific section of code. Going from just that, what would you recommend?

---
Zak Arntson
www.harlekin-maus.com - Games - Lots of 'em



More information about the Tutor mailing list