adonthell-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Adonthell-devel] Source Code reorganisation


From: Alexandre Courbot
Subject: [Adonthell-devel] Source Code reorganisation
Date: 08 Dec 2001 18:27:40 +0100

I was about to begin a new source tree with only the basic gfx stuff and
the GUI, when I thought it would probably be better if we reorganise the
stuff first, as we talked about it.

I had a look at NeL code again, and I have to say I like the way they
organise their code. Using namespaces, the code is much cleaner and it's
easier to see dependancies and avoid unwanted ones. Here is a short
description of the NeL infrastructure (quoted from the docs):

"The NeL library is further divided into a few libraries: network, ai,
3d and misc. If you want to use ai, 3d or network you also need to use
the misc part of the library. Ai, 3d and network are totally independant
from each other so you can use only the parts you really need in your
project."

Note that there are more libraries actually - notably the DB library
which is responsible for serialising and saving objects (reminds you
something? :)). But these libraries doesn't seem to be independant, as
object serialisation is used elsewhere in NeL.

The misc library contains all the stuff which is fundamental to the
others libraries. That is, all the basic stuff. I guess ours would
contain the integers types definitions, our hash function for the STL
hashmap, etc...

I don't know whether we should follow the same development scheme.
Having totally independant "libraries" doesn't correspond to our goals.
We want the map engine to be able to draw the stuff, play the sounds,
and so on. So I think it's right that for instance the "map" module
needs "audio", "gfx", "ai" and "misc".

Now, how to do this. First step would be to use subdirectories, to put
the different modules into. Then, to have a logical separation, we might
use namespace (all the "gfx" stuff goes into the "gfx" namespace,
simply). Problem is, SWIG doesn't like namespaces, but we can fool it by
making one module per subdirectory. That would do the trick. On the
other hand, you remember why we grouped all the python modules into one:
because if we have separate modules there are code that is duplicated.
To avoid this, we must beware to include ONLY files that are in the
current directory into SWIG. That is, no reference from "map" to "gfx",
for example. This would mean that you can't manipulate an image from the
map module, for example, but I don't think this is a serious problem.
Opinions about this issue are welcome, anyway.

If we do so, we will have to modify/move loads of code. I suggest I
first start doing small parts (basic gfx system with a very basic map
system) to see how things are turning. Then, if everything is ok, we
would move the complete stuff. In this case, maybe it's worth creating a
new module on the CVS, instead of twiddling again with the old one.

Now on the modules names: how about adgfx, admisc, addb, admap, adai,
adaudio, etc...?

Alex.

-- 
http://www.gnurou.org




reply via email to

[Prev in Thread] Current Thread [Next in Thread]