Huh... Are you trying to create entity-relationship diagrams from a game engine code ?
Yes, but from header files (.h) not from source files (.c) and also not only for Quake ....
frag.machine wrote:Do you really believe this will help you understand a fairly complex C program ?
Yes. I dont usually need to look at code when I see the data ... sometimes yes, but I can usually picture how it works with the data. What Pike said works for me
. The reason why it is so is because I quite read and studied algorithms and data structures and what some smart guys thought about them until I had some good image in my head.
I just started reading the code. A piece at time. "today, I'll study, let's say... sys_win.c. ....Have you already tried this ?
Well, I did the same approach long time ago when I first get Quake source and studied it a lot. I did not know programming so I mostly tried to understand it, pointers were like something from outer space to me ... I had book on C programming but did no real programs with it (mostly because the book was bad, it just contained syntax description with few advices ... it was more description of syntax than how to make use of it ... not like BWK and Ritchie book http://net.pku.edu.cn/~course/cs101/200 ... nguage.pdf
, which contained real world examples). Later I got some experience with algorithms and data structures and problems&solutions which are made in games. It used to be complex but it is not complex anymore, sometimes I have problems but I ca imagine lot of processes.
But, hey, lets look at it some other way. What were we doing by reading the code? Looking at specific solutions to a specific problems. Not only we were trying to understand how solution worked, we also tried to understand what the problem was. Even thought we learned - what a pain. Better is to tell the intentions, goal http://c2.com/cgi/wiki?IntentionalProgramming
Quake is bunch of problems & solutions, with some solutions making new problems, and this circle ends when there is no more problems; or problems small enought to not care about them.
By looking at the data I dont need to decipher how they walked the data, because I know how they did that (or at least can image how and what is the complexity) + I know some algorithms and patterns and ideas from variety of areas.
frag.machine wrote:Never occurred me to resort to any UML diagram (let alone a database-oriented diagram) to understand how things work in Quake.
In never occured to me to do UML before either. But I like to vizualize things. I was skeptical to UML, but in the end I found it a good tool. Not all of it but some of it yes. ER are the thing I like the most about them, I dont use the other ones because I dont need them yet ...
We were doing some ER modelling at school and it helped me to understand programming more. I then looked at some old code, draw relations between entities and few things clicked more than before. I realized, that relationship database can be seen as generic data modelling tool and the others like network modelling can be seen as optimizations of it. Java, Cpp uses network modelling (network data model) so You are doing node.lookupbyname("foobar")->johny.francesco instead of some SQL (for data in these tables, filter these items, classify them, order them, filter these attributes ...) ... (most likely) the same thing, but I like SQL better because it does not connect data directly .... well, but my style of progarmming in C++ was to "hey, lets use some vector or list template to avoid objects and do some functional style here
" ... so I avoided objects like a plague, until I found Python, well pygame http://www.pygame.org/news.html
, and tried some objects, then I looked at the GOF and realized (with help of some smart guys) that some patterns are about how to do functional programming in object oriented language
, OOP languages usually dont have first class functions ...
I needed this ER modelling especially for Tomb Raider. I looked at TRosettaStone http://www.tnlc.com/eep/tr/TRosettaStone.html
which is description of data structures of Tomb Raider. I draw some ER and I was able to picture algorithms which made this thing work. It worked for me, i mean, it is a tool, and this tool just suits me.
frag.machine wrote:(I mean, why Quake needs several different collision hulls after all ? Can't it make things, you know, just collide directly against the world geometry ?!).
These collision hulls ... they can be there just because they made one, then realized it does not work at all cases so they made another. Quake is not always an example how you should do it, because they certainly did not do great desing all the time.