DooMBoy Posted August 8, 2002 I am curious about the source code for Doom. Sure it was written up and everything, but HOW exactly does it tell the game what to do? Do the #include lines tell the exe how to function? (Excuse my ignorance, I am NOT a programmer :) Example: #include <sys/stat.h> #include <direct.h> #include <fcntl.h> #include <stblib.h> How do these things come together to tell the exe what to do? 0 Share this post Link to post
Ichor Posted August 8, 2002 That just means that it uses those files as a reference. 0 Share this post Link to post
esayeek Posted August 9, 2002 the only way you can really start is with a C book. as for the includes, think about how many lines of #include you see compared to how many lines of other stuff you see. you think the #includes tell everything? :) 0 Share this post Link to post
aca Posted August 9, 2002 Dude go get a book on C or something else. That will let you know everything you could ever want. 0 Share this post Link to post
Use Posted August 9, 2002 I love C! i play with Doom's source at leat once a day... on that note, make backups often. 0 Share this post Link to post
fraggle Posted August 9, 2002 If you notice, the source is broken up into different .c files (modules). The .h files are used so that pieces of code in that module can refer to code in other modules. In some cases, they are used to refer to code in libraries. "stdlib.h" for example, has the specification for part of the standard C library. Hope this helps. 0 Share this post Link to post
IMJack Posted August 9, 2002 The ".c" files are the source code itself. Each of these will compile and build into its own program. There'll be one .c file that will finally combine all of these programs into doom.exe. The ".h" files are called Header files. These contain variable declarations and little snippets of code with reference tags attached. These reference tags can be used n place of the block of code in the .c files and really help clean up and speed up the process of writing the program. Like I said, each of the .c files will become its own .exe file. Each of these controls one aspect of the game: Monster AI, the positions and states of entites in the map, drawing the game to your computer screen, et al. Making each bit its own .c and .exe, and only bringing them together in the finished product, makes it a helluva lot easier for a team to cooperate in a project. You know UFO: Alien Defense (aka X-COM)? Ever taken a look at the install directory? That's what Doom looks like before you combine it into doom.exe. That's likely what a playable version of Doom 3 looks like right now. 0 Share this post Link to post
fraggle Posted August 9, 2002 IMJack said:Like I said, each of the .c files will become its own .exe file.No. The .c files are compiled seperately into .o (object) files and then linked together by a linker program to form the .exe file. They cannot be run on their own. 0 Share this post Link to post