program needed - To make ER diagrams for QuakeC and C

Discuss programming topics for any language, any source base. If it is programming related but doesn't fit in one of the below categories, it goes here.
Post Reply
daemonicky
Posts: 185
Joined: Wed Apr 13, 2011 1:34 pm

program needed - To make ER diagrams for QuakeC and C

Post by daemonicky »

What?
Do you know about any program which makes ER diagrams from header files?

How?
So You get what I need I made a picture. I image it will take steps like there http://img7.imagebanana.com/img/i1hv0f0y/erd.PNG .

Why?
Robert Pike wrote:"Rule 5. Data dominates. If you've chosen the right data structures and organized things well, the algorithms will almost always be self­evident. Data structures, not algorithms, are central to programming. (See Brooks p. 102.) " - http://www.lysator.liu.se/c/pikestyle.html
During my time of a programmer I found it is true. At least for me. But it is somewhat not so great for OOP, because there you have to have slightly differend mindset http://ootips.org/er-vs-oo.html , but otherwise it is how I usually approach programming if I am not hacking.

I would need it to make few diagrams for Quake. And also for some tutorial for Quake. And my own needs. And I guess some other people might appreciate such program.

First, I have not made a program to make graphical nodes, lines, boxes and their connections like would be neded. Second, I have made interpreter (therefore parser), but a simple one. Therefore I am quite sure it would take less time to find program, which already does it, than to make one on my own. :)

What I found so far?

Lepus3 for java http://en.wikipedia.org/wiki/Lepus3
is a tool by which you can find also GOF design patterns in you code. It has 100 megabytes http://ttp.essex.ac.uk/main/download/ . Why not ? :-D Program in action http://www.youtube.com/user/TwoTierProgramming .
Think, touch, movetype, solid, traceline ...
frag.machine
Posts: 2126
Joined: Sat Nov 25, 2006 1:49 pm

Post by frag.machine »

Huh... Are you trying to create entity-relationship diagrams from a game engine code ? :? Do you really believe this will help you understand a fairly complex C program ?

Never occurred me to resort to any UML diagram (let alone a database-oriented diagram) to understand how things work in Quake. I just started reading the code. A piece at time. "today, I'll study, let's say... sys_win.c. Yeah, let's learn how Quake actually interfaces with Windows to alloc memory, query the current time and this kind of stuff." . Once I grasped at least the basic idea, I moved to another part. No hurry, one part at time. Helped me a lot, actually. Of course, there are parts that I just never got completely (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 ?!). But overall is enough to me. Have you already tried this ? :)
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
daemonicky
Posts: 185
Joined: Wed Apr 13, 2011 1:34 pm

Post by daemonicky »

frag.machine wrote: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.
frag.machine wrote: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 ? :)
Of course. :) 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[3].lookupbyname("foobar")->johny.francesco[8] 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 :-D " ... 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 :-D , 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.
Think, touch, movetype, solid, traceline ...
Post Reply