Jedi Knight Revisited

Written by Jeff Walters

WARNING - This article contains numerous large graphics needed to complement the text, so be patient while it loads...

What is Jedi Knight Revisited?

This a level conversion project undertaken by myself and Mike Rajotte. We just loved playing the original multiplayer missions, but you can only play them so much. So we decided to convert all the single player JK levels we thought would make great multiplayer arenas. To see more on this project or download the levels, just click here to go to the official Jedi Knight Revisited website.

What is the aim of this article?

Basically the aim is to let everyone know what we have learnt so they too can make their own multiplayer levels. It's not as hard as it may seem, but it does require some thinking and persistence. This tutorial will start out slow so you can get a handle on the important early stages. Neither me or Mike believe in hogging any discoveries we make, so all the important things we have learned about editing Jedi Knight, you can find below. If you would like to join the Jedi Knight Revisited team and help convert the single player levels, then feel free to contact us. But make sure you've read the article below and understand it.

How Do I Get Started?

Dir Tree
Ok, First thing you're gonna need is two programs - ConMan and JKGOB. Both of these can be found at the JED homepage. Before you can begin work converting a level to Single player, you'll have to extract all the necessary files for the level from jk1.gob. But before this, you need to create a few directories. What I did was to create a directory called temp in the root JK directory. You will also need to create three subdirectories of Temp, namely - jkl, cog and misc. As shown in the graphic to the right.

Now, load up ConMan and click 'open container' from the file menu. Then go to your episodes directory and double-click on jk1.gob. First file you are going to need is episodes.jk. Extract it into your temp directory. Next, double-click on the cog directory within jk1.gob. You'll then see a whole list of cog files most starting with two numbers. As you no doubt have guessed - these indicate which level the cog file is used in. You'll need to extrtact all the cog files relevant to the level you want to convert. So if you were converting Level 4 - you'd extract all the cog files starting with 04. This numbering system is not consistent throughout though as both levels 5 & 6 have 06 at the start of their cog files. Another example of the inconsistent naming is for level 13, which has it's cog files start with '14' and not '13'. So you should double-check the cog files that you extract to make sure you're right by investigating the description at the beginning of each cog file......from the description you should be able to determine which level they are used in.

Anyway, next. Double click on the jkl directory within jk1.gob. You'll see a bunch of levels following the same style of numbering system as the cog files. Take the same kind of precautions to make sure you get the right jkl file. Once you've found the file for the level you're after, extract into the temp/jkl directory. There is only one file (cogstrings.uni) in the misc folder in jk1.gob and you will need it. So, extract it into temp/misc.

Right...now that you've got all the relevant files - you're ready to edit!

Episode.jk

The first step in the editing process is to change the information in episodes.jk and cogstrings.uni. We'll do episodes.jk first. When you open it up in an editor it should look like the picture below. It's fairly easy to work out what is what and I've just labeled those areas of importance for this tutorial. The most important thing in this file is TYPE. This tells the game whether the gob contains single player(TYPE 1), multiplayer(TYPE 2) or Capture The Flag(TYPE 8) levels. So - the first modification will be to change the 1 next to TYPE to a 2.

At the the top of the file is the name of the episode. This is what will appear on the episode selection screen for multiplayer. You should remember that this is the EPISODE name, not the level name. So, if you release a gob containing three levels and want the whole pack to be called "The Dark Jedi Trilogy" - this is where you enter the name. The actual level names are defined in cogstrings.uni. Taking you through every aspect in this file and how to change it would not feasible, so instead below is a copy of episode.jk if you wanted to convert Levels 3 & 4 to multiplayer and call the episode "Dark Homecoming".

Take a look and compare it to the original above - you should get the idea now.

Cogstrings.uni

Next, we'll use the same 'Dark Homecoming' example for cogstrings.uni. Below is a pic of the original cogstrings.uni. All you really have to do here is to cut out all the redundant data for the levels you are not converting (only 3 & 4) in this example. So the only info you'll need in this file is those lines referring to the levels you wish to have in your gob. Don't worry - each levels data is signposted with headers.

A quick word on cogstrings.uni. You seem to only need to update the MSGS number at the top if the number of messages in the file EXCEEDS the number next to MSGS. If you MSGS set at 10 when there is only 2 in the file - it doesn't have any effect. None I'm aware of anyway.

Well....you now know how to set up the files so the game will recognise your soon-to-be gob file correctly. Infact - with what you've done so far you could actually test the game in MP! But to have a complete level that won't crash when you enter the end sector or has enough weapons and power-ups - you'll have to edit the most important file of all!! The JKL.

The JKL File

