• Register
Forum Thread
  Posts  
Navigating OpenJK Source Code (Forums : Coding & Scripting : Navigating OpenJK Source Code) Locked
Thread Options
Nov 21 2016 Anchor

I'm a total noob when it comes to game programming. All my experience is with the web, and while I have made a couple small Javascript-based games, it's nothing that's too complicated.

But when I found out that the source code for Jedi Knight 2 + 3 was made open source as the OpenJK project, I knew I had to download it and see what I can do. I started learning C++, and I know I have a lot more to learn, but I was trying to look through the codebase to start familiarizing myself and maybe make some tweaks just to start getting a feel for it. But the problem is, I opened the solution (in VB) and couldn't figure where to start. It's about 20 projects each with a dozen directories, tons of .cpp files that have "main" in the title...I don't even know what I'm looking for!

My question is this: how would a seasoned game developer start trying to make sense of a foreign codebase? What would you look for? Files, classes, etc?

The project is prepped for building (???) using CMake (another first for me). I was able to build and run it, but beyond that I just don't really know where to begin. You can find the source at Github.com

Does anyone have any suggestions? Thanks!

Nightshade
Nightshade Unemployed 3D artist
Nov 26 2016 Anchor

I think you are in way, waaay over your head :(
Even with basic skills in gameplay programming you would have a hard time reading said source code unless it's pretty well-documented or unless you are a seasoned C++ gameplay or game engine -programmer. I'm a Tech Artist - I have a fairly good overview of how games work (code as well as art) but even I am scared of going through C++ code. That kind of programming is simply too low-level for me.

I don't like telling people to give up but really, you need to look at something more simple first before diving right into a professional C++ AAA-project created by two-dozen coders. If your objective is to start learning gameplay programming then I strongly suggest that you start with smaller, personal projects in 2D, using some user-friendly engines with some more high-level coding languages. Do tons of mini projects, learn all the basic concepts such as the update-loop, user-input, event-listening, collision-detection, etc and then you can start looking into learning basic/intermediate C++. Below are some good recommendations:

Defold (3d engine with 2d focus. High-level programming in Lua)
Unity (One of the most popular 3d engines around. Huge userbase. Mid-level programming in C#)

("Level" in programming refers to how close to the hardware you work and has nothing to do with how "difficult" something is to learn. Example: In C++ you need to allocate memory by yourself, do garbage collection, etc - You don't do things like that in Lua or C#, which manages this for you)

Edited by: Nightshade

--

   - My portfolio
“There he goes. One of God's own prototypes. Some kind of high powered mutant never even considered for mass production. Too weird to live, and too rare to die.” Hunter S. Thompson

Mar 4 2017 Anchor

Hi, I am one of the people who worked on that project. You can maybe send me a private message with some more concrete information as to what you need help with. There is a Discord channel where coders regular talk on.

Mar 4 2017 Anchor

Q3A engine is one of the most fan documented engine's out there (I think the last commercial game it was used for was Modern Warfare 2). I 100% agree that diving right in to a game's C code is way over your head if you don't know much about C.

The best way to start is to know what you want to do. IE I like to play with Q2's code so I'll say "Hey, I want a fountain of gibs when I kill someone!" so I find the gib spawning code on death & start doing stupid stuff with that. Remember, the worst you can do is crash your computer. :) (a fountain of gibs was pretty cool). Finding a variable you're looking for & doing global searches helps too. And commenting all your changes so you know what works/doesn't.

id has almost the exact same layout for all it's engines in regard to how they organize stuff. Companies that used it's code seem to keep that layout pretty similar, many times just adding the stuff they want w/o deleting id's stuff. So with that, here's an overview of the Q3A engine that should help: Fabiensanglard.net

Reply to thread
click to sign in and post

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.