Dan_Muller/Scratchpad
SDxWiki

Design notes

Moved to Software Architecture Ideas/Game Loop

Thoughts on APIs and C++

One annoyance with C++ is the lack of any accepted standard for 'name mangling', the algorithm that the compiler uses to generate names of things in object code. These are the symbols used by a linker to knit together object files and libraries to make an executable file.

Names were simpler in C due to a lack of scope constructs in the language, and C compilers followed a very few, simple conventions for 'name mangling'. The conventions were so simple that nobody even thought much about it, and usually all compilers for a given platform (UNIX, DOS, etc.) would use the same conventions. (A typical standard was to prepend an underscore on function names.) This meant that object modules created by different C compilers could be easily linked together.

Alas, in C++, this is not so. For instance, I tried using the Comeau compiler to build our DirectX test program. This compiler uses a different name mangling method than VC++, and I strongly suspect that this was the cause of the problems that ended my Comeau experiments -- DirectX includes C++ APIs, which are hard not to use because they include things like binary arithmetic operators for DirectX data types, such as matrices and quaternions.

TBC

Misc. To Do

On hold:

Dev Env notes

BJam was a bit frustrating to get started with. I'm re-using most of the toolset configurations from Boost. They seem generic enough.

One odd problem: The Jam system used by Boost is very clever. It defines a toolset-independent 'feature' for every build variation -- debug symbols included/excluded, profiling on/off, etc. It puts the binaries in a subdirectory tree that represents a branching path through these selections, where the objects go in a leaf directory. Since there are so many variations, the tree is quite deep. Too deep for XP, apparently, when I used my default home directory (My Documents). So I had to move my work root up high on my disk directory hierarchy. :-)

GARRR. Spent half of my weekend trying to grok MTL, finally punting. Just discovered uBLAS, now I'm trying that. (See Interesting Links/Development Libraries.) Easier to grasp, but it's pre-release, and the docs are also sparse. (Though not nearly so bad as MTL.) It's all overkill for what I'm trying to do at the moment, but a good matrix/vector library will save us time down the road.

[GDB user's guide]


Physics Engine notes

What physics need to be simulated for a space simulation? How much of this needs to be gathered into an 'engine'?

Issues

ODE looks good, but the latest sources are not compilable under MinGW (no alloca.h).

I'm working on writing a simulator from scratch. The basic structure of these simulators is interesting. The body state variables (e.g. position, velocity) get gathered into one long vector of doubles -- a total state vector for the system. Likewise, the derivatives of the body state variables (e.g. velocity, acceleration) get copied to another long vector (same length as first). These two state vectors and the time delta are used to calculate a new state vector, which is scattered back to the body objects. This basic structure doesn't change even if you add additional state, such as rotational kinematics. The function that computes the next state doesn't care how many state variables are involved; it just operates on mondo total-system vectors. It should be possible to arrange things so as to avoid data copying back an forth, instead just updating a pointer in the bodies to index into a new system state vector.

Need feedback from Frank on what he needs from the simulator interfaces. For instance:

Fun things to look forward to:


Dimensions of interest

; Persistence: Persistent objects are stored in a database when not being actively simulated. ; Identity: How an object is uniquely identified. ; Access authorization: Most objects can be accessed and simulated by anyone. Owners can actively modify the state of the object. ; Distribution: Can the object be simulated on multiple nodes simultaneously? Which nodes can 'own' an object? ; Structure: Notes on apparent structure of contained data.

Physical simulation

Physical objects generally 'simulate themselves' based on their current state and requests for updates from their owning simulation. Active objects have input interfaces which vary by the type of object. These input interfaces are only accessible to authorized clients.

Physical object

Persistent physical object