Just open the .jkl file of the level you want to convert into a text editor (I use and recommend WordPad). First thing to do is to get rid of the pointers to the cog file that controls the ending. Scroll down the JKL file until you come across a table labelled 'COG Placements'(see pic to right). This list assigns COG files to sectors, objects, enemies, etc. What you have to find here is search this list for the end of level COG file. It should stick out like a sore thumb (ie. named 03_endlevel.cog or 14_endit.cog). Once you track it down, your job is clear - delete the line related to that cog file! Once you've done this you will have to update the numbers assigned to the cog files below the one you deleted to take into account the removal. There....done. What you've just done is prevent the level from ending should a player enter the end sector. For example, in level 3 - Return to Sulon - the level automatically ends once you enter WeeGees workshop, by removing the endlevel cog file from the cog placement list, you will now be able to enter the workshop and the game won't crash.

This is essentially the only modification you will NEED to do to the cog placement list, but you may WANT to make some more depending on the level you are converting. What am I talking about? Well, some levels are just to damn big to be converted directly to MP without placing some restrictions on the playing area. So, you may need to remove specific entries in cog placment list to do these restrictions. For example, Level 13 (Lost Planet of the Jedi) is really too big to for most MP games....it would take a long time to find each other. So, what I did was to take out the items on the cog placement list that control the disabling of the forcefield early in the level. By doing this, no matter what you do - the forcefield will stay up and limit the players to the area before it. There is, however one other thing you will have to do to complete the playing area limitations and that is to make sure there are no start-points beyond the forcefield.

Before I can tell you how to do this, I'll have to introduce you to the 'Thing Placement' list. This is the final section you will find in the jkl file and one of the most important. It is the list that tells the engine where all the objects, enemies, etc are located in the game (X, Y, Z co-ords and sector location, etc) and any special flags used by an object. Now that you know what the 'Thing Placement' list is, we can get back to making sure there are no start-points beyond the forcefield.

Start-points are defined in the 'Thing Placement' list as - walkplayer. Because it's hard to tell where a walkplayer is in the game just by looking at the X, Y, Z co-ords, what you should really do if you have to limit the playing area is replace all the existing walkplayers with your own walkplayers in locations you want them to be. How do I do this? First, you'll need to load up JK and play the original (pre-conversion) single player level. When in the level, simply find the spots where you would like to put start points and use the 'coords' cheat code to find out the X, Y, Z co-ordinates of that spot. Mark these down on a scrap of paper. Once you feel you've got enough start-points - exit back out to Windows and once again load up the JKL file. Now simply replace the xo-ords for the existing 'walkplayers' with the co-ordinates you've jotted down! Simple!

One final word about walkplayers......you must make sure you have enough in the level for MP. For instance - if you only have three walkplayers in the game - only three people will be able to play MP. Four walkplayers? Four people. So I suggest that you make sure any level you convert to MP has at least 8 walkplayers for it to be an effective MP level (most of the original MP levels have around 16).

From what you learnt in the section on walkplayers - you should have a fair idea about adding weapons and powerups. All you have to do is find the name and template of the required object, and copy it over an existing object you don't want in the game (I always replace enemies as they automatically don't show up in MP). Tracking down an item is pretty easy cause the template names are a give away. For instance the template - railgun is....you guessed it - the Rail Detonator. The concrifle template is....you get the idea.

On the otherhand, adding weapons, enemies, etc, can be a little more complicated if the desired object was not originally in the level in single player. This is because it's 3do and cog file and template info will not have been listed in the respective tables in the JKL file. Some objects like enemies may also require that you define the key, snd or wav files used by the object. I first noticed this when I tried to add sequencer charge packs to Baron's Hed. They simply wouldn't appear. Once I worked out the problem, it wasn't so bad. In the case of adding the seq charges, all I had to do was add pow_sequencer.cog to the Cog Scripts section, seqp.3do to the Models section and replace the template info for something not required in the level (an enemy for example) with the info for a sequencer charge pack. How, you might ask, did I find out what I had to add? Basically what I did was opened up the JKL file of a level I KNEW had sequencer charges in it and then tracked down it's information in the templates section (once I found the name 'seqcharge' I knew I'd hit jackpot). You must remember to check what is written next to the template name. Why? Because the name 'seqcharge' could have pointed to a charge already laid, not a power-up. So just by looking next to the name you can make sure. In that case, I was relieved to see '_powerup' :)

Sequencer Charges entry in the Templates list...

As said above, adding objects not in the SP version is trickier, but at least now you have an idea of where you'll have to start. Now....hmmm...what's left? Ah, well.....I guess a lot of people may wondering how we added the AT-ST's, civilians and stormtroopers back into the levels? I will explain this, but before I do - I think you should read the next section

CO-OP IMPOSSIBLE!!

