How do I use the source code I have downloaded?

Started by
2 comments, last by Ohforf sake 10 years, 11 months ago

I am really frustrated right now, not thinking clearly, if this is not the right section for this go ahead and move it.

I will illustrate my problem with an example. Say I have gone to the page where ID has placed source code for its old games. I have been told over and over again I need to study code, to tinker with it. So I am taking that advice and trying to do this. Now we will not use the ID page as it is, need to throw in some things someone like me might encounter elsewhere but we'll stick with our example.

Anyhow the ID source is stored on GitHub if memory serves. There's a Download Master or something you can get a copy of everything from. Pretty self explanatory. 7 or 8 times out of 10 getting source code I want to study is not a problem. But what about Subversion? What about these places that take you to seemingly endless FTP links? How do you get the code there? How do you install Subversion or stuff like that on a Windows XP computer and get the code that way? This is the first hurdle.

OK, say we were lucky, as in the case of ID. We have our master. We're also somewhat proficient in our operating system, Windows XP. Can't be a programmer unless you know your way around your OS, right? So extracting is easy. Now we have a bunch of folders, and inside them a bunch of files. We've reached the second hurdle!

This is where I am stuck. I have Doom, Doom3, Quake, CWE (early build of the Uru engine) and a game someone sent me so I could study its editor. How in the heck do I put all this stuff in CodeBlocks or Visual Studio Express? What do I need to do in the IDE? What options do I need to set? How do I configure everything?

Of course the third hurdle is compiling it once you have it all put together in an IDE correctly. Not sure what awaits after that.

I can open a .cpp or .h file in Notepad or CodeBlocks (my preferred IDE) and study the code that way. But in order to tinker with things, figure out how stuff works, well I need to get it compiled and running. I don't know what this process is called, of getting some source code, extracting it, and stuffing it into an IDE so it can be compiled and run. But this is what I would like to know how to do.

If you know of any books I should read, written or video tutorials, could you post the information or links? Also you can consider this a tutorial request. You could even use something like Crystal Space 3D for the project, as the same principles would apply there as far as getting the source code then compiling it.

Please help me with this! I would greatly appreciate it!

You create reality in your mind,
Before experiencing it as reality,
So if you want to change something,
First change what you think about it.

Blog

http://adifferentpath.blog.com/

YouTube

http://www.youtube.com/user/DreamBlissFlows

Advertisement

You're going to have to do a lot of reading.

When it comes to dealing with version control, you'll want to study up on the version control software in question. Usually you need to download a client (git, SVN, whatever) and execute a specific command to access a repository and clone or otherwise download a branch of it. Don't try to download a repository from the HTML browse links. For SVN, you could always use TortoiseSVN, which makes it pretty easy to manage your SVN sources. But whatever tool you use, wherever you download it from will likely have a full set of documentation pages that teach the basics of using that tool. Version control software can get complex, but usually for something as basic as cloning a repository you can find out how to do that in just a few minutes in the documentation.

Building source code repositories depends upon what build tools the developers used for it. For example, according to this page, Doom3 was built using Visual Studio .NET and a solution file is provided in the project. You have to carefully read any web pages or any docs that come with a particular source distribution to figure out what build tools you need, and what third-party dependencies might be required, then do some Googling to find where to download the particular build tool and how to use it.

Most good projects are going to provide instructions for building as well as project files, Makefiles or what have you. There are quite a lot of different build systems out there. You have Visual Studio solutions, Code::Blocks projects, raw Makefiles, CMake, BJam, automake, NAnt, and so on. Each fulfills roughly the same purpose (pulling various source and library files together into a final application) but can go about it in vastly different ways. You have to figure out which one a given project uses, read any relevant documentation, download whatever client software you need, and go to town.

It can take quite awhile to become proficient in all of the many build systems, and as a beginner it can be sort of overwhelming. If you are doing this as an exercise to learn how to program, I'd suggest that you start with simpler projects rather than the source to Doom3. A large part of being a programmer these days is learning how to deal with complexity, and the full source to a large game might just present too much complexity at once for you to really get a handle on it. Try browsing places like github and sourceforge, finding (small) projects you find interesting, downloading them and building them. Learn how different projects are organized, learn how different build systems function. You don't have to become proficient with all of them, but once you learn a typical build system well it will help you to identify similar features in other build systems.

Thank you for your quick reply and helpful response!

Assuming I don't have build instructions, for example I have some source code someone sent me so I could look at how they did their editor, what is a good general rule of them for getting that into an IDE so I can compile and run it?

I have CMake somewhere, I will play around with it later.

Thanks again!

You create reality in your mind,
Before experiencing it as reality,
So if you want to change something,
First change what you think about it.

Blog

http://adifferentpath.blog.com/

YouTube

http://www.youtube.com/user/DreamBlissFlows

You can't build large projects without the build system for which they were intended. Some require strange pre or post processing steps like compiling lua wrappers or such.

For small things, you could try the following

do {

compile all files

if (missing header files)

install library and add include search directories to compiler arguments

} while (! all files compile)

do {

link all files into a binary

if (linker is missing function implementations)

find corresponding library and add it to the linker arguments

} while (! linking was successfull)

This topic is closed to new replies.

Advertisement