Scripted Cams Without The Need For GTKRadiant

Discussion for Bani's Tournament Mod

Moderators: Forum moderators, developers

Post Reply
Titanium^Angel
Posts: 9
Joined: Wed Dec 22, 2004 10:10 am

Scripted Cams Without The Need For GTKRadiant

Post by Titanium^Angel »

It’s possible to create a spline camera within ET itself, without having to decompile the map then load the map file into gtkradiant, plot your course and fiddle with a 2D view etc. This means it’s easier to plot your course visually, and see exactly what path the camera will be travelling along. The drawbacks are the path can’t be tweaked once created, if there was a problem during the path creation and you want to change something, then you’ll have to create the whole path again. To make the path more accurate, you can slow down the speed of the camera using the b_demo_freecamspeed command, this can also help when creating complex, intricate paths. You also create your target path (the path the camera looks at when moving along it's own path) within the game the same way, so you have much more control of where the camera is looking. Using this method also means you can actually watch your demo while creating the path, so you know exactly where you need you camera to be going.

The way the path is created, is by using the viewpos command in game. Typing viewpos in console displays your current location on the map. What we do is set the viewpos command to constantly give a read out as you move along your path, then save the positions to a camera file. When that file is played back, it carries along the exact same co-ordinates you recorded. Since you create a separate target path for the camera to look at, it creates a much smoother movement compared to manual freecamming, and more or less the same result as creating it in GTKRadiant.

1st of all, record a demo on the map that you want to create your camera on. Leave it recording for a quite a long time, as the longer the demo takes to play back, the more time you have to create your path. We need to play this demo back so we can use the freecam option to record the path, so it's probably best just to stay in spectator mode when recording this demo.

To capture the path, what you 1st have to do is bind the viewpos command to a keyboard key (it has to be on the keyboard as it continiously gives a constant readout, bound to the mouse only gives a single readout). Example being bind x viewpos. Now play your blank demo and go into freecam mode (/freecam in console). Now in freecam mode, use your normal keys to move around the map. I’ve found using only the forward key and using the mouse to turn gives the smoothest path. Before you start capturing your path, we need to clear the console, so type /clear. Now start to move along your desired path then press and keep hold of your viewpos key the whole time. It doesn’t matter at this point what way your mouse looks when you do this, as we’ll create the target path later. Once you reach the end of you desired path, let go of your viewpos key. Now drop the console again, and type /condump camerapath.txt, and this will dump the console to a text file in the et pro folder. Once your path has been saved, /clear the console again and then record your target path. Do it in exact same way, but freecam along the path you want the camera to look at this time. Once done, in console type /condump targetpath.tx and it’ll save to the same place. You can now quit ET.

Now we have both the path files saved, we have to prepare them for putting into the camera file. Open each one in Word, and scroll down the list removing any stray console text that may be in there like punkbuster auth text, kill text etc, so there’s nothing in between the viewpos locations. Once this is done we have to add 3 tab spaces to each viewpos location. Easiest way to do this is click your mouse at the start of the very 1st viewpos eg here -> (123 544 -123 : -123, and press tab 3 times, this will create a large gap from the left side of the page, now select those gaps and the 1st ( and copy them to clipboard. Next click on edit> replace.. set it to replace ( with the 3 gaps and ( saved on your clip board and then hit replace all. Do this to both path files and save them again. Now wordpad open the supplied template.camera file you can find here. In there you will see it’s split into 2 sections, the top section is for the camera path, the bottom section is for the target path (I’ve marked these out in the template). Where it says (camera path here), copy and paste your camerapath viewpoints into there, do the same below that with the target path.

Now that you have both your camera and target routes set within the camera file, we need to set the speed at which you want you camera to move. At the very top of the camera script you’ll see a section that says time 10.000000 and 2 below that, and her that says time 10000. The top time controls the target path speed in seconds. So a setting of 10 means it will take 10 seconds to move from start to finish. The shorter the time, the faster it will move. The time 10000 controls the speed the camera moves in very much the same way, using the formula 1000 = 1sec. So a setting of 10000 means it will take 10secs for the camera to go from start to finish. Something to watch out fore is your target time cannot be lower than your camera time. If your target reaches the end of it’s path before the camera does, it’ll will end the script prematurely. SO make sure your target time is either equal to or greater to your camera path time. Once that’s been set, your camera is finished.

In the usual manner, to play your camera back, create a folder in your etpro folder called cameras, and place your camera file in there. You don’t have to be playing a demo to test your camera file. Do /sv_pure 0 in console then /devmap mapname (name of the map the camera is for). Once the game has loaded, exec your camera by either typing into console /camera cameraname, or binding it to a key e.g. bind x camera cameraname.

For making quite large cams, we have the wonderfull ET Comm tool by Spoofeh. Place the exe in your etpro folder then load ET. Set up everything as normal to start creating your path, but this time run the ET_comm.exe tool before start capturing your viewpos positions. What this tool does is log the full console until you stop the game or the tool.. therefore you can make your camera as long as you want. Once you've capped your path, close the tool and you'll have a file called consolelog.txt in your etpro folder with your full path.

You can view an example camera i made for railgun here
You can also view a small video i made of it in action, showing just how precise you can make the camera movements. Download here - 6mb (right click> save as..) (xvid)

Once you get the hang of it, you should be able to whip together a scripted cam in 10mins total.


Drawbacks

You can’t use this method with the timescale command, using timescale at the same time as viewpos doesn’t capture the proper viewpos

coordinates, so it has to be done in real time.. hence using b_demo_freecamspeed to slow down the pace when capturing your path.

As mentioned before, if you mess up the path, then you have to create it from scratch.

It may not work with really long camera paths as the console only displays a certain amount of lines of text.

If you record your path while playing a game demo, your console is going to fill with kill text (e.g. whathisface killed youknowhow with a panzerfaust) which will all have to be removed. This will also fill console space so place remember to /clear the console before recording your path.

All this took a very long time, so if you post the tute somewhere.. please include my name :) My name is DarkangelUK, but i registered on here in that name with a free hotmail account so my account was removed, can an admin please rename me to DarkangelUK? thanks

You can contact me on darkangeluk@gmail.com or #shaolinproductions on Quakenet
User avatar
Nail
Posts: 425
Joined: Fri Jan 02, 2004 3:47 pm
Contact:

Post by Nail »

I posted a link from your SD post in our movies section as an annoucement, feel free to post full tut in same section
Improvise, Adapt, Overcome
User avatar
ReyalP
Posts: 1663
Joined: Fri Jul 25, 2003 11:44 am

Post by ReyalP »

send lawyers, guns and money
Post Reply