Yes, I know a lot of readers are looking at that heading and saying,"Come on, it's got to be possible!". Trust me, I really hate to be the one to announce this discovery, but I'm afraid it's the truth :( Mike Rajotte and I have tried numerous variations of generating enemies, even toyed with some AI to see what that does, but nothing. The problem? The actions of enemies, civilians, etc, are controlled by AI. And each computer in a multiplayer game generates different random AI actions for the enemies. So, on your screen you might see a stormtrooper running off to the west, while one of your MP opponents might seem him move off in a different direction. The AT-ST's in the Tower MP level seem to work to some degree because they are relatively immobile. So where you see an AT-ST standing is likely where others are seeing it too.

Don't blame Lucas Arts though. If you think about it, they likely would have had to downgrade the Sith engine in order for it to be feasible. I mean, I'm sure most of you have suffered the severe lag that can eventuate if you have six or more players in a game.....can you imagine tha lag if you had just two or three players PLUS dozens of enemies whose actions had to be controlled via the AI of the host computer?? There wouldn't be enough bandwidth in the world for that!

I don't even think any special patch from L.A. could add a proper Co-op feature. So, even though it pains me to say it - Jedi Knight will never feature proper Co-op play :(

Generators at Work

With that 'rosy' news out of the way, you may be thinking "Well damn, guess it doesn't matter how to put enemies back in if it doesn't work properly!". You are probably right, but the information may help JK editors to better understand some aspects of the JKL, so I'll tell you what I know.

Firstly, the key to regeneration revolves around a cog file called - 00_GENERATOR.COG. So if you want to try regenerating an object, you'll have to add it to the Cog Scripts list. To make an object regen you'll have to do two things. First is to add something called a 'ghost' to the things list. The example I shall use for this process is that of adding a male civilian to Baron's Hed.

Step 1 was to scroll down the 'Things' table until I found a male civilian object. An object called 'man1' to be precise. Right, now that the object I want to regen has been chosen, the next step is to replace 'man1' with 'ghost'. A 'ghost' is basically just that - a ghost. By calling an object a 'ghost' nothing will appear in the game, BUT it does become a potential regen point for objects.

Anyway, back to editing. Next note down the number of the modified object - in this case, 124. Stage Two in the regen process is to add a copy of 00_GENERATOR.COG to the Cog Placement table. Carefully examine the picture below of the new entry in the Cog Placement list.

It's really self-explanitory isn't it? 00_GENERATOR.COG actually has default settings set within the Cog file for all those numerical columns after 'man1'. So in fact you likely don't need to enter these values unless you intend to use values different to the default ones (I haven't tested this, but it seems logical).

Well, that's it for regeneration! One quick caution though, there seems to be a limit on the number of generators you can have in the Cog Placement list. Once I passed 20 of them, I started to experience some curious errors such as being unable to open doors or pick up certain weapons. After I reduced the number of generators by 1 or 2, the problems ceased. I tried getting around this by reducing the number of generators, but increasing the 'max alive' value for each generator to 2 or more. No dice, more problems and 1 or 2 crashes as well. There was also the problem of civilians in Baron's Hed regenerating INTO the first generated civilian. This looked very strange indeed with citizens looking like they had four arms, etc :) 00_GENERATOR.COG is not the only generator cog file used in the game, but it is the main one.

Testing Your New Level

First, you'll have to compile the gob using JKGOB. Just load it up and click on New Gob, then double click on the Temp directory. Then you'll just have to name the gob and put in your episodes directory. Then load up JK, host an IPX MP Game (lets you test MP levels without being online providing you have the right drivers installed) and then select your new episode from the MP Episode selection screen :)

Editing AI

Recently, when I was improving the converted MP Baron's Hed level, I began investigating how to edit AI. Why I wanted to do this was that I was sick of the ctiizens in Barons just standing there and not roaming the streets - so I set about making them mobile. First of all let me say to those who don't know, you can find all the AI files used in JK in res2.gob located in your 'resource' directory. Finding the AI used by citizens (peddefault.ai) was fairly easy and each AI file starts with a short description of what uses it. Next I had to find the AI file for an enemy who does not stand still, but walks patrol. I found just what I was looking for in stroam.ai (the AI for patrolling Stormtroopers). Each AI file contains a list of 'instincts', which basically define the actions the character is capable of. So what I had to do was find the 'instinct' in stroam.ai that tells stormtroopers to patrol......and then paste it into peddefault.ai. As you can see in the pic of the 'instincts' list of stroam.ai below - it wasn't that hard to find.

To use any new modified AI file you edit in a level, all you have to do is to create a directory called 'ai' in the temp\misc directory and stick the modified AI file in it. Then compile the level in JKGOB and run JK as per usual. That's all. This worked perfectly with the citizens of Baron's as they then started to wander the streets......but unfortunately I had to cut this feature from the new MP Baron's Hed because like the problem with enemies mentioned above, the movement of the citizens was different on every PC in a multiplayer game :( Still, knowing how to edit AI files will come in very handy when the level editors come out and you begin the task of creating all new SP levels........

That's it!....basically

We have learnt a few other things, but all the important parts are mentioned here (and the article is long enough as is :). You can really do anything you set your mind to with the JKL file, it may just take some time and patience. Anyway, good luck with your editing and I can't wait to see any new conversions! :)


Back to D A R K N E S S   F A L L S