Jump to content

Welcome to JKHub

This community is dedicated to the games Star Wars: Jedi Outcast (2002) and Jedi Academy (2003). We host over 3,000 mods created by passionate fans around the world, and thousands of threads of people showcasing their works in progress and asking for assistance. From mods to art to troubleshooting help, we probably have it. If we don't, request or contribute!

Get started

Summer Mod Contest Winner

The votes came in and the winner is SephFF and mjt's Costa del Sol! Take a trip to this sunny vacation spot and enjoy the rays and waves. Join Kyle for a drink, venture into the sky for some flying or dive deep for some scuba diving with the local aquatic life!

Read more

The Mandalorian mod contest results

Our Mandalorian-themed mod contest had a good turnout with great submissions. The winner is Doughnuts' Din Djarin playermodel!

Amazing job to all involved!

Read more

Compiling OpenJK [Win32] [Must read for new coders]


eezstreet

This tutorial is for Windows only.

So I've gotten this question a lot through PMs: "How do I get Jedi Academy source code to compile? Please help!"

My answer to you is simple: Use OpenJK. It's a lot smoother and MUCH less difficult to try and fix than using the base source code. But I suppose people are still having issues getting the source code to compile, so I'm going to outline in general how to compile OpenJK.

 

Here's what you'll need:

  • Microsoft Visual Studio C++ 2013 or later (Express edition is free)
  • CMake (cmake.org)
  • Git (optional)
  • A Github account (optional)

First let's determine whether or not you're going to need Git. If you plan on contributing back to the OpenJK project, or you plan on getting future updates from the project easily, then Git is the way to go. Make a new fork of it on Github (there is plenty of help on that site, I'm not going to go over how to make a fork), and then clone it using either the Github App, or SourceTree.

 

If you don't want to deal with Git, then that's understandable. There's a ZIP version of the source code available at the main repository location (http://github.com/JACoders/OpenJK). You won't be able to get updates very easily though.

 

Let's dive in, shall we?

 

Step 0 - Installing Software

Okay, okay, I trust that you know how to install some software, but I'm going to make a special note about CMake.

CMake has a setting which is disabled by default that needs to be turned on. Towards the end of installation, be on the lookout for a checkbox (change PATH setting), and make sure it's checked.

 

 

Step 1 - Generating Project Files

Visual Studio manages code projects in two groups - Solutions and Projects. Solutions (*.sln) generally contain a number of Projects (*.vcxproj) and each Project correlates to a specific aspect, such as cgamex86.dll or jamp.exe. In past versions of Visual Studio, Solutions were referred to as Workspaces (*.dsw), and Projects had different extensions (*.dsp, *.vcproj). But with newer versions of Visual Studio, the C++ standard was rapidly evolving, and so too must the software being used to produce it. Naturally, there are going to be some conflicts. Such conflicts resulted in the old Jedi Academy projects, which were programmed using Visual Studio 6 (or 2003), to be completely unable to be compiled by any newer compilers (such as Visual Studio 2005, 2008, 2010, 2012 or 2013). So, OpenJK fixes all of these issues and makes it run using more modern code, with more well-defined standards.

 

So as you might have guessed, we need to be opening up a .sln file. And as you might have noticed (or are now noticing), there isn't one. Why is this? Well, Visual Studio is specific to Windows, and OpenJK is meant to run on many different platforms, it would be quite a burden to update all of the platforms when something changes (such as a new file). Instead, we use CMake, which is a program that runs scripts to generate .sln files and .vcxproj files. We can invoke it by using CMake-GUI, which is packaged with CMake. Open that now.

 

We'll need to tell CMake what to do here. Hit "Browse Source Code", and navigate to your OpenJK folder where you've got the source code located. Next, hit "Browse Build". This is going to be the same as your OpenJK folder, but with a /build/ after it.

 

Next hit Configure. Hit "Yes" if you did not make a new folder for /build/, it will make one for you. Pick the generator that fits your Visual Studio version (for example, if you're using Visual Studio 2013, make sure to select Visual Studio 12)

 

Hit Finish. CMake will take a little while to do its thing and will display some stuff in its console that you shouldn't worry about. It'll display some text in red, but don't worry about it (unless it says that errors were reported!) You'll be presented with a screen where you may pick certain options.

Most of these options are self explanatory, but I will go over them briefly:

  • BuildJK2Support: Build with JK2 in mind? (experimental)
  • BuildMPCGame: Build cgamex86.dll?
  • BuildMPDed: Build dedicated server? (OpenJK equivalent of jampded.exe)
  • BuildMPEngine: Build engine? (OpenJK equivalent of jamp.exe)
  • BuildMPGame: Build jampgamex86.dll?
  • BuildMPRend2: Not available yet. Build rend2? (New renderer)
  • BuildMPUI: Build uix86.dll?
  • BuildPortableVersion: When selected, will turn off the functionality of fs_homepath. Good for those that want to install on a flash drive.
  • BuildSPEngine: Build SP engine? (OpenJK equivalent of jasp.exe)
  • BuildSPGame: Build jagamex86.dll? (Mod code for SP)

Select whichever of these you want. If you're building for SP, you'll probably only want BuildSPEngine if you're building a whole game, and you'll definitely want BuildSPGame. If you're building an MP mod, you'll probably want BuildMPGame, BuildMPUI and BuildMPCGame.

Once you get into debugging, BuildSPEngine and BuildMPEngine are valuable to enable as they assist with debugging.

 

At any rate, hit Configure again (to make sure that it configures with what you want) and hit Generate, and if all goes smoothly, it'll spout out "Generating Done". Close CMake and open Visual Studio.

 

Hit File->Open->Project/Solution (or Ctrl+Shift+O), and navigate to your /build/ folder. Open the OpenJK.sln which will be in this folder.

 

Now, to compile the code, all you need to do is go to Build->Build Solution up at the top.

 

If the compilation has succeeded, you will see something along the lines of "X succeeded, 0 failed, ....". If everything goes according to plan, you will now have some .exes and some .dlls to play with! They will be located in /build/Debug. Or, if you compiled in Release mode, they will be in /build/Release.

 

 

Getting Help with your Code Problems

So you wanna learn to code eh? Programming is an ongoing field of study. Once you begin to learn, you can never learn anything there truly is. I'd like to compare programming to magic here for a second. One cannot simply know everything there is about magic. Even the great sages of wizardry and magic have only a minute understanding of the deeper working of it...and like that, no one person knows everything there is to know about programming, especially not about C or C++. I encourage you to pick up a book or three continually poke and prod at the source code until you get something meaningful. Don't be discouraged! At the same time though, understand your limits and what you're working with. Nobody built Rome in a day, and nobody learned how to code C++ in a day either.

 

If you're really seeking the knowledge of code, you should definitely consult JACoders IRC. Naturally, we're a little worn thin as of late, but we're always looking to inspire more talented coders to pick up a copy of the code and learn from it.

 

Here's a good IRC client, and the credentials for the IRC room follow:

 

server: irc.arloria.net

channel: #JACoders

<no password>

 

Updated 7/26/14 with new details on compiling


User Feedback

Recommended Comments

There are no comments to display.



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...