PDA

View Full Version : [Tutorial] Third Person Game with GOW camera



Psilocybe
04-30-2010, 12:52 PM
MAIN TUTORIAL

Hey there, I thought I'd post a tutorial on creating a third person game, the scripting involved and such. I know I would've liked something like this when I started scripting so hopefully it'll be useful to you! Please feel free to comment/critique/tear this apart below.

So first off, this tutorial is assuming that you're a beginner who wants to create a third person game independent of UT with your own custom scripts, so I'll briefly go over a little bit of everything: setting up a new game, scripting, and other stuff like that. If you already know something, just skip over it.

Setting up a new game:

Create a folder "YourGame" (or whatever you'd like to call your game) inside ..[UDK-yyyy-mm]/development/src (yyyy-mm is just the date of the release you have).
Inside of that, create a folder called "Classes."
Inside of Classes, create four .uc files: YourGameInfo.uc, YourGamePawn.uc, YourGameCamera.uc, and YourGamePlayerController.uc.

If you don't fancy these names, they're just to help you remember what they do and you can change them to whatever you like, it's the stuff inside that counts.

Scripting:

YourGameInfo.uc is the script that basically tells the UDK the basics about your game: what Player Controller to use, what pawn to use etc. Open up YourGameInfo.uc and insert the following code:

class YourGameInfo extends GameInfo; //This line tells UDK that you want to inherit all of the functionality of GameInfo.uc, and add your own. The name after "class" must match the file name.
DefaultProperties //Self explanatory
{
bDelayedStart=false
PlayerControllerClass = class 'YourGame.YourGamePlayerController' //Setting the Player Controller to your custom script
DefaultPawnClass = class 'YourGame.YourGamePawn' //Setting the Pawn to your custom script
}


That's it for the Game Info script. Next we'll create the pawn. Unfortunately, this tutorial isn't entirely free of UT assets, as we'll be using a character mesh and animset from UT for lack of anything else. You can easily replace these with your own, though, if you get around to creating your own character and animations. The pawn is basically your character. It sets what your character looks like, how it collides with objects, how it's lit, and how it animates.

Go ahead and paste the following code into YourGamePawn.uc

class YourGamePawn extends GamePawn; //Again, naming conventions apply here. Your script is extending the UDK script

DefaultProperties
{
Components.Remove(Sprite)
//Setting up the light environment
Begin Object Class=DynamicLightEnvironmentComponent Name=MyLightEnvironment
ModShadowFadeoutTime=0.25
MinTimeBetweenFullUpdates=0.2
AmbientGlow=(R=.01,G=.01,B=.01,A=1)
AmbientShadowColor=(R=0.15,G=0.15,B=0.15)
LightShadowMode=LightShadow_ModulateBetter
ShadowFilterQuality=SFQ_High
bSynthesizeSHLight=TRUE
End Object
Components.Add(MyLightEnvironment)
//Setting up the mesh and animset components

Begin Object Class=SkeletalMeshComponent Name=InitialSkeletalMesh
CastShadow=true
bCastDynamicShadow=true
bOwnerNoSee=false
LightEnvironment=MyLightEnvironment;
BlockRigidBody=true;
CollideActors=true;
BlockZeroExtent=true;
//What to change if you'd like to use your own meshes and animations
PhysicsAsset=PhysicsAsset'CH_AnimCorrupt.Mesh.SK_C H_Corrupt_Male_Physics'
AnimSets(0)=AnimSet'CH_AnimHuman.Anims.K_AnimHuman _AimOffset'
AnimSets(1)=AnimSet'CH_AnimHuman.Anims.K_AnimHuman _BaseMale'
AnimTreeTemplate=AnimTree'CH_AnimHuman_Tree.AT_CH_ Human'
SkeletalMesh=SkeletalMesh'CH_LIAM_Cathode.Mesh.SK_ CH_LIAM_Cathode'
End Object
//Setting up a proper collision cylinder
Mesh=InitialSkeletalMesh;
Components.Add(InitialSkeletalMesh);
CollisionType=COLLIDE_BlockAll
Begin Object Name=CollisionCylinder
CollisionRadius=+0023.000000
CollisionHeight=+0050.000000
End Object
CylinderComponent=CollisionCylinder
}

//This lets the pawn tell the PlayerController what Camera Style to set the camera in initially (more on this later).
simulated function name GetDefaultCameraMode(PlayerController RequestedBy)
{
return 'ThirdPerson';
}

Most of these various values are pretty self explanatory, and you can either Google them, post here, or fiddle about with them if you can't figure out what they do.

Now we'll continue to the custom Player Controller. (Getting into the tasty stuff!) I've commented the code below to provide an explanation of everything that's going on.


class YourGamePlayerController extends GamePlayerController;

DefaultProperties
{
CameraClass = class 'YourGameCamera' //Telling the player controller to use your custom camera script
DefaultFOV=90.f //Telling the player controller what the default field of view (FOV) should be
}

simulated event PostBeginPlay() //This event is triggered when play begins
{
super.PostBeginPlay();
`Log("I am alive!"); //This sends the message "I am alive!" to thelog (to see the log, you need to run UDK with the -log switch)
}
//Functions for zooming in and out
exec function NextWeapon() /*The "exec" command tells UDK to ignore what the defined function of NextWeapon is, and use our function declaration here.
We'll go over how to change the function of keys later (if, for instance, you didn't want you use the scroll wheel, but page up and down for zooming instead.)*/
{
if (PlayerCamera.FreeCamDistance < 512) //Checks that the the value FreeCamDistance, which tells the camera how far to offset from the view target, isn't further than we want the camera to go. Change this to your liking.
{
`Log("MouseScrollDown"); //Another log message to tell us what's happening in the code
PlayerCamera.FreeCamDistance += 64*(PlayerCamera.FreeCamDistance/256); /*This portion increases the camera distance.
By taking a base zoom increment (64) and multiplying it by the current distance (d) over 256, we decrease the zoom increment for when the camera is close,
(d < 256), and increase it for when it's far away (d > 256).
Just a little feature to make the zoom feel better. You can tweak the values or take out the scaling altogether and just use the base zoom increment if you like */
}
}
exec function PrevWeapon()
{
if (PlayerCamera.FreeCamDistance > 64) //Checking if the distance is at our minimum distance
{
`Log("MouseScrollUp");
PlayerCamera.FreeCamDistance -= 64*(PlayerCamera.FreeCamDistance/256); //Once again scaling the zoom for distance
}
}


Now that we have the Player Controller worked out, we can move on to what most people are here for: the camera.

This camera script incorporates zoom interpolation (smoothing) as well as a third person orbiting viewpoint. I'll lay this section out in three parts (each section should follow right after each other in the YouGameCamera.uc script.)

First, we need to initialize the class instance and declare our variables:

class YourGameCamera extends Camera;

// initializing static variables
var float Dist;

DefaultProperties
{
FreeCamDistance = 256.f //
}


function UpdateViewTarget(out TViewTarget OutVT, float DeltaTime)
{
//Declaring local variables
local vector Loc, Pos, HitLocation, HitNormal;
local rotator Rot;
local Actor HitActor;
local CameraActor CamActor;
local bool bDoNotApplyModifiers;
local TPOV OrigPOV;

A couple of things here. First of all, I've declared a variable outside of the function here in order to keep it static so that it doesn't re initialize each program loop. This just means my value will only change when I specifically tell it to. This sort of variable needs to be declared with the syntax, var variable_type variable_name; Second, I've set my FreeCamDistance to a default value so it doesn't start at some random value it grabbed out of memory.

After this, we'll set up our view target and various settings to let our pawn override the camera style if need be.

// store previous POV, in case we need it later
OrigPOV = OutVT.POV;

// Default FOV on viewtarget
OutVT.POV.FOV = DefaultFOV;

// Viewing through a camera actor.
CamActor = CameraActor(OutVT.Target);
if( CamActor != None )
{
CamActor.GetCameraView(DeltaTime, OutVT.POV);

// Grab aspect ratio from the CameraActor.
bConstrainAspectRatio = bConstrainAspectRatio || CamActor.bConstrainAspectRatio;
OutVT.AspectRatio = CamActor.AspectRatio;

// See if the CameraActor wants to override the PostProcess settings used.
CamOverridePostProcessAlpha = CamActor.CamOverridePostProcessAlpha;
CamPostProcessSettings = CamActor.CamOverridePostProcess;
}
else
{
// Give Pawn Viewtarget a chance to dictate the camera position.
// If Pawn doesn't override the camera view, then we proceed with our own defaults
if( Pawn(OutVT.Target) == None ||
!Pawn(OutVT.Target).CalcCamera(DeltaTime, OutVT.POV.Location, OutVT.POV.Rotation, OutVT.POV.FOV) )
{
// don't apply modifiers when using these debug camera modes.
bDoNotApplyModifiers = TRUE;

This is just pretty much taken from the camera.uc script, so there are a couple of things in there that are probably a bit unnecessary for what we're doing, but I've left them in there anyway.

Next, we'll implement our actual camera styles. We're using a switch-case method here. Basically, the compiler enters the code where it finds a match to the CameraStyle, and exits if it hits a "break." Remember, our default state is ThirdPerson.



switch(CameraStyle)
{
case 'Fixed' : // No update, keeps previous view
OutVT.POV = OrigPOV;
break;

case 'ThirdPerson' : //Enters here as long as CameraStyle is still set to ThirdPerson
case 'FreeCam' :

Loc = OutVT.Target.Location; // Setting the camera location and rotation to the viewtarget's
Rot = OutVT.Target.Rotation;

if (CameraStyle == 'ThirdPerson')
{
Rot = PCOwner.Rotation; //setting the rotation of the camera to the rotation of the pawn
}

//OutVT.Target.GetActorEyesViewPoint(Loc, Rot);

if(CameraStyle == 'FreeCam')
{
Rot = PCOwner.Rotation;
}

Loc += FreeCamOffset >> Rot;
//Linear interpolation algorithm. This is the "smoothing," so the camera doesn't jump between zoom levels
if (Dist != FreeCamDistance)
{
Dist = Lerp(Dist,FreeCamDistance,0.15); //Increment Dist towards FreeCamDistance, which is where you want your camera to be. Increments a percentage of the distance between them according to the third term, in this case, 0.15 or 15%
}

Pos = Loc - Vector(Rot) * Dist; /*Instead of using FreeCamDistance here, which would cause the camera to jump by the entire increment, we use Dist, which increments in small steps to the desired value of FreeCamDistance using the Lerp function above*/
// @fixme, respect BlockingVolume.bBlockCamera=false

//This determines if the camera will pass through a mesh by tracing a path to the view target.
HitActor = Trace(HitLocation, HitNormal, Pos, Loc, FALSE, vect(12,12,12));
//This is where the location and rotation of the camera are actually set
OutVT.POV.Location = (HitActor == None) ? Pos : HitLocation;
OutVT.POV.Rotation = Rot;

break; //This is where our code leaves the switch-case statement, preventing it from executing the commands intended for the FirstPerson case.

case 'FirstPerson' : // Simple first person, view through viewtarget's 'eyes'
default : OutVT.Target.GetActorEyesViewPoint(OutVT.POV.Locat ion, OutVT.POV.Rotation);
break;

}
}
}

if( !bDoNotApplyModifiers )
{
// Apply camera modifiers at the end (view shakes for example)

ApplyCameraModifiers(DeltaTime, OutVT.POV);
}
//`log( WorldInfo.TimeSeconds @ GetFuncName() @ OutVT.Target @ OutVT.POV.Location @ OutVT.POV.Rotation @ OutVT.POV.FOV );
}


Now that our scripting is finished, all that's left is to tell UDK to use our custom game type.

Note: Please back up your config files before editing them. You'll probably be sorry if you don't.

You'll need to go in to UDKGame\config and edit DefaultEngine.ini, and DefaultGameUDK.ini (make sure to turn of read-only on these files. In DefaultEngine.ini you'll need to edit:


Lines 6, 7 and 8,
Map=UTFrontEnd.udk
LocalMap=UTFrontEnd.udk
TransitionMap=EnvyEntry.udk
Change the value of the first two entries to the map you'd like to start on,
and if you like, change the third entry to your own custom loading screen map.

Add: +EditPackages=YourGame under [UnrealEd.EditorEngine] on line 15


In DefaultGameUDK.ini you'll need to edit:


Lines 5, 6 and 7,
DefaultGame=UTGame.UTDeathmatch
DefaultServerGame=UTGame.UTDeathmatch
PlayerControllerClassName=UTGame.UTPlayerControlle r
Change the first two entries to YourGame.YourGameInfo, and the third entry to YourGame.YourGamePlayerController.


Now for a couple of notes: First off, please note that this ini editing is quite basic and does not change any behavior related to how UDK builds packages, or includes packages when you "make" the game from the front end. For more advanced ini editing please check out tutorials such as The Ball for more information. Second, for your custom maps and content you'll need to create a folder "YourGame" under UDKGame\Content.

Now you're almost all finished. The last step is to open the UDK Launcher and click "make." Voila, your game should be playable in editor and from the launcher now!

SHOULDER CAMERA TUTORIAL EXTENSION

Warning: Over-the-shoulder camera section may contain mathematics

Alright, to get an over-the-shoulder camera working, we need to make a few changes to the above scripts. YourGameInfo and YourGamePawn both stay the same, so we'll be concentrating the changes in the player controller and especially the camera script.

Step one: Custom keybinding

First, we need to bind a key to switch camera views. For this, I use the left shift key. I have it activate the camera on a press, return to third person on release. Go into UDKGame\Config, and add the following to UDKInput.ini:


Line 29 add:
Bindings=(Name="LeftShift",Command="ShoulderCam | OnRelease ReturnCam")

This tells the UDK that we want left shift to call a command (which we'll define in our player controller script) called ShoulderCam when the button is pressed, and ReturnCam when it is released.

Step two: PlayerController

We're going to make the following edits to YourGamePlayerController.uc:

First we need to declare an additional variable. This should go directly under the class declaration.


var float PreDist;

This variable will store our previous camera distance so that when we switch back to the normal camera, we'll be at our original setting.

The next lines of code should be tacked directly on the end of the player controller script:



exec function ShoulderCam() // Declaring our ShoulderCam function that we bound to
{
`Log("Shoulder Camera"); // Yet another log...
PreDist = PlayerCamera.FreeCamDistance; //Storing our previous camera distance...
YourGameCamera(PlayerCamera).CameraStyle = 'ShoulderCam'; //Type casting our camera script to access the variable CameraStyle
}

exec function ReturnCam() //This is called on release of left shift
{
`Log("Main Camera");
PlayerCamera.FreeCamDistance = PreDist; // Restoring the previous camera distance
YourGameCamera(PlayerCamera).CameraStyle = 'ThirdPerson'; // Restoring the previous camera style
}


That's all we need in YourGamePlayerController. Now we move on to the fun part: Camera implementation.

Step three: Camera Scripting

There are numerous small edits to make in YourGameCamera, so I'll post a completed script at the end.

Declaring variables

We're going to need 6 new static variables in our camera script. These should be declared as follows beneath our declaration of Dist



var float TargetFOV; //Lerp target for field of view
var float Z; //Current Z axis offset
var float TargetZ; //Lerp target for Z offset
var float Offset; //Current amount of XY offset
var float TargetOffset; //Lerp target for XY offset
var float pival; // pi


Under defaultproperties make the following addition:



pival = 3.14159; //The aprox. value of pi


Now we move down to our switch/case structure. We're going to need to add another case for our shoulder camera. Add the following under "case 'FreeCam' :"



case 'ShoulderCam' : //Our shoulder camera case


Now, with the addition of those new variables, we're going to have to declare what they should be for each of our cameras. Modify the if statement "if (CameraStyle == 'ThirdPerson')" to read:



if (CameraStyle == 'ThirdPerson')
{
Rot = PCOwner.Rotation; //setting the rotation of the camera to the rotation of the pawn
TargetZ = 0; //We don't want any z axis offset
TargetFOV = 90; //We want to have our field of view set to the default 90 degrees
TargetOffset = 0; // No xy offset either
}


No we add an if statement for our new camera style under the prior if statement:



if (CameraStyle == 'ShoulderCam')
{
Rot = PCOwner.Rotation; //We still want to use the rotation of the character as our camera rotation
FreeCamDistance = 64; //We'll go in for a close up
TargetFOV = 60.f; //And we'll have a nice zoom effect for aiming
TargetZ = 32; //We'll pop the camera up above the head...
TargetOffset = 32; //And pop it out over the shoulder
}


Now we need to add in the effect of the z offset on our camera location. Add the following line of code after "Loc += FreeCamOffset >> Rot;"



Loc.Z += Z; // Setting the Z coordinate offset for shoulder view


Now we'll make sure nothing "jumps," and everything is silky smooth. We'll add three more lerps--one for each of our variables that get changed with the camera style. Under the lines:

if (Dist != FreeCamDistance)
{
Dist = Lerp(Dist,FreeCamDistance,0.15);
}


Enter the additional lines:



if (Z != TargetZ) //Lerping z offset
{
Z = Lerp(Z,TargetZ,0.1);
}
if (DefaultFOV != TargetFOV) //Lerping FOV
{
DefaultFOV = Lerp(DefaultFOV,TargetFOV,0.1);
}
if (Offset != TargetOffset) //Lerping xy offset
{
Offset = Lerp(Offset,TargetOffset,0.1);
}


Now, this next part is where our math comes in. We can't just tell the UDK to offset our camera on the x and y axes, since then, when our character turned around, our offsets would still be in the same direction, and it would be the exact opposite of what we want for that rotation.

The problem lies in the fact that we're working in world coordinates, so any offset we make will be in global, rather than local, character coordinates.

We solve this by mapping our character offset from character coordinates to world coordinates using a little trigonometry.

Add the following two lines of code under "Pos = Loc - Vector(Rot) * Dist;" (this should be directly under our lerp code)



Pos.X += Offset*sin(-Rot.Yaw*pival*2/65536);
Pos.Y += Offset*cos(Rot.Yaw*pival*2/65536);


Those two lines tell the UDK to offset the camera in a direction off of the pawn rather than in a global direction. The numbers after Rot.Yaw convert from UnrealUnits to radians. If you're familiar with trigonometry and vectors, you probably won't find this too complicated. If you're not familiar with that stuff, don't worry about it, just use it as is and learn it later.

That takes care of all the changes we need in the YourGameCamera.uc Here's the completed script to give you an idea of what it looks like all put together:


class YourGameCamera extends Camera;

// initializing static variables
var float Dist;
var float TargetFOV;
var float TargetZ;
var float Z;
var float TargetOffset;
var float Offset;
var float pival;

DefaultProperties
{
FreeCamDistance = 256.f
pival = 3.14159;
}


function UpdateViewTarget(out TViewTarget OutVT, float DeltaTime)
{
//Declaring local variables
local vector Loc, Pos, HitLocation, HitNormal;
local rotator Rot;
local Actor HitActor;
local CameraActor CamActor;
local bool bDoNotApplyModifiers;
local TPOV OrigPOV;

// store previous POV, in case we need it later
OrigPOV = OutVT.POV;

// Default FOV on viewtarget
OutVT.POV.FOV = DefaultFOV;

// Viewing through a camera actor.
CamActor = CameraActor(OutVT.Target);
if( CamActor != None )
{
CamActor.GetCameraView(DeltaTime, OutVT.POV);

// Grab aspect ratio from the CameraActor.
bConstrainAspectRatio = bConstrainAspectRatio || CamActor.bConstrainAspectRatio;
OutVT.AspectRatio = CamActor.AspectRatio;

// See if the CameraActor wants to override the PostProcess settings used.
CamOverridePostProcessAlpha = CamActor.CamOverridePostProcessAlpha;
CamPostProcessSettings = CamActor.CamOverridePostProcess;
}
else
{
// Give Pawn Viewtarget a chance to dictate the camera position.
// If Pawn doesn't override the camera view, then we proceed with our own defaults
if( Pawn(OutVT.Target) == None ||
!Pawn(OutVT.Target).CalcCamera(DeltaTime, OutVT.POV.Location, OutVT.POV.Rotation, OutVT.POV.FOV) )
{
// don't apply modifiers when using these debug camera modes.
bDoNotApplyModifiers = TRUE;

switch(CameraStyle)
{
case 'Fixed' : // No update, keeps previous view
OutVT.POV = OrigPOV;
break;

case 'ThirdPerson' : //Enters here as long as CameraStyle is still set to ThirdPerson
case 'FreeCam' :
case 'ShoulderCam' : // Over the shoulder view

Loc = OutVT.Target.Location; // Setting the camera location and rotation to the viewtarget's
Rot = OutVT.Target.Rotation;

if (CameraStyle == 'ThirdPerson')
{
Rot = PCOwner.Rotation; //setting the rotation of the camera to the rotation of the pawn
TargetZ = 0;
TargetFOV = 90;
TargetOffset = 0;
}

if (CameraStyle == 'ShoulderCam')
{
Rot = PCOwner.Rotation;
FreeCamDistance = 64;
TargetFOV = 60.f;
TargetZ = 32;
TargetOffset = 32;
}

//OutVT.Target.GetActorEyesViewPoint(Loc, Rot);

if(CameraStyle == 'FreeCam')
{
Rot = PCOwner.Rotation;
}

Loc += FreeCamOffset >> Rot;
Loc.Z += Z; // Setting the Z coordinate offset for shoulder view

//Linear interpolation algorithm. This is the "smoothing," so the camera doesn't jump between zoom levels
if (Dist != FreeCamDistance)
{
Dist = Lerp(Dist,FreeCamDistance,0.15); //Increment Dist towards FreeCamDistance, which is where you want your camera to be. Increments a percentage of the distance between them according to the third term, in this case, 0.15 or 15%
}
if (Z != TargetZ)
{
Z = Lerp(Z,TargetZ,0.1);
}
if (DefaultFOV != TargetFOV)
{
DefaultFOV = Lerp(DefaultFOV,TargetFOV,0.1);
}
if (Offset != TargetOffset)
{
Offset = Lerp(Offset,TargetOffset,0.1);
}

Pos = Loc - Vector(Rot) * Dist; /*Instead of using FreeCamDistance here, which would cause the camera to jump by the entire increment, we use Dist, which increments in small steps to the desired value of FreeCamDistance using the Lerp function above*/
// Setting the XY camera offset for shoulder view
Pos.X += Offset*sin(-Rot.Yaw*pival*2/65536);
Pos.Y += Offset*cos(Rot.Yaw*pival*2/65536);
// @fixme, respect BlockingVolume.bBlockCamera=false

//This determines if the camera will pass through a mesh by tracing a path to the view target.
HitActor = Trace(HitLocation, HitNormal, Pos, Loc, FALSE, vect(12,12,12));
//This is where the location and rotation of the camera are actually set
OutVT.POV.Location = (HitActor == None) ? Pos : HitLocation;
OutVT.POV.Rotation = Rot;

break; //This is where our code leaves the switch-case statement, preventing it from executing the commands intended for the FirstPerson case.

case 'FirstPerson' : // Simple first person, view through viewtarget's 'eyes'
default : OutVT.Target.GetActorEyesViewPoint(OutVT.POV.Locat ion, OutVT.POV.Rotation);
break;

}
}
}

if( !bDoNotApplyModifiers )
{
// Apply camera modifiers at the end (view shakes for example)

ApplyCameraModifiers(DeltaTime, OutVT.POV);
}
//`log( WorldInfo.TimeSeconds @ GetFuncName() @ OutVT.Target @ OutVT.POV.Location @ OutVT.POV.Rotation @ OutVT.POV.FOV );
}


Now you're finished. Just compile your script from the front end or your favorite method, and voila, (sort of) instant shoulder cam!

Good luck, cheers, and thanks!

JT

mickyg
05-02-2010, 08:57 PM
Thanks for taking the time to do this. I would like to ask you a few questions and pick your brain if I may...

Firstly, I followed your tutorial and when I play a level it defaults to a free roaming first person camera. Is this right?

I gather from your script that there are two different cameras but I can't see how you can switch them, so I'm not sure.

I'll have a few more questions, but these were the most important ones.

Thanks again

BloodReyvyn
05-02-2010, 09:48 PM
This would be awesome!!!!

If it worked...

http://i837.photobucket.com/albums/zz293/BloodReyvyn/BrokeAssTut.jpg

I came back and copied these scripts TO THE LETTER and they still failed to compile... Then I copied and pasted and STILL got failed compile.

Psilocybe
05-03-2010, 06:53 AM
Hey guys, thanks for bearing with me, this is my first tutorial. There was a little confusion with switching this code to the April release, and just some miscellaneous coding and wording issues when I was writing it in tutorial form. I've fixed all the bugs and retested every line of code, along with the ini edits so the tutorial should be a breeze now. Thanks for all the feedback!

[edit] just for reference, the stuff I changed is:

Error in naming pawn

Added bDelayedStart=false in gameinfo script (very important!!)

Fixed syntax errors in playercontroller script

Corrected defaultgame.ini to defaultgameudk.ini (an april release thing)

Added +EditPackages=YourGame to defaultengine.ini (also very important!)

Added note about content folder.

Do go through the tutorial again just to make sure I haven't missed any changes here.

Thanks again, and please post any questions you have!

junkens
05-03-2010, 07:01 AM
very nice tutorial
big thanks!

slagathor
05-03-2010, 08:23 AM
this is awesome! I think I may get some decent mileage out of this one :)

BloodReyvyn
05-03-2010, 03:17 PM
I'll give it a whirl again. Thanks for the update. :)

EDIT: Awesome, compiled without so much as a warning. I am about to go check it out right now. :)

EDIT 2: Very nice. And well-commented too. Alas, I finally understand how to use an external camera class. Thank a billion. :)

Psilocybe
05-03-2010, 03:48 PM
Hey, thanks a lot guys, I'm glad this is getting some use. I've uploaded a video on youtube of the script in action, along with an additional toggleable over-the-shoulder cam. If you'd like to see the scripting for that, too, just let me know.

Here's the vid: http://www.youtube.com/watch?v=lwOOQgtSxak

Dregoloth
05-03-2010, 05:28 PM
hey, I'm experiencing some errors (49 of them) all being upset about the engine's inability to find superclasses all beginning with UT, but I can't find any way to convert the references to UDK, can you help? there's probably an obvious reference in there, but I'm not a coder, and I can't seem to find it.

EDIT; fixed the inability to find UT stuff by going into the default engine.ini and changing +EditPackages=UTGameContente to +EditPackages=UDKGameContent
but I get a warning that it can't find C:\UDK\UDK-2010-04\Binaries\Win32\..\..\Developement\Src\UDKGameCo ntent\Classes\*.uc
Any suggestions?

McTavish
05-03-2010, 05:30 PM
This tutorial was written before the April Release

Psilocybe
05-03-2010, 05:43 PM
No, actually, I'm using the April release right now. I was using it when I wrote the tutorial a few days ago. Can you post an error sample?

Thanks!

Psilocybe
05-03-2010, 05:52 PM
What is the name of your game folder under UDk\udk-2010-04\development\src? Are you sure that the name of your folder matches the references in your script? Also, is there an unintended space in "UDKGameCo ntent?" It's sounds like you made a typo somewhere in your script or ini files.

BloodReyvyn
05-03-2010, 06:03 PM
@Psilocybe: If you could post the script for the Over-The-Shoulder camera, that would be great.

This zoom-able cam is cool and works well for my menu (I have a map that you can run around and interact with different elements rather than a traditional 2d-type menu. Kind of like Conker's Bad Fur Day from N64 where each door takes you to a different option/game save/etc and opens a new UIScene), but for the actual gameplay I was hoping for a slightly zoomed-out over-the-shoulder cam.

Of course, there's no rush on that and I may figure it out on my own before you get to it, but it may be helpful to others as well.

Psilocybe
05-03-2010, 11:37 PM
Ok, I've updated the tutorial to include the shoulder camera. I hope it's about the right depth for everyone. It's now a bit long, so let me know if you have or find any problems with it.

Thanks!

ThePriest909
05-03-2010, 11:44 PM
Very very useful tut.
Thank you very much.

BloodReyvyn
05-04-2010, 12:04 AM
Awesome man, I will give it a run through tomorrow morning. :)

Thanks for providing so much info.

BloodReyvyn
05-04-2010, 12:12 AM
I also want to thank you for guiding me in the right direction with implementing Mathematics formulas (particularly trig) in UScript.

Mostly I was getting confused about the symbols used in scripting since my background in coding has been mostly a whole lot of QBASIC, BlitzBASIC, and DarkBasic. The symbols like ==, !=, etc were a little confusing, but after muddling through this alongside some JavaScript Basics tuts, I think I got this nailed down now. :)

Psilocybe
05-04-2010, 12:21 AM
Oh man, I know how it is, I'm just an amateur myself. This (http://en.wikipedia.org/wiki/Operators_in_C_and_C) is a really good reference for using UDK. I can't count the number of times I've went back there to figure out what the hell I'm doing.

BloodReyvyn
05-04-2010, 12:39 AM
Well, I tried to get this working, but am still stuck with the same old default camera and have to toggle over-the-shoulder... Not quite what I was looking for. Maybe if I was making a Mass Effect type game....

I tried executing the ShoulderCam function after the "simulated event PostBeginPlay()", but I get a compile error. Where would be the proper place to initiate this function to get the over-the-shoulder cam by default?

Psilocybe
05-04-2010, 12:48 AM
Ah, ok. So the script was designed to toggle back and forth on a press and release basis, but it's really easy to change.
If you want it to just start with the over the shoulder camera, you're going to want to go into YourGamePawn


simulated function name GetDefaultCameraMode(PlayerController RequestedBy)
{
return 'ThirdPerson';
}

and change "ThirdPerson" to "ShoulderCam" That will tell your pawn to ask for the shoulder camera by default. This also means that you'd want to change the behavior of the ShoulderCam and ReturnCam functions in your playercontroller, and maybe also the behavior of the keybinding (since it's set as a toggle switch kind of thing). If you have any questions about any of that stuff just let me know.

BloodReyvyn
05-04-2010, 01:38 AM
Wow, thanks, that was a much simpler fix than I was trying to do, lol. :)

mickyg
05-05-2010, 11:30 PM
Man, I swear I've followed your tutorial to the letter (the first part, not the GOW part), and it won't work.

When I click launch it takes me to the level I specified (DM-Deck), but it's just a normal first person camera.

I've even kept everything as per your names (YourGame), so I can literally copy and paste everything and it still doesn't work. Is there any way to easily tell through logging if there is a problem?

I really appreciate that you've taken the time to do this, sorry for being such a pain.

dami3n
05-06-2010, 07:11 PM
Nice post. But tbh for me it seems like a lot of ball ache for something that is similar to behindview command the only difference is with this camera you can zoom in and out.

But yeh, I might tweak this a little and see what I can do with it thanks for the post.

CoryG89
05-08-2010, 01:28 PM
Note: Please back up your config files before editing them. You'll probably be sorry if you don't.

So so true. How I wish I had read this note an hour ago. Waiting on download of fresh UDK install right now.

junkens
05-08-2010, 04:37 PM
just seen that you've uploaded it on udkbase too.
Big thanks for supporting.

I'm right now changing the used bbcode tags so that it's showed the right way.
thanks again and a awesome tutorial!

Prophet_
05-08-2010, 05:20 PM
This is a great tutorial man, really good for people trying to work out how to set up there own custom camera's, but in my case it was exactly what I wanted. Now the tricky part, iv'e been fiddling around trying to get a basic weapon in like a link gun, since there is no defualt gun's for GamePawn. Iv'e tried changing to UTPawn but it ruins the camera. Please any help would be great, maybe even a hud tutorial with GamePawn.

Thanks heaps man awesome tutorial

farshad12
05-09-2010, 06:11 AM
This is a great tutorial man, really good for people trying to work out how to set up there own custom camera's, but in my case it was exactly what I wanted. Now the tricky part, iv'e been fiddling around trying to get a basic weapon in like a link gun, since there is no defualt gun's for GamePawn. Iv'e tried changing to UTPawn but it ruins the camera. Please any help would be great, maybe even a hud tutorial with GamePawn.

Thanks heaps man awesome tutorial

Yes, there is not DefaultGun variable, instead you need to use this line in your GameInfo class's DefaultProperties block:

DefaultInventory(0)=class'CustomGame.CustomLinkGun '

CoryG89
05-10-2010, 01:32 PM
Ok, so I got most of this done. I did everything but the last shoulder cam part. I am having a little trouble with the camera though.

If my environment is not indoor (ie. w/ a ceiling) it goes very high up in the air if you try to rotate above the pawn. Also, when I tried loading dm-deck as a map, there were certain random spots where if I rotated the camera just right, it would zoom out very far away from the player.

I tried doing something like this to fix it:


if(FreeCamDistance > 512)
{
FreeCamDistance = 512;
}

This didn't seem to change anything noticeable. I figured it would make sure that the cam didn't go to far from the pawn. Any ideas?

Psilocybe
05-10-2010, 10:16 PM
Hey guys, thanks for the positive feedback!

@Cory, it sounds like you have the camera zoomed far out, and you're letting the collision check reign it in for you. First off, you can just use your scroll wheel and zoom in if you don't like the current distance. Second, if you don't want your player to be able to zoom out that far at all, the zoom limit is handled in the playercontroller script. If you'd like to set it lower than 512, in your playercontroller script you need to edit:



if (PlayerCamera.FreeCamDistance < 512) // Edit this value. Set it lower if you'd like to have the zoom limited to a closer distance
{
`Log("MouseScrollDown");
PlayerCamera.FreeCamDistance += 64*(PlayerCamera.FreeCamDistance/256);
}
}

@MickyG, sorry for taking so long to get back to you about this. Hmm, that is interesting. It sounds to me like there's a mistake in your ini files somewhere. Have you tried making a test level to launch to? Other than that, all I can suggest is going through the tutorial again, first double checking your ini files, and then if that doesn't work, copy/pasting the code into your scripts again.

@junkens, thank you for having a wonderful website like UDKBase. If I needed to update the tutorial on UDK base, say if I edit it here (I'm thinking about putting in DeltaTime to correct some zoom effects) is there any way I can edit the one on UDKBase?

Cheers all,

JT

CoryG89
05-11-2010, 09:03 PM
Can you elaborate on how DeltaTime plays a role in the tutorial currently, and how it will play a role in the functionality you're thinking about implementing, I am interested.

Psilocybe
05-11-2010, 11:17 PM
Ah, well right now the DeltaTime function isn't in the tutorial at all. It basically returns the time since the last program cycle. This is useful in the lerping functions, since the way it's written now, the lerp function is called every tick. This becomes a problem in that, this makes the speed of the zoom dependent on how fast your game runs.
If you add in a statement telling the UDK not to lerp update unless a certain time has passed, even if the frame rate goes through the roof, the camera will still move at the same rate.

Saishy
05-12-2010, 06:13 PM
I tried a system where if you zoom in after a certain range, the game goes in first person mode, but when the camera goes in first person, the character is a lot higher than in third person, tested with a square texture, and if I look down, I see my character below.

I think I will just make the character transparent when you zoom in, without going in first person. Also can you give me tips to change my character movement in such a way that he never strafes or walk backwards? I want it to always walk in the direction you press the button (relative to the camera) but turning the whole body in the direction it's moving. Only face the same way as the camera when attacking or neutral.

A video to make it clearly:

http://www.youtube.com/watch?v=uZkL4UBw3lE


I just need some tips on what function does what so I can start messing around.
Thanks in advance!

Psilocybe
05-12-2010, 09:34 PM
Right, well naturally this problem with height will happen, since the camera is centered on the center of the character, rather than the eye height. You can fix this easily if you've implemented the Z axis offset in the GOW camera portion of the tutorial. You'd simply play around with the value of TargetZ until you get the height you want.

As for character transparency, you need to do just that: when the camera enters first person mode you need to set the value of bOwnerNoSee in your pawn script to True.

In regards to custom player movement like what you described, I don't have enough experience right now to say exactly how you would do that. Rest assured though, when I do, I'll post a tutorial.

Good luck and cheers!

JT

CoryG89
05-13-2010, 05:52 PM
I'm having issues with the camera popping way out.


Not sure why, anyone else have this behavior?

CoryG89
05-13-2010, 09:10 PM
Nevermind, I got it working. This is some great code, awesome tutorial. Keep it up.

Prophet_
05-14-2010, 01:56 AM
Yes, there is not DefaultGun variable, instead you need to use this line in your GameInfo class's DefaultProperties block:

DefaultInventory(0)=class'CustomGame.CustomLinkGun '

hmm, thats not really working for me :(

Saishy
05-14-2010, 08:01 AM
I'm having trouble extending anything other than GameInfo.
When I try, I lose my custom camera and can't turn it on.

I don't think I have enough knowledge to redo the whole game system, but I can't find something that could be overwriting my camera in UDKGame or UTDeathmatch.

ronsen
05-15-2010, 03:33 AM
hi,
thanks for the tutorial, just started to play around with the udk, so right
now not really an idea what i'm doing :-)

it worked for me pretty well. but i can't see any weapon
(shooting also not possible) in the 3rd person view.
did i make something wrong or is that not possible yet?

do we have to say the engine it should render the weapons in 3rd person view?

(is it possible to learn the unrealscript language for a person without any c/c++ knowledge?)

thanks

Prophet_
05-15-2010, 08:48 AM
hi,
thanks for the tutorial, just started to play around with the udk, so right
now not really an idea what i'm doing :-)

it worked for me pretty well. but i can't see any weapon
(shooting also not possible) in the 3rd person view.
did i make something wrong or is that not possible yet?

do we have to say the engine it should render the weapons in 3rd person view?

(is it possible to learn the unrealscript language for a person without any c/c++ knowledge?)

thanks

Hey mate, yeah im having the same problem as you can see. Its not that we need to tell it to render, Since it is using GamePawn instead of UTPawn then we have to declare default guns and some other stuff i think, im not sure how to do it so much tho.

farshad12
05-15-2010, 05:57 PM
hmm, thats not really working for me :(

It should work. What do you write for it exactly? Where you put it?

In the case you have a coustom weapon, you must write somthing like this:

DefaultInventory(0)=class'[YourProjectName].[CustomGun]'
Just replace [YourProjectName] and [CustomGun] with yours. Be sure your weapon class extends inventory class direct or indirect.

Otherwise if you want to use a normal weapon like LinkGun, you must write this:

DefaultInventory(0)=class'UTGame.UTWeap_LinkGun'
You can change UTWeap_LinkGun with any existing weapon.

Hope it helps.:)

rahatropa
05-16-2010, 03:24 AM
Great tutorial and props for commenting your code! I have a question I was hoping you could answer as you seem to have a solid understanding of UDK's camera class. Basically, I'm creating an "isometric" camera for a point-and-click player. It is largely based on the isometric tutorials that were posted here but I'm beginning to question if how it's done is a hacky solution that might lead to headaches down the road. The way it's currently set up is by changing two functions, CalcCamera in my Pawn class, and UpdateRotation in my PC class (this is the one that is really making me question whether or not it's the right way of doing it).

(My Pawn's DefaultCameraMode btw returns ThirdPerson) In my pawn's CalcCamera I overwrite out_CamLoc so that end = Location - Vector(Controller.Rotation) * 600.f . This is what I use to move the camera away from my Pawn, where 600.f is the camera distance. If it were a variable and I had a function for mouse wheel up/down that added/took from it, it would behave correctly for camera zooming in and out. So with the camera distance taken care of all that's left is setting up a fixed camera rotation, which is where my concern lies:

Currently, I'm locking the camera's rotation in my PlayerController's UpdateRotation function by defining ViewRotation.Pitch = -10000 and ViewRotation.Yaw = -5500 (respective Unr Units for the rotation degrees I wanted in my isometric camera). My understanding is that the UpdateRotation function updates both the rotation of the Controller and the Controller's Pawn, which isn't ideal for a point-and-click setup where the Pawn's rotation (based on where they're moving to) would change while the camera's rotation should remain fixed. Removing Pawn.FaceRotation(NewRotation, deltatime) at the end of UpdateRotation() would probably solve this, but I guess my question is, is this the right way of setting up my camera for my needs? Or is there a better solution involving UpdateViewTarget as you did in your custom camera. By the way I do have a custom camera that extends GameThirdPersonCamera, but all its currently doing is defining the FOV of the camera.

I hope my question makes sense! I've struggled making sense of 3rd person camera setup with all the various classes that can control it!

Ataulfo
05-16-2010, 11:43 AM
Both of the cameras worked fine for me but I need to know how do I get my LinkGun back.

Saishy
05-17-2010, 08:42 PM
For those without guns, read this: http://udn.epicgames.com/Three/DevelopmentKitFirstScriptProject.html

jhawks
05-18-2010, 08:19 PM
I'm having trouble with 2 things:

I done the first half of the tutorial, getting a third person camera working with zoom. But when I do the next half about creating a Shoulder Cam, I can't find "UDKinput.ini". The closest is "DefaultInput.ini" (located under UDK\UDK-2010-03\UTGame\Config) because inside it I see the game's bindings.

Second, just a sort of off-track. I decided to change the mouse's left and right movements to that of "A" and "D" (so that the character turns left or right when you press A or D respectively).

That didn't work and when I pasted over the file with the original (I made a backup of the original DefaultInput.ini), the game and the editor won't rebuild even though I made sure that the file wasn't read-only.

Help please =( I can't figure it out.

Chopkeeper
05-18-2010, 08:19 PM
I second that your commenting is fantastic, robust enough to understand, but not too lengthy as to become a lecture. Keep up the good work psilocybe.

Psilocybe
05-19-2010, 04:42 AM
Hey guys, thanks for the comments, and sorry for the long time between my own comments.

So, for everyone who is wondering about weapons, this tutorial is written with entirely custom scripts, meaning that really hardly anything besides the camera and basic movement stuff is implemented. This means, that, just by following this tutorial, you will not have weapons. You'll need to implement them yourself.

This leaves you with a few options.

Number one, you could follow one of the tutorials the exist on custom weapons, although this might require a fair bit of coding, and you'll have to understand how to properly mesh the two tutorials.
Number two, you could attempt to extract the weapons related code from the UTGame scripts.
Number three, if you're not interested in creating a full game, you could use the camera script and adapt it to work with the UTGame scripts so as to port this into Unreal Tournament.

If I had the time right now (which I may have fairly soon), I'd go in and see if I could work one of these solutions myself and post up a tutorial. For now, though, unfortunately you're on your own with weapons.

As for specifics, Ronsen, like I said, this tutorial does not currently include weapons, but you could try one of the ideas I listed above. About c/c++, I think it's entirely possible to learn Unrealscript without knowing c++ first. All it takes is a little drive to learn how c++ works, since unrealscript is based in c++. I myself hadn't done any c++ at all in years, and I'm foraging ahead ok.

@rahatropa, thanks much for the compliments! The way you're doing seems like it would work fine, but I would recomment consolidating all of your essential camera functions in your camera script. This way, when you create a game with a bunch of different viewpoints and such, you need only to define your camera class from the playercontroller script and everything switches correctly. As for how to do it in the camera script, let me run over the major points:

First, I would do zooming using freecamdistance as described in my tutorial. This consolidates all of your vector math and camera functions in the camera script. Keeping everything in the camera script will definitely make things less confusing.

As for how to lock camera angles, it's fairly simple. I'm using some script from this tutorial for the example, as I don't know what your code looks like, but hopefully it will be clear:

Lets take our camera script from the first tutorial section and add an isometric state.


Under our switch-case statement, below the if statement for ThirdPerson camera style, we'll add another if statement.

if (CameraStyle == 'Isometric') // A basic if statement
{
Rot.pitch = -10000;
Rot.yaw = -5500; // With these two statements, we're telling the camera to stay fixed at these rotation values, provided by rahatropa

}

You're also going to need to add the line case 'Isometric' : under the case declaration for ThirdPerson. You will also, of course, also have to provide a way to switch camerastyles; this is described in the GOW Camera section of the tutorial.


Now, if you're using any tutorials I've read, the camera script should use a variable called Rot for the rotation of the camera, as it is here, so this should be relevant to whatever sort of script you're using. If you need to address this rotation from outside the camera script, you'll need to address it by typecasting. If you need help on any of this, please post your code either here or in another thread, and I'd be happy to take a look.

@Sashy, like I said, I haven't tried using this with existing scripts that come with the UDK. What scripts are you creating custom and what scripts are you taking from UT3 or UDK?

If I've missed anyone, or anything isn't clear, just post or message me, and I'll get back to you ASAP.

Cheers!

k0s
05-20-2010, 05:09 AM
I'm having trouble with 2 things:

I done the first half of the tutorial, getting a third person camera working with zoom. But when I do the next half about creating a Shoulder Cam, I can't find "UDKinput.ini". The closest is "DefaultInput.ini" (located under UDK\UDK-2010-03\UTGame\Config) because inside it I see the game's bindings.

Second, just a sort of off-track. I decided to change the mouse's left and right movements to that of "A" and "D" (so that the character turns left or right when you press A or D respectively).

That didn't work and when I pasted over the file with the original (I made a backup of the original DefaultInput.ini), the game and the editor won't rebuild even though I made sure that the file wasn't read-only.

Help please =( I can't figure it out.


UTInput.ini

it is in the releases 'BEFORE' april ;)
everything works PERFECTLY! i added the Crosshair and Targetinfos from the UDN tutorials. brilliant. camera got collision.

I simply <3 you :)

my question here is :

since i would like to do some transitions between a "sequence" camera i wonder how to return to the "custom or your camera"..
basically i am doin transitions with matinee, and need the "camera object" ?!?
how to access your camera/s within UT by matinee ?!

thanks !

Saishy
05-20-2010, 04:44 PM
@Sashy, like I said, I haven't tried using this with existing scripts that come with the UDK. What scripts are you creating custom and what scripts are you taking from UT3 or UDK?

If I've missed anyone, or anything isn't clear, just post or message me, and I'll get back to you ASAP.

Cheers!

Simply using anything other than GameInfo will deactivate your camera.
D:

UTDeathMatch or UDKGame.

Psilocybe
05-20-2010, 08:28 PM
@ k0s, Thank you for answering that question, and @jhawks, sorry I missed it! Like he said, this was written on the April release, meaning that pretty much everything that had the prefix UT no says UDK. UTInput.ini should serve your purposes just fine.

As for your second question, it won't rebuild, as in it throws back an error (and if so, what error) or it says that nothing needs compiling?

@k0s, I haven't done much work in Matinee yet, but I imagine there is some sort of switch that allows you to return to the default camera after a cut scene.

@Sashy, did you try putting the relevant code:


bDelayedStart=false
PlayerControllerClass = class 'YourGame.YourGamePlayerController' //Setting the Player Controller to your custom script
DefaultPawnClass = class 'YourGame.YourGamePawn' //Setting the Pawn to your custom script

into the defaultproperties of UTDeathMatch or UDKGame? If you've already tried this, look around in the script files and find anything that could be changing these default values.

It sounds like everyone is getting some utility out of this :)

Cheers!

sirtoggle
05-20-2010, 11:46 PM
Thanks again for all of the work on this.
I switched it up a little, made the shouldercam the default camera, adjusting the placement is really easy this way. I really like how it is pretty simple and easy to understand. I was looking at another code that does 3rd person and also cover as well and it made my eyes cross.

Anyways, my question is the HUD. Before I start playing with it. Would I just bring over anything from the default ini files that are for HUD options and place them into the new ini files? And if so where do they go.

Thats really my big problem in understanding script. I don't know where to put in new code to expand this tutorial without breaking everything and being yelled at by udk.
I'm sure there is a tutorial on basic scripting. But any of the basic ones I've found just rehash basically what's already in your tutorial.

... I'm most likely just looking in the wrong place I think.

anyways, thanks again for this really good tutorial.

sirtoggle
05-21-2010, 12:22 AM
UTInput.ini

it is in the releases 'BEFORE' april ;)
everything works PERFECTLY! i added the Crosshair and Targetinfos from the UDN tutorials. brilliant. camera got collision.

I simply <3 you :)

my question here is :

since i would like to do some transitions between a "sequence" camera i wonder how to return to the "custom or your camera"..
basically i am doin transitions with matinee, and need the "camera object" ?!?
how to access your camera/s within UT by matinee ?!

thanks !

If your talking about a cinematic type of event? Or just changing the camera in special places in your map?

I have been doing a little reading on the cinematic event, which would be another level, level a ends where the cinematic begins, and level b begins where the cinematic ends.

You could most likely do that for special places maybe with level streaming. (which I have not played with yet, so I could be WAY off.) But my idea would be to split it into 3 levels as well, except instead of animation of cinematic event, it would be cinematic cameras with player controlled movement, so basicly set up the same way. and if level streaming works like I think it might, (As in load another map into memory as you come to the point, or it works by only loading small parts of the map at a time) but then again if the level is really small maybe you could do the 3 cuts without a big delay inbetween if kept really small. again . just a thought.
or just ... I dunno. I'll play with it more after work tomorrow.

Psilocybe
05-21-2010, 12:36 AM
@sirtoggle, It sounds like you're getting the hang of it. Keep messing around with the code, and above all, keeping going through tutorials on not only Unrealscript, but C++ as well. Understanding basic program flow, functional programming, and things like if then else statements is key to learning Unrealscript.

If you have some specific questions about how to do something, first search and see if someone has a tutorial, and then go ahead and post a thread to get some hands-on help.

I'd have to disagree with you there on cinematics though. As I understand it, you can take control of the camera and freeze the player (there's an event for that) when you start a Matinee event and proceed to run your animations and such, and then hand control back to the player (again, I've used a kismet event that does this), all within the same level.

When I get more time to work on my current project, I'll keep everyone updated about how I go about scripting the cut scenes (and everything else too!)

Cheers.

sirtoggle
05-21-2010, 01:09 AM
Yeah I see what you were talking about I haven't played with it too much yet.

also I did a search before for hud, and got nothing, now I did one for 'take damage, kismet' and found a detailed tutorial.
http://forums.epicgames.com/showthread.php?t=722254&highlight=Damage,+Kismet
If anyone else is pondering the same questions in life as I am.

hamidi
05-21-2010, 03:48 AM
hi
i'm a real newbie and this is the first time i come here and see anyone's post. this is the first time i hear about UDK and the third person.
when i install UDK, there're two major icons, UDK Game and UDK Editor in the start menu. when i run the editor, i blank map brings up without any changes being applied. when i bring up the game it also brings the game and not any changes above r applied. i created the four scripts, but nothing changed.

hamidi
05-21-2010, 05:18 AM
i get a Message:
Scripts are outdated. Would you like to rebuild now?
i select Yes. then scripts are compiled in a window that never closed. it seems that something remains up after compilation succeeds. because the message appears again if i close the window manually and try to run the game again.
it sounds something is going wrong. what's the problem?

hamidi
05-21-2010, 05:28 AM
the compilation window output is as follows:
Init: Command line:
Init: Base directory: C:\UDK\UDK-2010-04\Binaries\Win32\
Init: Character set: Unicode
Log: Executing Class UnrealEd.MakeCommandlet
--------------------Core - Release--------------------
--------------------Engine - Release--------------------
--------------------GameFramework - Release--------------------
--------------------UnrealEd - Release--------------------
--------------------IpDrv - Release--------------------
--------------------OnlineSubsystemPC - Release--------------------
--------------------UDKBase - Release--------------------
--------------------UTEditor - Release--------------------
--------------------UTGame - Release--------------------
--------------------UTGameContent - Release--------------------
--------------------YourGame - Release--------------------
Warning, Can't find files matching C:\UDK\UDK-2010-04\Binaries\Win32\..\..\Development\Src\YourGame\C lasses\*.uc

Warning/Error Summary
---------------------
Warning, Can't find files matching C:\UDK\UDK-2010-04\Binaries\Win32\..\..\Development\Src\YourGame\C lasses\*.uc

Success - 0 error(s), 1 warning(s)

Execution of commandlet took: 19.76 seconds

hamidi
05-21-2010, 05:54 AM
by creating the requested folder the compilation succeeded with no error/ no warnings. i closed the compilation window manually. the next time i started the game it launched without the message. but nothing differed. the game started as it was. maybe i've to toggle between cameras? how?

sirtoggle
05-21-2010, 06:50 PM
@ hamidi
Left shift is the camera toggle key if you did everything as per the tutorial.

By your first post I am assuming that you are trying to test this on a blank map, if so you will need to make a test map and build all, or load a map that came with UDK. then right click and goto 'play from here' or 'play level' or even 'play in viewport' to see the changes this makes.
Again I might just be assuming wrong. I tend to do that a lot.

Blade[UG]
06-03-2010, 03:08 AM
for the love of all things Holy, please put your DefaultProperties blocks at the END of your source.

hamidi
06-03-2010, 08:44 AM
i created the scripts based on the documents.
i'm not going to change the default map at the point.
when i run the game and click the left Shift key nothing changes.
how can i make sure that the problem is for scripts or for something else.
what can be wrong?
thx

mesavage
06-03-2010, 08:59 AM
;27367951']for the love of all things Holy, please put your DefaultProperties blocks at the END of your source.

I LOLed so hard when I read that, I almost pee'd myself. Well stated!

hamidi
06-03-2010, 09:15 AM
i couldn't figure the meaning out though, sorry
would u explain, plz?

Blade[UG]
06-04-2010, 02:20 AM
I LOLed so hard when I read that, I almost pee'd myself. Well stated!

I didn't think it was that funny? But glad I made you laugh :D

Psilocybe
06-07-2010, 12:39 AM
@hamidi, Hmm, well, did the log register a keypress? If you're using the scripts as is, it should output a log message "Shoulder Camera." (You should be running the game with the -log command)

@Blade, Ah, I hadn't realized that was the standard. I usually put them at the top out of habit. Now that I look, they do always put it at the bottom. Good call.

Saishy
06-07-2010, 08:30 AM
@hamidi, Hmm, well, did the log register a keypress? If you're using the scripts as is, it should output a log message "Shoulder Camera." (You should be running the game with the -log command)

@Blade, Ah, I hadn't realized that was the standard. I usually put them at the top out of habit. Now that I look, they do always put it at the bottom. Good call.
It's not just a standard, it's a way of life.
And UDK also ***** about it sometimes.

shuriken88
06-08-2010, 03:51 PM
Thanks for this tutorial man. I've just started following it, but how come sometimes you use: MyGame.MyPawn (just for example), and other times you just use Mypawn, when telling UDK what script to use? does it not matter for the engine, because another tut I followed didnt use any "Mygame." prefixes (or whatever), just "=Class'scriptname'" (also with no spaces, unlike yours), and it didn't work. Im hoping this is the reason?

Also, why is it best to put the DEFAULT PROPERTIES at the END, and not the start? The 2 tutorials I've followed have you putting it at the beginning, just after the "blahblah extends UTBlahblah" (is it just like a neatness/preference thing, but not detrimental to your code working?)

Is there any reason why your extending the "game----" scripts too, (EG MyPlayerController extends GameplayerController (and not just PlayerController). In another tut I followed (which didnt work), mygameinfo extended UTDeathMatch (and not just GameInfo), is that something that would work?

What do these expressions mean? (/*) and (*/), are they another type of (//)?

My "DefaultGameUDK.ini" is different to yours, where you have:- DefaultGame=UTGame.UTDeathmatch
DefaultServerGame=UTGame.UTDeathmatch

I have:-
DefaultGame=UDKBase.UDKGame
DefaultServerGame=UDKBase.UDKGame

So initially I thought you were asking us to change these to read "UTGame.UTDeathmatch", but I just changed them both to "MyGame.MyGameInfo", hopefully thats right?

When you said that you have to put your maps and content in a 'MyGame' folder in 'Content', does the same apply to my general custom UPK files, like my mesh, texture and music UPK's? Or do I only move the map? Moving the UPK's would make some of my maps not work anymore because the paths are different.

Sorry if these questions sound a bit stupid to the advanced script writers out there, but I dont really know anything about 'proper syntax' and stuff (or ANYTHING about ANY programming language), Im just trying to learn, get a brief understanding of the basic functionality of uscript, and im finding it all very confusing, almost too confusing. I was never good at foreign languages you see, just english. I know its all well and good being able to copy/paste code and watch it in action, but knowing what your copying/pasting is even better (so you can actually learn from it), which is why im asking these funny questions.

Oh yea, I also wanted to know if this camera has collision detection (Does the camera go through stuff it shouldn't go through, like anything solid)

Edit:-

The tutorial hasn't worked for me (none of the scripting ones have LOL). The frontend compiles the script without any errors, but when I load the game (game mode, not editor mode) Im just floating around like a spectator, and I cant start, plus it says paths/lighting need rebuilding (how can you do that outside of the editor?), also the flashlight I've got going on, just stays there and is no longer attached to the player (maybe because there is no player now)

What am I doing wrong? I followed the tutorial to the letter, only swapping certain details (like the names of my script files as opposed to the ones in the script EG. "YourGameCamera" changed to "S88Camera")

Psilocybe
06-08-2010, 09:23 PM
Hi Shuriken,

As far as I know, whenever I declare something like a default class, I declare it as project.script. I'm fairly sure you do need to specify the parent project, and if you don't, it helps in cases where you have two scripts in different projects with the same title.

Well, I have been putting the default properties at the beginning, but some people have insisted that it should be at the end (as it is in the scripts for UT3). I haven't run into any problem putting at the top, but as a default, I suppose you should do as EPIC does. (I'm actually skeptical about this, as C++ code flows from top to bottom, it seems that you'd want to set default values to your variables before you use them, e.g. at the top of your code.)

I extend from GamePlayerController (which in turn extends from PlayerController) because it has some additional functions which PlayerController does not. That being said, I got this from a previous tutorial, so I can't say for sure whether you could adapt this to extend from PlayerController instead.

/* and */ are part of the block commenting method in C++. /* goes at the beginning of a block of text you want to comment out, and */ goes at the end.

This tutorial was created with the April release, DefaultGame and the rest could have a different default value, but you should change them nonetheless to your custom game info class as you did.

I suggest putting your maps and packages in Content only as an organizational idea. In reality, you can put them wherever you want as long as the UDK can find them.

No worries, I'm not very good at C++ yet either, but I have no problem sharing what knowledge I have. :D

The camera does indeed have collision detection. There are comments in the code that show you where that is located. It just traces a line from the camera to the viewtarget (i.e. your character) and if there's an obstruction, it places the camera at the closest point without an obstruction.

Hmm, I'm entirely sure what this problem is coming from. A couple people have reported this. What map are you loading? What map have you specified in your ini as your level transition map? Are you using additional custom scripting?

Cheers!

Liquid-Bluhm
06-08-2010, 11:56 PM
Psilocybe, I kindly thank you for sharing this.

I have a doubt regarding the camera manipulation and pawn visibility, How would be possible to set a 1st person camera that the body is visible (i.e Mirror's Edge)?

My intention is to make very immersible 1st person animations, without having to set 1st person models and 3rd person models.

Looking forward to your answer.

Psilocybe
06-09-2010, 01:17 AM
Hi liquid,

You can set the character model to be visible by setting the following variable in your pawn class:


bOwnerNoSee=false

Cheers.

daimaku
06-10-2010, 03:08 PM
thank you Psilocybe, is a good tutorial !!!!

shuriken88
06-12-2010, 01:19 PM
Thanks for the comment Psilocybe, I see what you mean, if thats how C++ works, then I think it would make more sense being at the start too.

Anyway, the map I decided to use was a custom one with the VCTF prefix (just because its the one with the most going on). Maybe its because Im using a different playercontroller script now, so the kismet sequences are trying to reference the original playercontroller/pawn script thats not there (but thought the script extending/adopting thing prevented that)? I also have 2 scripts that add a kind of player inventory system to kismet, but I dont really understand how you use them lol. I just tried to make it use another map, and it loads up normally, but has exactly the same problem (stuck in spectator mode, and no lighting)

I tried changing the default gametype to "UTGame.UTDeathmatch", and then "MyGame.MyGameInfo", but that made no difference to anything so I changed it back to "UDKBase.UDKGame". The other map I tried was a DM map, which is why I tried setting it to UTDeathmatch (or does it not matter what map-prefix you have if you use UDKGame?)

Anyway thanks for the help and advice man, I really want to get this working. I cant think of too much else to try. Is everyone else using example maps? Im using the April Beta by the way. I'll try building the scripts again in frontend (Although I can only remember editing ini's since I last built)

peace

Psilocybe
06-12-2010, 02:32 PM
Ahh, OK.

So first of all, you do need to use the PlayerController script specified in the tutorial or it will not work properly. You can try combining that code with the code in the PlayerController you're using now, but the code might interfere, I'm not sure.

The default gametype needs to be set to "MyGame.MyGameInfo" Where MyGame is the name of your project (the folder under src it's located in), and "MyGameInfo" is the name of your game info script.

You should definitely run back through the tutorial and make sure that you've done everything specified.

You also might want to forgo interfacing a player inventory system until you've done a bit more coding. I'm still working on the basics here before doing that kind of thing.

My final advice is to create your own test map. Just a 16x512x512 plane with a couple of point lights and a player start. Build all and then try it with that map.

And of course, make sure you're scripts are compiling properly, as always.

I hope you get your code working!

Cheers!

(Oh, and thanks @Daimaku :D)

jorgeamaral
06-16-2010, 02:31 PM
I Wrote it in mygameinfo:

DefaultInventory(0) = class 'UTGame.UTWeap_ShockRifle', but it doesnīt work with me.

C:\UDK\UDK-2010-05\Development\Src\CustomGames\Classes\AJGameInfo. uc(7) : Warning, Unknown property in defaults: DefaultInventory(0) = class 'UTGame.UTWeap_ShockRifle'

AdamCMills
06-17-2010, 07:58 AM
Hi, new here. I understand the basics of UDK, went through all the 3D Buzz tutorials, so now trying to break into the scripting. This looked like a good place to start. I understand the scripts themselves, so I feel a little stupid asking this, but I can't seem to get it to work otherwise. You said, "Now you're almost all finished. The last step is to open the UDK Launcher and click 'make.' Voila, your game should be playable in editor and from the launcher now!"

OK, does that mean to open the Editor? It so where is this "make" I am supposed to click? If not, where is this launcher you speak of. I've done a scan of all the file and I do not have anything labeled "UDK Launcher" on my PC. I keep loading my map up, I get no errors or any feed back. Just my map in first person.

eAlex79
06-17-2010, 08:49 AM
UnrealFrontend.exe in the Binaries folder :)

AdamCMills
06-17-2010, 09:54 AM
Cool, minus a few typos that I had to fix it ran with no errors or warnings. But it still doesn't seem to function. I'll keep tinkering to see if I can figure it out.

I get an alert message whenever I click make that reads:

Ambiguous package name: Using
'C:\UDK\UDK-2010-05\UDKGame\Content\CronoWorld\CronoWorld.udk', not
'C:\UDK\UDK-2010-05\UDKGame\Script\CronoWorld.u'

What, exactly does this mean?

eAlex79
06-17-2010, 11:23 AM
Don't use the same name for two different things :)

AdamCMills
06-17-2010, 12:23 PM
Different Folders, different extensions but still can't have the same name :) ... good to know.

Alright, script still isn't working ... I'm not sure why ... none of the logs come to the console.


`Log("My Message");

That is the right syntax for sending a message to the log correct? And it should show up in the console window correct? It works like a ... alert in JS, trace in AS or and echo in PHP ... I assume. I am trying to debug but having little success.

My 'make' has no errors or warning, I guess I'll post perhaps I am missing something:


[COMMANDLET 'UDK.exe make' STARTED IN ''] June 17, 12:10 PM

Init: Version: 6699
Init: Epic Internal: 0
Init: Compiled (32-bit): May 20 2010 09:59:27
Init: Command line: -DEFENGINEINI=..\..\UDKGame\Config\DefaultEngine.in i
Init: Base directory: C:\UDK\UDK-2010-05\Binaries\Win32\
Init: Character set: Unicode
Log: Executing Class UnrealEd.MakeCommandlet
--------------------Core - Release--------------------
--------------------Engine - Release--------------------
--------------------GFxUI - Release--------------------
--------------------GameFramework - Release--------------------
--------------------UnrealEd - Release--------------------
--------------------GFxUIEditor - Release--------------------
--------------------IpDrv - Release--------------------
--------------------OnlineSubsystemPC - Release--------------------
--------------------OnlineSubsystemSteamworks - Release--------------------
--------------------UDKBase - Release--------------------
--------------------UTEditor - Release--------------------
--------------------CronoWorld - Release--------------------
Package CronoWorld changed, recompiling
Analyzing...
Scripts successfully compiled - saving package 'C:\UDK\UDK-2010-05\Binaries\Win32\..\..\UDKGame\Script\CronoWorld. u'
--------------------UTGame - Release--------------------
Analyzing...
Scripts successfully compiled - saving package 'C:\UDK\UDK-2010-05\Binaries\Win32\..\..\UDKGame\Script\UTGame.u'
--------------------UTGameContent - Release--------------------
Analyzing...
Scripts successfully compiled - saving package 'C:\UDK\UDK-2010-05\Binaries\Win32\..\..\UDKGame\Script\UTGameConte nt.u'

Success - 0 error(s), 0 warning(s)
Execution of commandlet took: 12.82 seconds

[COMMANDLET 'UDK.exe make' SUCCEEDED] June 17, 12:11 PM

My Launch log has some warnings, but pretty sure they are insignificant for what I am trying to do:



Init: Version: 6699
Init: Epic Internal: 0
Init: Compiled (32-bit): May 20 2010 10:03:33
Init: Changelist: 536634
Init: Command line: test_level -log -norc -resx=1280 -resy=720 -Exec=UnrealFrontend_TmpExec.txt -DEFENGINEINI=..\..\UDKGame\Config\DefaultEngine.in i
Init: Base directory: C:\UDK\UDK-2010-05\Binaries\Win32\
DevConfig: GConfig::LoadFile associated file: ..\..\UDKGame\Config\UDKCompat.ini
[0000.13] Init: Computer: MANLYONE
[0000.13] Init: User: Adam
[0000.13] Init: CPU Page size=4096, Processors=4
[0000.13] Init: High frequency timer resolution =2.597675 MHz
[0000.13] Init: Memory total: Physical=3.0GB Pagefile=6.4GB Virtual=2.0GB
[0000.13] Log: STEAMWORKS initialized 0
[0000.13] Init: WinSock: version 1.1 (2.2), MaxSocks=32767, MaxUdp=65467
[0000.16] Init: WinSock: I am MANLYone (192.168.2.2:0)
[0000.16] Init: Presizing for 0 objects not considered by GC, pre-allocating 0 bytes.
[0000.16] Init: Object subsystem initialized
[0000.25] Init: OS stats:
[0000.25] Init: Windows 7
[0000.25] Init: RemoteDesktop=0
[0000.25] Init: Memory stats:
[0000.25] Init: Physical: 3069MB
[0000.25] Init: Virtual: 2047MB
[0000.25] Init: PageFile: 6568MB
[0000.25] Init: CPU stats:
[0000.25] Init: MeasuredPerformanceTime: 156.131 (stored result)
[0000.25] Init: Hyperthreaded: 0
[0000.25] Init: NumProcessorsPerCPU: 1
[0000.25] Init: NumLogicalProcessors: 4
[0000.26] Init: NumPhysicalProcessors: 4
[0000.26] Init: MaxSpeed: 2660
[0000.26] Init: CurrentSpeed: 2660
[0000.26] Init: CoresPerProcessor: 4
[0000.26] Init: IsOnBattery: 0
[0000.26] Init: BatteryLevel: -1
[0000.26] Init: Manufacturer: Intel
[0000.26] Init: CPUName: INTEL Pentium-III
[0000.26] Init: L1CacheSize: 32
[0000.26] Init: L2CacheSize: -1
[0000.26] Init: Architecture: x86
[0000.26] Init: GPU stats:
[0000.26] Init: VendorID: 00001002
[0000.26] Init: DeviceID: 00009501
[0000.27] Init: DriverVersion: 8.14.10.678
[0000.27] Init: DeviceName: ATI Radeon HD 3870
[0000.27] Init: DriverName: atiumdag.dll
[0000.27] Init: PixelShaderVersion: 3
[0000.27] Init: VertexShaderVersion: 3
[0000.27] Init: VRAMQuantity: 512
[0000.27] Init: DedicatedVRAM: 508
[0000.27] Init: AdapterCount: 2
[0000.27] Init: SupportsHardwareTnL: 1
[0000.27] Init: Machine detected compatibility level: Composite: 3. CPU: 5. GPU: 3.
[0000.27] Init: Previous detected compatibility level: Composite: 3. CPU: 5. GPU: 3.
[0000.51] Init: Initializing FaceFX...
[0000.51] Init: FaceFX 1.7.3.1 initialized.
[0002.48] Init: Finished loading startup packages in 1.87 seconds
[0002.50] Log: 76225 objects as part of root set at end of initial load.
[0002.50] Log: 0 out of 0 bytes used by permanent object pool.
[0002.50] Log: Initializing Engine...
[0002.56] Init: UEngine initialized
[0002.56] Log: Looking for DLC...
[0002.57] Init: XAudio2 using 'Speakers / Headphones (SigmaTel High Definition Audio CODEC)' : 2 channels at 44.1 kHz using 16 bits per sample (channel mask 0x3
)
[0002.67] Init: XAudio2Device initialized.
[0003.51] Init: Client initialized
[0018.87] Log: Steamworks is unavailable
[0018.92] Log: LoadMap: test_level?Name=Player?team=255
[0018.98] DevMemory: Virtual memory allocation size: 96.83 MByte (101531648 Bytes)
[0019.04] Log: Game class is 'UTGame'
[0021.06] Log: Primary PhysX scene will be in software.
[0021.07] Log: Creating Primary PhysX Scene.
[0021.07] Log: Bringing World test_level.TheWorld up for play (0) at 2010.06.17-12.02.38
[0021.08] Log: Bringing up level for play took: 2.040714
[0021.08] Error: (Function UTGame.UTGame:ChoosePlayerStart:0102) Cannot use AllNavigationPoints() here - NavigationPointList not set up yet
[0021.08] ScriptLog: Warning - PATHS NOT DEFINED or NO PLAYERSTART with positive rating
[0021.10] Error: (Function UTGame.UTHUDBase:PostBeginPlay:00F4) Cannot use AllNavigationPoints() here - NavigationPointList not set up yet
[0021.11] ScriptWarning: Accessed None 'MapInfo'
GFxMinimap Transient.GFxMinimapHud_0:GFxMinimap_0
Function UTGame.GFxMinimap:Init:00F1
[0021.11] Warning: Warning, The Outer object (Package GFxUTHud.Map) for 'GFxUTHud.map.jpg' couldn't be loaded [while loading package GFxUTHud]: Invalid linker i
ndex [couldn't load Package GFxUTHud.Map]?
[0021.12] Warning: Warning, Failed to load 'SwfMovie GFxUTHud.Map.jpg': Failed to find object 'SwfMovie GFxUTHud.Map.jpg'
[0021.12] Log: GFx attempted to load missing object [GFxUTHud.map.jpg]
[0021.12] Log: ########### Finished loading level: 2.206140 seconds
[0021.20] Init: Game engine initialized
[0021.20] Log: Initializing Engine Completed
[0021.20] Log: Execing ..\..\Binaries\UnrealFrontend_TmpExec.txt
[0026.11] Log: >>>>>>>>>>>>>> Initial startup: 26.11s <<<<<<<<<<<<<<<
[0026.12] ScriptLog: UTPlayerController::LoadSettingsFromProfile() - Not an Epic internal build, skipping setting profile settings.
[0026.21] Error: Can't start an online game that hasn't been created
[0026.21] ScriptLog: START MATCH
[0026.22] ScriptWarning: Accessed None 'MapInfo'
GFxMinimap Transient.GFxMinimapHud_0:GFxMinimap_0
Function UTGame.GFxMinimap:UpdateData:0015
[0029.06] Warning: Warning, Failed to load 'SwfMovie ?INT?GFxUI.IME.MoviePath?': Failed to find object 'SwfMovie ?INT?GFxUI.IME.MoviePath?'
[0029.06] Log: GFx attempted to load missing object [?INT?GFxUI.IME.MoviePath?]


All and any help is much appreciated. I'm not quite sure how to debug without getting some feedback from my scripts themselves. I am a web developer by trade so I know several languages, but this particular style of developing is obviously a bit different than my usual JavaScript, ActionScript and PHP. The code is familiar, but not the actual way I develop it. Once again help is appreciated.

eAlex79
06-17-2010, 01:34 PM
[0019.04] Log: Game class is 'UTGame'

Look, your class isn't used. And in your level is no PlayerStart.. :) What about reading some tutorials?

AdamCMills
06-17-2010, 01:52 PM
For anyone who may be running into the same issue I did above ... in the Editor you can go to View -> World Properties and set the 'Game Type for PIE' to your class ... I didn't realize this had to be done. I'm sure there is a way on the script side to do it, but I just did it from the editor and it works fine now. Still don't know why it says I don't have a player start when I do, eh well, Another problem for another day.

Thanks for your help eAlex, sorry if I was a bother. I was reading a tutorial, this one :)

I'll go find some more basic ones now, even though now that I have custom scripts running properly I feel inclined to just play with code.

eAlex79
06-17-2010, 02:15 PM
Playing with it is the best learning, look at the default*.ini's and at utgame.uc's game type decision code to learn more about when and then which game type is to be used.

UnrealmrK
06-17-2010, 05:34 PM
Whenever I try this tutorial it never works. I am using the newest build of UDK.

IronMan42
06-17-2010, 09:19 PM
Great tutorial man, got it working with the May UDK and this totally opened my eyes to how much can be done with these scripts.

Psilocybe
06-18-2010, 05:21 AM
Hi guys,

@Jorgeamaral, these scripts have no weapon functionality built in. I'm afraid that's up to you and the other tutorials out there.

@Adam, just keep plugging away, and you'll have it working in no time. You should definitely learn the ins and outs of the editor and compiling system though first.
I have a very strong feeling that your problem lies in how you've edited the ini files. Double check that portion, and then post your results.
Oh, and that is indeed the correct way to write the log function (there's plenty of sample code in the tutorial, too). It also seems as though you're trying to interface this with the UT code. I see the UDK trying to access a Scaleform HUD? I would recommend getting a more thorough grounding before doing the more advanced things like doing code mashups or Scaleform

@UnrealmrK, I'm really sorry, but I think I'll need a bit more info before I can help you with your problem. Go ahead and post back once you have a handle on what might be wrong (Did you read the prior posts? They have some good tips).

@eAlex79, Thanks for helping out around here, I never get enough time on the UDK forums!

And for the record, Game Type is set in DefaultGameUDK.ini, under DefaultGame and DefaultServer. The PlayerController is also set there under a very self-explanatory title.
Oh, and thank you IronMan, I'm glad it helps :D

And everyone, please tell me specifically about any typos or errors you encounter in the tutorial, even if you're able to work around them. I'll write them down and correct it so people don't have any more trouble.

Thanks and cheers!

UnrealmrK
06-18-2010, 01:29 PM
It works when I run the game in the editor but not when I compile it in front end.

gmcclelland
06-19-2010, 12:25 AM
Finally I can post!

This has worked perfectly for me, was as simple as a copy paste. Don't recall having any problems that needed fixing.

Great tutorial, and very well commented. This has helped me heaps.

I'm now attempting to get a gun in there and to be able to shoot. I've been looking through the UT and UDK classes to see what I need, but not having much luck. I followed some UDN tutorial that was posted in this thread on how to trace when I click and display the info of what I click on. Though the aim is quite off. I'm not the best at maths.

I've also added in slow motion that I found on another thread here to the shoulder cam, looking pretty snazzy I think. Can't wait to figure out the weapon attachments without having to use a UT class as that ruins my camera.

I don't see too many tutorials, or much information on doing this without the use of a UT class. This is only my 3rd day using UnrealScript though.

If anyone has some help on this, please post. :)

Once again, great job!

tnachen
06-21-2010, 01:45 AM
I have the may UDK, and I can't get it to work.

I have the files and copy and pasted the code, both ini changed.

When I launch the game, I cannot see my player (mesh not displayed) or gun to use, and it just becomes a free camera that can go anywhere.

No errors in the launch log though.

Do you know why this happens?

Poosh
06-29-2010, 11:55 PM
Very cool tutorial, it is very appreciated.

I was wondering how you would go about limiting the vertical rotation.. Currently you can look straight down on the players head, or look up from the floor, and I would like to restrict that movement slightly.

-- figured it out if anyone else was interested..
place within "YourPawn" within default properties.
ViewPitchMax = 5800;
ViewPitchMin = -4200;

Psilocybe
07-01-2010, 01:43 PM
Hi again guys,

@gmcclelland, Thanks for the compliments, and I agree, the slow motion looks really cool with this. Once I have some time, I'll be addressing the addition of weapons to really make this a bit more useful.

@tnachen, I'm sorry you're having trouble with it. Just to make sure, in your Game Info Class, the defaultproperties block contains the line "bDelayedStart=false" correct?

@Poosh, I'm glad it's working out. Thanks for the info about limiting camera pitch! That should come in very hand for a lot of people.

Cheers!

mikesdk
07-04-2010, 08:29 AM
Is there any way to make it so the thirdperson camera rotates around the player when no buttons are pressed, but snaps back behind when moving, like Mass Effect?

Francorider
07-08-2010, 07:53 AM
Let's get down to business!

I followed your instructions, but when I recompile it in Unreal Frontend, the following appears :
Warning/Error Summary
---------------------
D:\UDK\Development\Src\YourGame\Classes\YourGameCa mera.uc(41) : Error, 'CamOverridePostProcessAlpha': Bad command or expression
Can somebody please help me?

LazySnake61
07-08-2010, 07:58 PM
can i use the code for my non commercial project?credit will be given.

Psilocybe
07-08-2010, 08:37 PM
Hi Francorider,

It looks like you may have discovered an incompatibility with the June UDK. I suggest you comment out the lines of code involving CamOverridePostProcessAlpha, as I'm not sure if it was ever strictly necessary. That is, if you are using the June Beta as a I suspect.

Sure Snake, this isn't really anything revolutionary, but I appreciate that you thought of giving me credit. However, unless you include my comments, that probably wouldn't be necessary, as much of this is just copied from EPIC's code, or based on an idea from another tutorial. I wouldn't say no to a footnote though ;D

I'll try and get some time to update this to June and add some new stuff soon if I can.

Cheers!

theelder
07-13-2010, 09:42 AM
Thanks Psilocybe, great tut ;)
works smooth

pixelshaded
07-15-2010, 06:19 PM
Im using the June release and get this log:




[COMMANDLET 'UDK.exe make' STARTED IN ''] July 15, 6:17 PM

Init: Version: 6829
Init: Epic Internal: 0
Init: Compiled (32-bit): Jun 16 2010 16:03:16
Init: Command line: -DEFENGINEINI=..\..\UDKGame\Config\DefaultEngine.in i
Init: Base directory: C:\UDK\UDK-2010-06\Binaries\Win32\
Init: Character set: Unicode
Log: Executing Class UnrealEd.MakeCommandlet
--------------------Core - Release--------------------
Package Core has stripped source, recompiling
Warning, Failed to delete ..\..\UDKGame\Script\Core.u
Warning, Failed to delete ..\..\UDKGame\Script\Engine.u
Warning, Failed to delete ..\..\UDKGame\Script\GFxUI.u
Warning, Failed to delete ..\..\UDKGame\Script\GameFramework.u
Warning, Failed to delete ..\..\UDKGame\Script\UnrealEd.u
Warning, Failed to delete ..\..\UDKGame\Script\GFxUIEditor.u
Warning, Failed to delete ..\..\UDKGame\Script\IpDrv.u
Warning, Failed to delete ..\..\UDKGame\Script\OnlineSubsystemPC.u
Warning, Failed to delete ..\..\UDKGame\Script\OnlineSubsystemSteamworks.u
Warning, Failed to delete ..\..\UDKGame\Script\UDKBase.u
Warning, Failed to delete ..\..\UDKGame\Script\UTEditor.u
Warning, Failed to delete ..\..\UDKGame\Script\UTGame.u
Warning, Failed to delete ..\..\UDKGame\Script\UTGameContent.u
Analyzing...
Scripts successfully compiled - saving package 'C:\UDK\UDK-2010-06\Binaries\Win32\..\..\UDKGame\Script\Core.u'
Warning, DeleteFile was unable to delete 'C:\UDK\UDK-2010-06\Binaries\Win32\..\..\UDKGame\Script\Core.u', retrying... (GetLastE-r-r-o-r: 32)
Error, Error deleting file 'C:\UDK\UDK-2010-06\Binaries\Win32\..\..\UDKGame\Script\Core.u' (GetLastError: 32)
Warning, DeleteFile was unable to delete 'C:\UDK\UDK-2010-06\Binaries\Win32\..\..\UDKGame\Script\Core.u', retrying... (GetLastE-r-r-o-r: 32)
Error, Error deleting file 'C:\UDK\UDK-2010-06\Binaries\Win32\..\..\UDKGame\Script\Core.u' (GetLastError: 32)
Error, Error saving '..\..\UDKGame\Script\Core.u'
Package saving failed.

Warning/Error Summary
---------------------
Error, Error deleting file 'C:\UDK\UDK-2010-06\Binaries\Win32\..\..\UDKGame\Script\Core.u' (GetLastError: 32)
Error, Error saving '..\..\UDKGame\Script\Core.u'
Warning, Failed to delete ..\..\UDKGame\Script\Core.u
Warning, Failed to delete ..\..\UDKGame\Script\Engine.u
Warning, Failed to delete ..\..\UDKGame\Script\GFxUI.u
Warning, Failed to delete ..\..\UDKGame\Script\GameFramework.u
Warning, Failed to delete ..\..\UDKGame\Script\UnrealEd.u
Warning, Failed to delete ..\..\UDKGame\Script\GFxUIEditor.u
Warning, Failed to delete ..\..\UDKGame\Script\IpDrv.u
Warning, Failed to delete ..\..\UDKGame\Script\OnlineSubsystemPC.u
Warning, Failed to delete ..\..\UDKGame\Script\OnlineSubsystemSteamworks.u
Warning, Failed to delete ..\..\UDKGame\Script\UDKBase.u
Warning, Failed to delete ..\..\UDKGame\Script\UTEditor.u
Warning, Failed to delete ..\..\UDKGame\Script\UTGame.u
Warning, Failed to delete ..\..\UDKGame\Script\UTGameContent.u
Warning, DeleteFile was unable to delete 'C:\UDK\UDK-2010-06\Binaries\Win32\..\..\UDKGame\Script\Core.u', retrying... (GetLastE-r-r-o-r: 32)

Failure - 3 error(s), 15 warning(s)
Execution of commandlet took: 1.69 seconds

[COMMANDLET 'UDK.exe make' FAILED] July 15, 6:17 PM


I did add the edits to DefaultGameUDK and DefaultEngine config files as described by the tutorial. Im confused mainly because I know the script folder is read-only so why would it be trying to mess with it?

Sobez
07-15-2010, 07:31 PM
I copied the script to the letter and everything (replaying the Yourgame with my name) and i even got a perfect compile


[COMMANDLET 'UDK.exe make' STARTED IN ''] July 15, 5:28 PM

Init: Version: 6890
Init: Epic Internal: 0
Init: Compiled (32-bit): Jul 6 2010 15:57:03
Init: Command line: -DEFENGINEINI=..\..\UDKGame\Config\DefaultEngine.in i
Init: Base directory: C:\UDK\UDK-2010-07\Binaries\Win32\
Init: Character set: Unicode
Log: Executing Class UnrealEd.MakeCommandlet
--------------------Core - Release--------------------
--------------------Engine - Release--------------------
--------------------GFxUI - Release--------------------
--------------------GameFramework - Release--------------------
--------------------UnrealEd - Release--------------------
--------------------GFxUIEditor - Release--------------------
--------------------IpDrv - Release--------------------
--------------------OnlineSubsystemPC - Release--------------------
--------------------OnlineSubsystemSteamworks - Release--------------------
--------------------UDKBase - Release--------------------
--------------------UTEditor - Release--------------------
--------------------UTGame - Release--------------------
--------------------UTGameContent - Release--------------------
--------------------Unamed - Release--------------------
Package Unamed changed, recompiling
Analyzing...
Scripts successfully compiled - saving package 'C:\UDK\UDK-2010-07\Binaries\Win32\..\..\UDKGame\Script\Unamed.u'

Success - 0 error(s), 0 warning(s)
Execution of commandlet took: 6.74 seconds

[COMMANDLET 'UDK.exe make' SUCCEEDED] July 15, 5:28 PM


Only thing is that it doesn't work in game :(

pixelshaded
07-15-2010, 09:26 PM
i got it to compile once I added my folder to UDKEngine.ini as a ModEditPackages=YourGame

Blade[UG]
07-16-2010, 07:07 AM
pixelshaded,

You were running the game or editor at the time of your first error

DayanFernandez
07-16-2010, 07:44 PM
Okay i got it to compile and everything no error. Now only thing is once i play the game. It plays fine, but the player doesnt use the guns.

Im using the June release

blessenm
07-17-2010, 12:04 AM
Im eagerly waiting for the weapon tutorial. I really tried. Just cant get a hang of it. All tutorials use a different direction. UT classes are really overwhelming.

onurbz
07-19-2010, 08:47 PM
Analyzing...
C:\UDK\UDK-2010-06\Development\Src\SSCGame\Classes\SSC_GameInfo.uc (5) : Warning, ClassProperty Engine.GameInfo:PlayerControllerClass: unresolved reference to 'class 'SSC_Game.SSC_GamePlayerController''
C:\UDK\UDK-2010-06\Development\Src\SSCGame\Classes\SSC_GameInfo.uc (5) : Warning, Invalid property value in defaults: PlayerControllerClass = class 'SSC_Game.SSC_GamePlayerController'
C:\UDK\UDK-2010-06\Development\Src\SSCGame\Classes\SSC_GameInfo.uc (6) : Warning, ClassProperty Engine.GameInfo:DefaultPawnClass: unresolved reference to 'class 'SSC_Game.SSC_GamePawn''
C:\UDK\UDK-2010-06\Development\Src\SSCGame\Classes\SSC_GameInfo.uc (6) : Warning, Invalid property value in defaults: DefaultPawnClass = class 'SSC_Game.SSC_GamePawn'
Scripts successfully compiled - saving package 'C:\UDK\UDK-2010-06\Binaries\Win32\..\..\UDKGame\Script\SSCGame.u'

Warning/Error Summary
---------------------
C:\UDK\UDK-2010-06\Development\Src\SSCGame\Classes\SSC_GameInfo.uc (5) : Warning, ClassProperty Engine.GameInfo:PlayerControllerClass: unresolved reference to 'class 'SSC_Game.SSC_GamePlayerController''
C:\UDK\UDK-2010-06\Development\Src\SSCGame\Classes\SSC_GameInfo.uc (5) : Warning, Invalid property value in defaults: PlayerControllerClass = class 'SSC_Game.SSC_GamePlayerController'
C:\UDK\UDK-2010-06\Development\Src\SSCGame\Classes\SSC_GameInfo.uc (6) : Warning, ClassProperty Engine.GameInfo:DefaultPawnClass: unresolved reference to 'class 'SSC_Game.SSC_GamePawn''
C:\UDK\UDK-2010-06\Development\Src\SSCGame\Classes\SSC_GameInfo.uc (6) : Warning, Invalid property value in defaults: DefaultPawnClass = class 'SSC_Game.SSC_GamePawn'




Can you Help me?

blessenm
07-19-2010, 11:34 PM
Theese are all warnings. U should be ok. If u are using visual studio with nfringe, closing visual studio and opening again might get rid of the warnings.

onurbz
07-19-2010, 11:50 PM
I Cant Open UDK And map but when I press Play from here give a error message
-"Couldnīt Spawn player:Engine.GameMessage.FailedsPawnMessage"-


Sorry My English :D

Jaideng123
07-29-2010, 03:48 PM
any way i can bring weapons into this?

blessenm
08-05-2010, 06:48 AM
Can someone point me to a tutorial to create a weapon which will mix up with this tutorials code. I tried many weapon tutorials. Just cant get them to work with this tutorial.

Saishy
08-18-2010, 05:29 PM
This tutorial has been updated and is available here: http://www.disturbedprogrammer.com/index.php?option=com_content&view=article&id=54:third-person-camera-and-gow-camera&catid=43:geek-tutorials&Itemid=63

I'm currently looking for a way to show everything regards the user's resolution.
Thanks Psilocybe for this great tutorial!

blessenm
08-19-2010, 11:00 AM
if anyone was able to add a weapon to this code. It would be a great extension to this tutorial

Psilocybe
08-22-2010, 08:34 AM
Hi everyone, sorry I haven't been able to update this lately; Summer has been really busy for me. Hopefully I'll be able to get back in the saddle soon, though (Mmm, weapons...)!

@Saishy, Thanks for hosting, it looks great!

blessenm
08-22-2010, 09:22 AM
Psilocybe eagerly wating for the weapons addition. Tried a lot of things. Just cant crack it.

akiwitail
09-12-2010, 08:45 AM
Thanks for your tutorial Psilocybe. Managed to get your cam working perfectly.

I wonder what is the best approach to get a working crosshair(not the one from ClassicHUD) for the August release sdk?

Extending the player controller from UTPlayerController brings the crosshair back but kills the cam. Tried to find the function that draws the hud but failed miserably. :<

Using DrawHUD in customhud extended from uthud doesnt seems to work (but it might just be me).

Any suggestions pls?

PatHenry52
09-13-2010, 12:56 PM
Kiwi - I got a "drawn myself" crosshair that I just got working (right location, screen size independent) with the "reticle goes red when targeting another pawn" working as well.

I also have a weapon in hand (modeled myself, poorly.... kinda shocked that it looks as good as it does) as I know people were looking for this as well...

I'm at work, so I'll post those tonight if people are interested. It's fairly substantial code (probably way too big) and amateurish (as I just started looking at this stuff 6 weeks ago and have no spare time), but I can e-mail a zip or something or post it somewhere if somebody can send me instructions of where/how to do so.


MY question is this - Can someone explain to me how to control (limit, actually) the pawn's turning left/right so I don't have the gun pointed to the right and shooting sideways (in other words, lock the gun direction to always point to the view target/center screen)??? I'd love a good explanation of how the playercontroller, pawn, camera rotations are related to each other and how to direct them simply....
I messed around with the AnimAimleanoffset thingy, but it didn't seem to take changes either saving explicit values or affecting the dang pawn...

2nd question - How does one get projectiles to fire from the gun as if they were fired straight out of the barrel, not pulled around by the look control (right stick/mouse)??

PatHenry52
09-13-2010, 03:56 PM
See my response that follows in main thread...

PatHenry52
09-14-2010, 12:17 PM
I figured out my rotation issues - I was approaching it the wrong way, rather than muck with rotators, the solution was to set the Pawn variables

MaxLeanRoll
MaxAimYaw

This gave me the desired Pawn behaviors.

CoffeeGrunt
09-14-2010, 06:53 PM
This works awesome, and it's just what I needed for my project...

However how can I add the ability for my pawn to use weapons? I tried extending from UTPawn, but that disabled the camera rotation somehow, and I'd prefer not to use UT stock...

I tried looking into UTPawn, but I'm a newb so it's just reams of gobbldegook...

akiwitail
09-15-2010, 05:56 AM
It would be great if you can mail me a copy of code :)
I've sent you a private message.

Thanks.

Amin_it
09-21-2010, 09:20 AM
Realy Thanks:)

Mononoke
11-16-2010, 07:56 AM
Hey guys, new to this scripting thing, ive followed the tutorial perfectly, gone through the code and checked my folders, when i compile the code no errors or warnings when i then proceed to load up the game im still in first person can anyone help me with this problem. Thanks

dangerdex
11-16-2010, 07:18 PM
Thanks for the tutorial.

When I try to compile after completing the first part of the tutorial (before the extension section) I get the following warning under the heading --TestGame - Release--

Warning, Can't find files matching C:\UDK\UDK-2010-10\Binaries\Win32\..\..\Development\Src\TestGame\C lasses\*.uc

I poked around in and around the Binaries\Win32 directory and I can't even find a folder heirarchy that goes 2 more levels deep (which would account for the mystery \..\.. directory).

Anyone have any idea what's going wrong? I compile as a success with 0 errors and 1 warning but when I try to run Game - Unreal Development Kit again I get the same dialog saying my Scripts are out of date, asking me if I want to recompile.

b3vad
11-19-2010, 02:09 AM
Isn't "C lasses" wrong name for Classes folder?
check your naming with tutorial

Saishy
11-19-2010, 11:03 AM
Isn't "C lasses" wrong name for Classes folder?
check your naming with tutorial
That is a forum bug, his folder name is probably correct.

@Dangerdex

Development/src/
is not inside win32 folder.

It's saying you don't have any .uc files (unrealscripts) inside your project folder.

b3vad
11-28-2010, 08:00 AM
@Saishy
i got similar error today and the reason was : i removed my package folder with name UDN and didn't edit my defaultengine.ini to remove its name. check everything again to be sure maybe you used something like native code somewhere

Saishy
11-28-2010, 12:21 PM
@Saishy
i got similar error today and the reason was : i removed my package folder with name UDN and didn't edit my defaultengine.ini to remove its name. check everything again to be sure maybe you used something like native code somewhere
What? What error did I get?

Ferum
12-02-2010, 01:49 PM
Hello.
I've got a problem with getting this thing to work. When I start the game it doesn't spawn the player and the camera is stuck in one place, at PlayerStart actor. I can only look around level. What could be the possible cause of this?
Any help is appreciated.

EDIT: Also I got two warnings in Frontend.


D:\UDK\UDK-2010-09\Development\Src\Project_Medieval\Classes\Projec t_MedievalInfo.uc(5) : Warning, Unknown property in defaults: PlayerControlerClass = 'Project_Medieval.Project_MedievalPlayerController ' (looked in Project_MedievalInfo)
D:\UDK\UDK-2010-09\Development\Src\Project_Medieval\Classes\Projec t_MedievalInfo.uc(6) : Warning, Unknown property in defaults: DefautPawnClass = 'Project_Medieval.Project_MedievalPawn' (looked in Project_MedievalInfo)
I double-checked my Info script for any typos and couldn't find one.I don't know why it shows the warnings.

Saishy
12-02-2010, 02:30 PM
Hello.
I've got a problem with getting this thing to work. When I start the game it doesn't spawn the player and the camera is stuck in one place, at PlayerStart actor. I can only look around level. What could be the possible cause of this?
Any help is appreciated.

EDIT: Also I got two warnings in Frontend.


D:\UDK\UDK-2010-09\Development\Src\Project_Medieval\Classes\Projec t_MedievalInfo.uc(5) : Warning, Unknown property in defaults: PlayerControlerClass = 'Project_Medieval.Project_MedievalPlayerController ' (looked in Project_MedievalInfo)
D:\UDK\UDK-2010-09\Development\Src\Project_Medieval\Classes\Projec t_MedievalInfo.uc(6) : Warning, Unknown property in defaults: DefautPawnClass = 'Project_Medieval.Project_MedievalPawn' (looked in Project_MedievalInfo)
I double-checked my Info script for any typos and couldn't find one.I don't know why it shows the warnings.
Those two variables are wrong, the compiler don't know what they are or to what they refer.

Ferum
12-02-2010, 03:10 PM
I must be either blind or stupid. I didn't notice the typos in variables. Thanks a lot for your help.

h3ndy
12-02-2010, 04:02 PM
I must be either blind or stupid.
I go for both :D
Happens to me too

diogo_t
12-05-2010, 06:43 PM
Guys, i'm having some issues with the look Up and Down to aim.

The camera rotates Up and Down, but the Character torso and weapon don't follow the camera.

Someone knows why do this happen?!

I'll be very glad for some help. =D

diogo_t
12-21-2010, 03:11 PM
Guys, I realy need some help with this camera!

i'm realy sorry by flooding, but the post's very outdated.. nobody's gonna see it. And all the posts that i do takes a very long time to appear due the moderators. -.-"

Somebody help me pls! T.T

hellslayer
12-21-2010, 05:16 PM
Guys, i'm having some issues with the look Up and Down to aim.

The camera rotates Up and Down, but the Character torso and weapon don't follow the camera.

Someone knows why do this happen?!

I'll be very glad for some help. =D
This is because thats something the still needs to be reintregrated because this "start"-Gamecode works up from UDKGame instead of UTGame.
Its a really good start if you really want to understand how things work, because you have to look in many classes with the UT classes as referece

diogo_t
12-21-2010, 05:53 PM
@hellslayer

I already looked at all the references, but there's nothing that works with this kind of camera to do the character move the torso to aim.

To don't say that there's nothing, I found some codes that makes the character aim and fire again, but all of them are extended to the UTGame folder... so it unable some functions and add others that I don't want...

If somebody is using this camera and knows how to do that, pls tell me how.

I don't have anymore ideas to apply.

Thanks by the effort hellslayer =D

JaMeZwHiTe
12-21-2010, 05:55 PM
Hey guys,
Managed to get it working for me. I noticed there were some lines in the Pawn class that you can change the model to your own animated model. I changed the values to the animated model i have in the content browser but i still get that robot character after re-compiling....?

diogo_t
12-21-2010, 06:04 PM
Hey guys,
Managed to get it working for me. I noticed there were some lines in the Pawn class that you can change the model to your own animated model. I changed the values to the animated model i have in the content browser but i still get that robot character after re-compiling....?

Dude, do ur character move the torso to aim down and up? If yes, can u send me ur script? Because it's driving me crazy!!! :confused:

JaMeZwHiTe
12-21-2010, 06:24 PM
Dude, do ur character move the torso to aim down and up? If yes, can u send me ur script? Because it's driving me crazy!!! :confused:

No sorry i meant just the tutorial is working for me.

Can you not apply something similar to this for individual bone transforms:
http://forums.epicgames.com/showthread.php?t=734592&highlight=tutorial

I plan on looking through that to get my character's arm to aim where the mouse is moving.

But i cant even start that section until I get my custom character to even draw on screen lol, thats the problem i'm having.

JaMeZwHiTe
12-22-2010, 04:47 AM
Hey Diogo t, no i haven't got anything like that working, I can't my new animated character to replace the current robot character. I do however plan on applying something like in this post:
http://forums.epicgames.com/showthread.php?t=734592&highlight=tutorial

Would that accomplish what you are after? I plan on doing something similar to this post, If i pull it off, i'll let you know, does anyone know how to replace the character? I thought by replacing some values in the Pawn class would work but after re-compiling, there is no change.

diogo_t
12-22-2010, 07:41 PM
@JaMeZwHiTe (http://forums.epicgames.com/member.php?u=1413917)

I saw the tut that u've sand me, but there's nothing that I can apply. =/

I found a PDF file that I gess can help you. It solved a lot of problems that I've got creating my game. =D

Here's the link: Custom Player Character (Basic Tutorial) - Direct link to PDF (https://docs.google.com/fileview?id=0By91YmpSeg58NTZkOTNhMDctYWU4OC00Y2FhL TgxM2QtNmU1MzNlNzAzNThl&hl=en&pli=1)

Custom Player Character (Basic Tutorial) - Link to Forum (http://forums.epicgames.com/showthread.php?t=707685)

By the way, thanks for the helping try. =D

Ga2Z
12-23-2010, 06:53 PM
Hello.

I'm a noob and I have a lot of questions about this tutorial... I'm not a programmer so, I've been following the tu and got stucked, first, what program do you use to write the code? I used wordpad to create the .UC files and modify the .INIs, if there's something more "codefriendly" tell me please =)

and the problem I got is that I can't understand in the Ini modifying step:

"Around lines 5, 6 and 7,
DefaultGame=UTGame.UTDeathmatch
DefaultServerGame=UTGame.UTDeathmatch
PlayerControllerClassName=UTGame.UTPlayerControlle r
Change the first two entries to YourGame.YourGameInfo, and the third entry to YourGame.YourGamePlayerController."

he refers to the first two and the third entries, but I don't know what entries he refers to... and the lines he mentions don't match the lines I count...

I'm using the UDK version from september by the way, maybe this could be the problem as I've seen this tutorial is for a version earlier from april...

Thanks for your help

diogo_t
12-23-2010, 08:50 PM
@Ga2Z (http://forums.epicgames.com/member.php?u=1408619)

I'm using ConTEXT to edit the files with the apropriated Highlighter.

Here goes the links to download ConTEXT and its Highlighter for .uc files:

ConTEXT (http://www.contexteditor.org/)

Highlighter (http://wiki.beyondunreal.com/ConTEXT)

That Highlighter link already contains a little tutorial on how to install and use it.

To cook the game, look at the forum about configuring ur ConTEXT with UDK, it's very helpful. I don't have enough time to make a little tut now, but when I get it be sure i'm gonna do it. ^^

Enjoy =D

Ga2Z
12-26-2010, 09:09 PM
@diogo_t

Thank you very much for your help, a friend told me to use Visual studio with nFringe... but I'll give this one a try

diogo_t
12-27-2010, 11:22 AM
@Ga2Z (http://forums.epicgames.com/member.php?u=1408619)

You're welcome pal =D

BTW, if u are realy interested on scripting, try to use all the resources that u can find.
E.g.: ConTEXT, UnCodex, nFringe, Visual Studio and others.

Make a detailed search in the forum to see how many and what kind of tools u can use and the purpose of each one. =D

It helps a lot.

Ga2Z
12-28-2010, 10:07 PM
@diogo t

Well, I'm not really interested in scripting, but I guess I'll have to if I wanna to get this project done jajajaja I'm a designer but I'm getting some help from an engineer friend

PunchCardStudios
12-29-2010, 02:32 AM
Oooooooooooooook. I've come across a bit of a problem with my game. I'm building in Mobile, so I've copied across all of the animsets, trees, meshes and physics to make the mesh set up in the pawn, but when I go to load the game, it all compiles fine. But I get NO player character on the screen, just nothing, but then when you run into a wall, the camera halts a bit back from the wall, so the pawn object is being created, just nothing painted on it.

I was compiling previous to this and was coming across warnings stating that all of the assets for the Pawn couldn't be found, so I copy pasted them into the MobileGame/Content directory, and then using the content browser inside UDK, got the full names from there...



Begin Object Class=SkeletalMeshComponent Name=InitialSkeletalMesh
CastShadow=true
bCastDynamicShadow=true
bOwnerNoSee=false
LightEnvironment=MyLightEnvironment;
BlockRigidBody=true;
CollideActors=true;
BlockZeroExtent=true;
//What to change if you'd like to use your own meshes and animations
PhysicsAsset=PhysicsAsset'CH_AnimCorrupt.Mesh.SK_C H_Corrupt_Male_Physics'
AnimSets(0)=AnimSet'CH_AnimHuman.Anims.K_AnimHuman _AimOffset'
AnimSets(1)=AnimSet'CH_AnimHuman.Anims.K_AnimHuman _BaseMale'
AnimTreeTemplate=AnimTree'CH_AnimHuman_Tree.AT_CH_ Human'
End Object


That's the code used to build the mesh around the pawn, but it just doesn't display anything, any thoughts? Are the assets in the right place on my computer, I get the feeling that that might be the overall problem here. And I'm just derping.

PCS.

diogo_t
12-30-2010, 03:56 PM
@PunchCardStudios (http://forums.epicgames.com/member.php?u=1414149)

Mate, what version of UDK are you using? If its the december version, give up. It appeared a lot of troubles on this release. (that's my opinion)
Try using the november version or older.

To show the player, try to use this codes:

MyPawn:

That's the DefaultProperties i'm using on my camera. Just past it to override

DefaultProperties
{
Components.Remove(Sprite)
//Setting up the light environment
Begin Object Class=DynamicLightEnvironmentComponent Name=MyLightEnvironment
ModShadowFadeoutTime=0.25
MinTimeBetweenFullUpdates=0.2
AmbientGlow=(R=.01,G=.01,B=.01,A=1)
AmbientShadowColor=(R=0.15,G=0.15,B=0.15)
LightShadowMode=LightShadow_ModulateBetter
ShadowFilterQuality=SFQ_High
bSynthesizeSHLight=TRUE
End Object
Components.Add(MyLightEnvironment)
//Setting up the mesh and animset components

Begin Object Class=SkeletalMeshComponent Name=InitialSkeletalMesh
CastShadow=true
bCastDynamicShadow=true
bOwnerNoSee=false
LightEnvironment=MyLightEnvironment;
BlockRigidBody=true;
CollideActors=true;
BlockZeroExtent=true;
//What to change if you'd like to use your own meshes and animations
PhysicsAsset=PhysicsAsset'CH_AnimCorrupt.Mesh.SK_C H_Corrupt_Male_Physics'
AnimSets(0)=AnimSet'CH_AnimHuman.Anims.K_AnimHuman _AimOffset'
AnimSets(1)=AnimSet'CH_AnimHuman.Anims.K_AnimHuman _BaseMale'
AnimTreeTemplate=AnimTree'CH_AnimHuman_Tree.AT_CH_ Human'
SkeletalMesh=SkeletalMesh'CH_IronGuard_Male.Mesh.S K_CH_IronGuard_MaleA'
End Object
//Setting up a proper collision cylinder
Mesh=InitialSkeletalMesh;
Components.Add(InitialSkeletalMesh);
CollisionType=COLLIDE_BlockAll
Begin Object Name=CollisionCylinder
CollisionRadius=+0023.000000
CollisionHeight=+0050.000000
End Object
CylinderComponent=CollisionCylinder

// Crouch configuration
CrouchedPct=+0.4
CrouchHeight=45.0
CrouchRadius=25.0
bCanCrouch=true

// Limiting the view rotation
ViewPitchMax = 5800;
ViewPitchMin = -6200;
}

If it doesn't work at all, take to look at:
Allar's AWESOME Blog (http://forecourse.com/)

BTW, are you extending your Pawn from GamePawn or UTPawn? Make sure to extend it from GamePawn, just like this:


class YourGamePawn extends GamePawn;


@Ga2Z (http://forums.epicgames.com/member.php?u=1408619)

I found some tutorials that I guess can help u and ur friend. So, here you go:

- How to setup the visual studio 2010 to compile dll files (For save system and everything else) (http://forums.epicgames.com/showpost.php?p=27284974&postcount=3)

- How to set up the simple ConText editor (http://forums.epicgames.com/showpost.php?p=27021752&postcount=3)

Everything else can be found here:
Allar's AWESOME Blog (http://forecourse.com/)

Enjoy it. :D


-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Guys, all the questions in this post that i've done have been solved. So, don't worry about them. =D

CloDel Studios
12-30-2010, 08:29 PM
I got it working with Dec, after an hour of errors and warnings, could post my changes if anybody wants

diogo_t
12-30-2010, 08:46 PM
I got it working with Dec, after an hour of errors and warnings, could post my changes if anybody wants

It would be great, so we can see what's going on =D

Radex
02-15-2011, 04:08 PM
Thank you very much for this helpful tutorial it is the best camera / custom game tutorial I did. It worked fine since first compile (no errors).

I would like to ask you if it is possible to make the camera "orbit" the pawn if I press let's say middle mouse, or any key. I would like to orbit around my custom character to see it's animations from every angle, for example: I run with my character and I turn the camera, using middle mouse, to see it's face.

If anyone can help me on that with an example or something, I am a beginner in scripting.

Thank you again for this tutorial !!
Cheers!!

lethal_d0se
03-01-2011, 10:53 PM
Hey all, it's either too late in the day or I'm not seeing some important code.

My problem is that, after implementing the camera scripts (not the GOW camera), it compiles correctly and upon starting the PIE I am unable to pitch up or down.

I'm only able to zoom +- and rotate the camera.

Any idea's?

I do apologise if this has been corrected in a previous post and I'll just claim ignorance.

adinolfi
03-02-2011, 01:58 AM
I'm having some trouble using the February 2011 build as well. In my implementation, and I have done this before in previous builds without issues, I can't: scroll to zoom, use the over the shoulder function, and when I move the camera jumps around. I'm assuming there need to be some changes made but I'm not sure where to start. Anyone have any luck with this recently?

Judgement45
03-22-2011, 12:30 AM
Just wanted to say thanks for the Tutorial man it has been an invaluable tool for my project. Thanks for helping the beginners

Judgement45
03-22-2011, 12:39 AM
Hey adinolfi and lethal_dose. I was having similar issues and it turned out to be that my config files were not correctly setup. I just did this in the last few days.

Go into UDKGame config and make sure your
DefaultGame=YourProjectName.YourGameInfo DefaultServerGame=YourProjectName.YourGameInfo
then about 10 lines down
PlayerControllerClassName=YourProjectName.YourPlay erController

I know that seems simple but it was something I overlooked and it took me a little while to figure it out. Message me if that doesn't work and I will try to help find a solution.

Shirogr
03-31-2011, 08:57 PM
Hi.
I am using the January 2011 version of UDK and I have followed this tutorial. It works fine in the editor, but when I try to launch it through the front end, I get a simple camera, like in simple GameInfo mode in the editor. I can't see the player and nothing more than movement and collision works. I have made all the changes in the ini files and checked them twice.

Does anybody else has this problem? Any help?

Saishy
04-01-2011, 07:52 AM
Hi.
I am using the January 2011 version of UDK and I have followed this tutorial. It works fine in the editor, but when I try to launch it through the front end, I get a simple camera, like in simple GameInfo mode in the editor. I can't see the player and nothing more than movement and collision works. I have made all the changes in the ini files and checked them twice.

Does anybody else has this problem? Any help?
I don't know, it's probably look like your ini files are incorrectly.

The version of this tutorial at my site works with all versions of UDK, maybe take a look there.

Insipidus
04-02-2011, 10:28 PM
Thanks for the tutorial.

When I try to compile after completing the first part of the tutorial (before the extension section) I get the following warning under the heading --TestGame - Release--

Warning, Can't find files matching C:\UDK\UDK-2010-10\Binaries\Win32\..\..\Development\Src\TestGame\C lasses\*.uc

I poked around in and around the Binaries\Win32 directory and I can't even find a folder heirarchy that goes 2 more levels deep (which would account for the mystery \..\.. directory).

Anyone have any idea what's going wrong? I compile as a success with 0 errors and 1 warning but when I try to run Game - Unreal Development Kit again I get the same dialog saying my Scripts are out of date, asking me if I want to recompile.



I was just curious if anyone was able to figure out the resolution to this issue at all? I am having the same problem and cannot figure out what I need to do to resolve it. Any help would be greatly appreciated.

Thanks in advance for any input that anyone might have.

Saishy
04-04-2011, 01:10 AM
I was just curious if anyone was able to figure out the resolution to this issue at all? I am having the same problem and cannot figure out what I need to do to resolve it. Any help would be greatly appreciated.

Thanks in advance for any input that anyone might have.
Where are you guys compiling that?

It's a directory error, you are probably not declaring the full directory name of your folder and he is looking inside binaries/win32 because the udk.exe is there.

But there is not binaries/win32/development/src folder.

So if you have an incorrect folder name set or something like this "/MyProjectname" or "/Development/src" it might not work.
You have to declare the full name as "C:\Udk\Development\Src\_____"

colin2010
04-27-2011, 09:11 AM
has anyone got weapons to work for them any help be great thanks

Dvoyles
05-21-2011, 08:16 PM
Outstanding tutorial! This is definitely the best yet! It took me FOREVER to find this thing, but it works great. I've also resolved the debugging issues that others have listed above. To answer your questions:

When you receive the error about the components.remove <> do the following:
Remove "Components.Remove(Sprite)
Components.Remove(Sprite)" from the defaultProperties, and it should solve that issue.

As far as the issue with it searching through binaries and finding problems like "C lasses\*.uc" you need to do the following:

In the DefaultEngineUDK.ini file under your UDKGame/Config folder, go down to the area marked [UnrealEd.EditorEngine] and make it appear like so:


[UnrealEd.EditorEngine]
EditPackagesOutPath=..\..\UDKGame\Script
FRScriptOutputPath=..\..\UDKGame\ScriptFinalReleas e
+EditPackages=UDKBase
+EditPackages=UTEditor
AutoSaveDir=..\..\UDKGame\Autosaves
InEditorGameURLOptions=?quickstart=1?numplay=1

You are simply removing your MyMod (and I think there is another, MyGame perhaps?)

And I found that information in this thread: http://forums.epicgames.com/showthread.php?t=734732 It worked great for me.

Saishy
05-22-2011, 10:36 AM
Thanks for the help @Dvoyles

The updated tutorial can be found at my site: http://disturbedprogrammer.com/index.php?option=com_content&view=article&id=54:third-person-camera-and-gow-camera&catid=43:geek-tutorials&Itemid=63

Again, the author is still: Psilocybe (http://forums.epicgames.com/member.php?u=1392231)

Dvoyles
05-24-2011, 08:02 PM
I'm having difficulty creating either an isometric or side scrolling camera. I've added a case to the YourGameCamera class, just as it appears for the other cases:



case 'ThirdPerson' : //Enters here as long as CameraStyle is still set to ThirdPerson
case 'IsometricCam' : //Isometric camera
case 'ShoulderCam' : //Side Scrolling Camera for Mega Man 2
case 'FreeCam' :

if (CameraStyle == 'IsometricCam') // A basic if statement
{
/*Rot.pitch = -10000;*/
/*Rot.yaw = -5500; With these two statements, we're telling the camera to stay fixed at these rotation values, provided by rahatropa */
Rot = PCOwner.Owner.Rotation;
TargetZ = 300;
TargetFOV = 90.f;
TargetOffset = 100;
FreeCamDistance = 64;


I've made the same binding changes for Z to be my button for IsometricCam, just as we did for the ShoulderCam. The ShoulderCam continues to work fine.


Bindings=(Name="LeftShift",Command="ShoulderCam | OnRelease ReturnCam")
Bindings=(Name="Z",Command="IsometricCam | OnRelease ReturnCam")

When I go to press Z however, my camera goes into my character, and remains stuck there. What should I add to correct this?

Saishy
05-24-2011, 08:09 PM
I'm having difficulty creating either an isometric or side scrolling camera. I've added a case to the YourGameCamera class, just as it appears for the other cases:



case 'ThirdPerson' : //Enters here as long as CameraStyle is still set to ThirdPerson
case 'IsometricCam' : //Isometric camera
case 'ShoulderCam' : //Side Scrolling Camera for Mega Man 2
case 'FreeCam' :

if (CameraStyle == 'IsometricCam') // A basic if statement
{
/*Rot.pitch = -10000;*/
/*Rot.yaw = -5500; With these two statements, we're telling the camera to stay fixed at these rotation values, provided by rahatropa */
Rot = PCOwner.Owner.Rotation;
TargetZ = 300;
TargetFOV = 90.f;
TargetOffset = 100;
FreeCamDistance = 64;


I've made the same binding changes for Z to be my button for IsometricCam, just as we did for the ShoulderCam. The ShoulderCam continues to work fine.


Bindings=(Name="LeftShift",Command="ShoulderCam | OnRelease ReturnCam")
Bindings=(Name="Z",Command="IsometricCam | OnRelease ReturnCam")

When I go to press Z however, my camera goes into my character, and remains stuck there. What should I add to correct this?
Could you post your whole binding file and the IsometricCam and ReturnCam functions?

Dvoyles
05-24-2011, 08:33 PM
Sure thing! The only alterations I have made from the code in this tutorial, is the addition above.



class YourGameCamera extends Camera;

// initializing static variables
var float Dist;
var float TargetFOV;
var float TargetZ;
var float Z;
var float TargetOffset;
var float Offset;
var float pival;

DefaultProperties
{
FreeCamDistance = 256.f
pival = 3.14159;
}


function UpdateViewTarget(out TViewTarget OutVT, float DeltaTime)
{
//Declaring local variables
local vector Loc, Pos, HitLocation, HitNormal;
local rotator Rot;
local Actor HitActor;
local CameraActor CamActor;
local bool bDoNotApplyModifiers;
local TPOV OrigPOV;

// store previous POV, in case we need it later
OrigPOV = OutVT.POV;

// Default FOV on viewtarget
OutVT.POV.FOV = DefaultFOV;

// Viewing through a camera actor.
CamActor = CameraActor(OutVT.Target);
if( CamActor != None )
{
CamActor.GetCameraView(DeltaTime, OutVT.POV);

// Grab aspect ratio from the CameraActor.
bConstrainAspectRatio = bConstrainAspectRatio || CamActor.bConstrainAspectRatio;
OutVT.AspectRatio = CamActor.AspectRatio;

// See if the CameraActor wants to override the PostProcess settings used.
CamOverridePostProcessAlpha = CamActor.CamOverridePostProcessAlpha;
CamPostProcessSettings = CamActor.CamOverridePostProcess;
}
else
{
// Give Pawn Viewtarget a chance to dictate the camera position.
// If Pawn doesn't override the camera view, then we proceed with our own defaults
if( Pawn(OutVT.Target) == None ||
!Pawn(OutVT.Target).CalcCamera(DeltaTime, OutVT.POV.Location, OutVT.POV.Rotation, OutVT.POV.FOV) )
{
// don't apply modifiers when using these debug camera modes.
bDoNotApplyModifiers = TRUE;

switch(CameraStyle)
{
case 'Fixed' : // No update, keeps previous view
OutVT.POV = OrigPOV;
break;
case 'ThirdPerson' : //Enters here as long as CameraStyle is still set to ThirdPerson
case 'IsometricCam' : //Isometric camera
case 'ShoulderCam' : //Side Scrolling Camera for Mega Man 2
case 'FreeCam' :



Loc = OutVT.Target.Location; // Setting the camera location and rotation to the viewtarget's
Rot = OutVT.Target.Rotation;

if (CameraStyle == 'ThirdPerson')
{
Rot = PCOwner.Rotation; //setting the rotation of the camera to the rotation of the pawn
TargetZ = 0;
TargetFOV = 90;
TargetOffset = 0;
}

if (CameraStyle == 'IsometricCam') // A basic if statement
{
/*Rot.pitch = -10000;*/
/*Rot.yaw = -5500; With these two statements, we're telling the camera to stay fixed at these rotation values, provided by rahatropa */
Rot = PCOwner.Owner.Rotation;
TargetZ = 300;
TargetFOV = 90.f;
TargetOffset = 100;
FreeCamDistance = 64;

}

if (CameraStyle == 'ShoulderCam')
{
Rot = PCOwner.Rotation;
FreeCamDistance = 64;
TargetFOV = 60.f;
TargetZ = 32;
TargetOffset = 32;
}

//OutVT.Target.GetActorEyesViewPoint(Loc, Rot);

if(CameraStyle == 'FreeCam')
{
Rot = PCOwner.Rotation;
}

Loc += FreeCamOffset >> Rot;
Loc.Z += Z; // Setting the Z coordinate offset for shoulder view

//Linear interpolation algorithm. This is the "smoothing," so the camera doesn't jump between zoom levels
if (Dist != FreeCamDistance)
{
Dist = Lerp(Dist,FreeCamDistance,0.15); //Increment Dist towards FreeCamDistance, which is where you want your camera to be. Increments a percentage of the distance between them according to the third term, in this case, 0.15 or 15%
}
if (Z != TargetZ)
{
Z = Lerp(Z,TargetZ,0.1);
}
if (DefaultFOV != TargetFOV)
{
DefaultFOV = Lerp(DefaultFOV,TargetFOV,0.1);
}
if (Offset != TargetOffset)
{
Offset = Lerp(Offset,TargetOffset,0.1);
}

Pos = Loc - Vector(Rot) * Dist; /*Instead of using FreeCamDistance here, which would cause the camera to jump by the entire increment, we use Dist, which increments in small steps to the desired value of FreeCamDistance using the Lerp function above*/
// Setting the XY camera offset for shoulder view
Pos.X += Offset*sin(-Rot.Yaw*pival*2/65536);
Pos.Y += Offset*cos(Rot.Yaw*pival*2/65536);
// @fixme, respect BlockingVolume.bBlockCamera=false

//This determines if the camera will pass through a mesh by tracing a path to the view target.
HitActor = Trace(HitLocation, HitNormal, Pos, Loc, FALSE, vect(12,12,12));
//This is where the location and rotation of the camera are actually set
OutVT.POV.Location = (HitActor == None) ? Pos : HitLocation;
OutVT.POV.Rotation = Rot;

break; //This is where our code leaves the switch-case statement, preventing it from executing the commands intended for the FirstPerson case.

case 'FirstPerson' : // Simple first person, view through viewtarget's 'eyes'
default : OutVT.Target.GetActorEyesViewPoint(OutVT.POV.Locat ion, OutVT.POV.Rotation);
break;

}
}
}

if( !bDoNotApplyModifiers )
{
// Apply camera modifiers at the end (view shakes for example)

ApplyCameraModifiers(DeltaTime, OutVT.POV);
}
//`log( WorldInfo.TimeSeconds @ GetFuncName() @ OutVT.Target @ OutVT.POV.Location @ OutVT.POV.Rotation @ OutVT.POV.FOV );
}





class YourGamePlayerController extends GamePlayerController;

var float PreDist; //tore our previous camera distance so that when we switch back to the normal camera, we'll be at our original setting.

simulated event PostBeginPlay() //This event is triggered when play begins
{
super.PostBeginPlay();
`Log("I am alive!"); //This sends the message "I am alive!" to thelog (to see the log, you need to run UDK with the -log switch)
}

//Functions for zooming in and out
exec function NextWeapon() /*The "exec" command tells UDK that this function can be called by the console or keybind.
We'll go over how to change the function of keys later (if, for instance, you didn't want you use the scroll wheel, but page up and down for zooming instead.)*/
{
if (PlayerCamera.FreeCamDistance < 512) //Checks that the the value FreeCamDistance, which tells the camera how far to offset from the view target, isn't further than we want the camera to go. Change this to your liking.
{
`Log("MouseScrollDown"); //Another log message to tell us what's happening in the code
PlayerCamera.FreeCamDistance += 64*(PlayerCamera.FreeCamDistance/256); /*This portion increases the camera distance.
By taking a base zoom increment (64) and multiplying it by the current distance (d) over 256, we decrease the zoom increment for when the camera is close,
(d < 256), and increase it for when it's far away (d > 256).
Just a little feature to make the zoom feel better. You can tweak the values or take out the scaling altogether and just use the base zoom increment if you like */
}
}

exec function PrevWeapon()
{
if (PlayerCamera.FreeCamDistance > 64) //Checking if the distance is at our minimum distance
{
`Log("MouseScrollUp");
PlayerCamera.FreeCamDistance -= 64*(PlayerCamera.FreeCamDistance/256); //Once again scaling the zoom for distance
}
}

DefaultProperties
{
CameraClass=class 'YourGameCamera' //Telling the player controller to use your custom camera script
DefaultFOV=90.f //Telling the player controller what the default field of view (FOV) should be
}

exec function ShoulderCam() // Declaring our ShoulderCam function that we bound to
{
`Log("Shoulder Camera"); // Yet another log...
PreDist = PlayerCamera.FreeCamDistance; //Storing our previous camera distance...
YourGameCamera(PlayerCamera).CameraStyle = 'ShoulderCam'; //Type casting our camera script to access the variable CameraStyle
}

exec function ReturnCam() //This is called on release of left shift
{
`Log("Main Camera");
PlayerCamera.FreeCamDistance = PreDist; // Restoring the previous camera distance
YourGameCamera(PlayerCamera).CameraStyle = 'ThirdPerson'; // Restoring the previous camera style
}





class YourGameInfo extends GameInfo; //This line tells UDK that you want to inherit all of the functionality of GameInfo.uc, and< add your own. The name after "class" must match the file name.
DefaultProperties //Self explanatory
{
bDelayedStart = false
PlayerControllerClass = class 'YourGame.YourGamePlayerController' //Setting the Player Controller to your custom script
DefaultPawnClass = class 'YourGame.YourGamePawn' //Setting the Pawn to your custom script
}





class YourGamePawn extends GamePawn; //Again, naming conventions apply here. Your script is extending the UDK script
//This lets the pawn tell the PlayerController what Camera Style to set the camera in initially (more on this later).
simulated function name GetDefaultCameraMode(PlayerController RequestedBy)
{
return 'ThirdPerson';
}

DefaultProperties
{

//Setting up the light environment
Begin Object Class=DynamicLightEnvironmentComponent Name=MyLightEnvironment
ModShadowFadeoutTime=0.25
MinTimeBetweenFullUpdates=0.2
AmbientGlow=(R=.01,G=.01,B=.01,A=1)
AmbientShadowColor=(R=0.15,G=0.15,B=0.15)
LightShadowMode=LightShadow_ModulateBetter
ShadowFilterQuality=SFQ_High
bSynthesizeSHLight=TRUE
End Object
Components.Add(MyLightEnvironment)
//Setting up the mesh and animset components
Begin Object Class=SkeletalMeshComponent Name=InitialSkeletalMesh
CastShadow=true
bCastDynamicShadow=true
bOwnerNoSee=false
LightEnvironment=MyLightEnvironment;
BlockRigidBody=true;
CollideActors=true;
BlockZeroExtent=true;
//What to change if you'd like to use your own meshes and animations
PhysicsAsset=PhysicsAsset'CH_AnimCorrupt.Mesh.SK_C H_Corrupt_Male_Physics'
AnimSets(0)=AnimSet'CH_AnimHuman.Anims.K_AnimHuman _AimOffset'
AnimSets(1)=AnimSet'CH_AnimHuman.Anims.K_AnimHuman _BaseMale'
AnimTreeTemplate=AnimTree'CH_AnimHuman_Tree.AT_CH_ Human'
SkeletalMesh=SkeletalMesh'CH_LIAM_Cathode.Mesh.SK_ CH_LIAM_Cathode'
End Object
//Setting up a proper collision cylinder
Mesh=InitialSkeletalMesh;
Components.Add(InitialSkeletalMesh);
CollisionType=COLLIDE_BlockAll
Begin Object Name=CollisionCylinder
CollisionRadius=+0023.000000
CollisionHeight=+0050.000000
End Object
CylinderComponent=CollisionCylinder

inxamii
05-26-2011, 10:20 PM
helo man, I just loved this tutorial, work perfectly, BUT, just one single problem, there is no sound effects in the game, no matter what I do, I got nothing, can you help me? I don't know what to do. thanks man. (only with the "GOW mode" I have no sound problems with the others scripts)

Saishy
05-26-2011, 10:32 PM
@Dvoyles

What is this supposed to mean?


Rot = PCOwner.Owner.Rotation;

Also, missing your input bindings.

www1313
06-10-2011, 04:30 AM
Great tutorial,but i get one trouble

http://i1137.photobucket.com/albums/n509/www1313/y1.png

no error , no warning but can not start UDK game please anyone help me :D

Saishy
06-10-2011, 01:19 PM
When that happens is either an error in some .ini files or some asset.

I would bet on the .ini file.

www1313
06-11-2011, 03:03 PM
When that happens is either an error in some .ini files or some asset.

I would bet on the .ini file.

thank you!! , i did it :D

Pete_Bottomley
06-21-2011, 10:09 AM
Hey guys,

First of all thank you so much to Psilocybe for putting such a great tutorial together. So intuative and easy to follow.

For those asking about the weapons I think I figured it... to an extent. I've not managed to be able to extend the deathmatch stuff so that you can pick up items and weapons but you can give the player a weapon to start off with. I tried the default inventary property but that didnt work for me.

Instead I added a weapon class and a inventory management class. Here you can assign a weapon to your player.

To set up these classes there is a brilliant and in-depth tutorial from Mougli which you can find here
http://www.moug-portfolio.info/index.php?page=weapons---basics

I also extended my Pawn from UDKPawn and PlayerController from UDKPlayerController, hope this helps some people out. Couldnt have done it without Mougli and Psilocybe, thanks for the great help guys!

Pete

Disheveled Zen
07-06-2011, 10:24 PM
Hey guys, first off great tutorial. I had originally been using the quick kismet approach but this one suits my game needs far more.

I have a few problems, or moreso questions I was wondering about.

Like an above poster I seem to have 0 sound when running in this game mode. I tried finding where sounds are referenced but was unable. If anyone has a way to fix this or a link on how sounds work in UDK that would be great.

Secondly based on the following line -


case 'FirstPerson' : // Simple first person, view through viewtarget's 'eyes'
default : OutVT.Target.GetActorEyesViewPoint(OutVT.POV.Locat ion, OutVT.POV.Rotation);
break;

I assume that scrolling in should bring it into first person. Yet my camera just moved to the back of the pawn. Wondering if this needs to be flushed out further to go seamlessly into first person.

Also I am wondering if it is possible to make it so that the camera can be moved independently of the character by holding down the right mouse button (similar to how you do a camera rotate in an MMO)

Pretty new to scripting and am looking to learn more than just be told how to do it so if anyone knows of tutorials I can combine with this one to increase what it can do it would be appreciated and also how to fix the sound issue.

crunx
07-12-2011, 12:57 AM
Dvolyles, you must have an exec function related to that isometric cam so it would look something like this in your camera: (look for anything with Isometric in it)


case 'ThirdPerson' : //Enters here as long as CameraStyle is still set to ThirdPerson
case 'FreeCam' :
case 'ShoulderCam' : // Over the shoulder view
case 'IsometricCam' : //iso mode

Loc = OutVT.Target.Location; // Setting the camera location and rotation to the viewtarget's
Rot = OutVT.Target.Rotation;

if (CameraStyle == 'ThirdPerson')
{
Rot = PCOwner.Rotation; //setting the rotation of the camera to the rotation of the pawn
TargetZ = 0;
TargetFOV = 90;
TargetOffset = 0;
}

if (CameraStyle == 'ShoulderCam')
{
Rot = PCOwner.Rotation;
FreeCamDistance = 64;
TargetFOV = 60.f;
TargetZ = 32;
TargetOffset = 32;
}

if (CameraStyle == 'IsometricCam')
{
Rot.pitch = -10000;
Rot.yaw = -5500; // With these two statements, we're telling the camera to stay fixed at these rotation values, provided by rahatropa


}

and you MUST put this in your player controller


exec function CommandCam() //This is called on release of left shift
{
`Log("Command Mode");
PlayerCamera.FreeCamDistance = PreDist; // Restoring the previous camera distance
PRCamera(PlayerCamera).CameraStyle = 'IsometricCam'; // Restoring the previous camera style
}
Let me know how your codes go!

Then your key binding will be able to work. Thank you for the script OP it was an incredible help for my camera troubles!

ChrisDodge
08-21-2011, 09:08 AM
Works so far with a couple of warnings considering envirnoment something and what not. :D Now I'll try the over the shoulder type. After I get some sleep. I dont know how to start with weapons tho. :P

The
DefaultInventory(0)=class'UTGame.UTWeap_LinkGun' doesnt do anything for me. :P

Dambob
08-28-2011, 11:53 AM
Does anyone here have Custom Gametypes working with the August 2011 version of Frontend?

For some reason I can't get it to work the way I did before (I recently updated from the December 2010 version.)

malarr
09-04-2011, 12:34 AM
Has this been tested with the newer version of UDK such as the Aug or July versions

crunx
09-04-2011, 09:37 PM
This still works even in the August build! I know because I currently use this perfect code! But I was wondering if anyone has figured out how to rotate the pawn, I've been trying different methods but I cannot seem to get it right so that when you right click the "camera" follows you and not the pawn (but the camera is restricted to the pawn) so basically the camera can go in a circle around the pawn!


If anyone has any idea that would help alot!

anthonymcgrath
09-06-2011, 11:22 AM
hey guys
I got the august build, have copy and pasted this tutorial (except i haven't created a game content folder... just the YOURGAME folder and the 4 .uc class files in the classes folder)

....but I cant find this "UDK launcher" thats mentioned.

so i try to jump into the UDK Game and it says "scripts outdated... build now?"

I hit okay and it builds with a few small yellow warnings but otherwise okay.

i then jump back into UDK game again, hit instant action and start a game but i dont have a 3rd person camera. Can anyone advise me what i'm doing wrong please? Its really butchering my head :/


ta
ant

anthonymcgrath
09-06-2011, 11:45 AM
edit - I used the unreal frontend exe then cloned DM-Deck, renamed it to ANT_COMPILE then replaced the "map to cook" with my ant_test_level.udk level (which basically spawns a deathmatch bot that tries to kill me and plonks us both on the top of a box with a tree for reference!). That seemed to cook successfully and load up in the udk game as a selectable level.

I wasn't seeing my character that i control in 3rd person camera though even when i pressed the shift key :(

unexpected bonus of seeing my character run around too (altho it crashed a moment or two later) as i pointed the UTpawn to my character earlier on today :)

graphel
09-29-2011, 04:09 AM
Good tutorial! I am having a problem though, I followed the whole thing to the letter, and when I press shift to go o the over the shoulder mode, nothing happens. It seems that after editing both defaultinput.ini and UDKinput.ini the shift button is still used for the walk/run control. Any ideas? I am using the September beta btw :)

graphel
09-29-2011, 05:40 AM
Nvm, I got it :P works perfectly btw! One question though, is there a way to have the camera be able to rotate the pawn when the "aim" key is not being pressed?

anthonymcgrath
09-29-2011, 09:31 AM
Nvm, I got it :P works perfectly btw! One question though, is there a way to have the camera be able to rotate the pawn when the "aim" key is not being pressed?

can you share please?! I'm still struggling to get the gow camera to work :mad:

graphel
09-29-2011, 01:29 PM
I am not actually what was keeping the gow camera from working. I just created fresh .uc files and copied the provided code again, and had no problems... Sorry to not be of much help, I would post my code, but it is exactly the same as what was originally posted. The only bit I changed was in the Pawn.uc. Everything for the "MyLightClass" was being rejected when I compiled the code.

anthonymcgrath
10-04-2011, 01:15 PM
I've run through this to the letter again and i still cant get the GOW camera to work.

the only things different are my skeletal mesh, my animSet and my animTree which point to my own package file with my assets.

anthonymcgrath
10-05-2011, 06:31 AM
hey guys
please please please help with this - i've completely redone the scripts from scratch. When i recook and play my level i can see i'm spawning a default UDKgame robot pawn so i'm assuming i am also one of those. BUT that CAMERA simply WILL NOT switch to over the shoulder - pressing left shift key does nothing - even pressing TAB for command line entry and entering the words ShoulderCam and ThirdPerson do nothing. The strange thing is if i type those commands they should appear (auto-complete) but they dont?

Please please help I really am at my wits end now with this - i thought it might have been down to me using my own custom character, animset and animtree but those all seem to have worked fine clearly as this issue is still the same with the default UDK pawn robot. :(

Rico21745
12-13-2011, 11:33 AM
When working with third person cameras, there are different approaches to build them, depending on whether you inherit from UTPawn or UDKPawn. This is likely your problem.

Deadwalking12345
01-10-2012, 08:41 PM
I have this problem and not exactly sure what to do with the new scripts:



[0001.71] Init: Version: 9140
[0001.71] Init: Epic Internal: 0
[0001.71] Init: Compiled (64-bit): Nov 22 2011 17:03:01
[0001.71] Init: Command line:
[0001.71] Init: Base directory: C:\UDK\UDK-2011-11\Binaries\Win64\
[0001.71] Init: Character set: Unicode
[0001.71] Log: Executing Class UnrealEd.MakeCommandlet
[0001.85] --------------------Core - Release--------------------
[0001.89] --------------------Engine - Release--------------------
[0003.37] --------------------GFxUI - Release--------------------
[0003.44] --------------------GameFramework - Release--------------------
[0003.73] --------------------UnrealEd - Release--------------------
[0003.87] --------------------GFxUIEditor - Release--------------------
[0003.88] --------------------IpDrv - Release--------------------
[0004.06] --------------------OnlineSubsystemPC - Release--------------------
[0004.16] --------------------OnlineSubsystemSteamworks - Release--------------------
[0004.32] --------------------OnlineSubsystemGameCenter - Release--------------------
[0004.51] --------------------UDKBase - Release--------------------
[0004.86] --------------------UTEditor - Release--------------------
[0004.87] --------------------UTGame - Release--------------------
[0008.21] --------------------UTGameContent - Release--------------------
[0008.45] --------------------YourGame - Release--------------------
[0008.45] Warning, Can't find files matching C:\UDK\UDK-2011-11\Binaries\Win64\..\..\Development\Src\YourGame\C lasses\*.uc
[0008.52]
[0008.52] Warning/Error Summary
[0008.52] ---------------------
[0008.53] Warning, Can't find files matching C:\UDK\UDK-2011-11\Binaries\Win64\..\..\Development\Src\YourGame\C lasses\*.uc
[0008.53]
[0008.53] Success - 0 error(s), 1 warning(s)
[0008.53]
Execution of commandlet took: 6.82 seconds

mind givin a little more help? TY 4 posting this tutorial :D

Dead Fenix
01-14-2012, 10:03 PM
Where can find tutorial about create Lens Effects for blood (like GeOW), water or dirt?

Keyeszx
03-10-2012, 03:50 PM
Where do I go to compile the script?

Snufkin
05-25-2012, 04:03 PM
Hello. is there anyway to get the pawn to follow the camera vertically?

ceora
05-26-2012, 04:10 AM
can you make an RPG (orbit camera) style tutorial?? please :D

McTune
05-26-2012, 04:55 PM
can you make an RPG (orbit camera) style tutorial?? please :D

Youll need to add this to player controller

state PlayerWalking
{
ignores SeePlayer, HearNoise, Bump;

event NotifyPhysicsVolumeChange( PhysicsVolume NewVolume )
{
if ( NewVolume.bWaterVolume && Pawn.bCollideWorld )
{
GotoState(Pawn.WaterMovementState);
}
}

function ProcessMove(float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot)
{
if( Pawn == None )
{
return;
}

if (Role == ROLE_Authority)
{
// Update ViewPitch for remote clients
Pawn.SetRemoteViewPitch( Rotation.Pitch );
}

Pawn.Acceleration = NewAccel;
CheckJumpOrDuck();
}

function PlayerMove( float DeltaTime )
{
local vector X,Y,Z, NewAccel;
local eDoubleClickDir DoubleClickMove;
local bool bSaveJump;
local Rotator DeltaRot, ViewRotation, OldRot, NewRot;;


if( Pawn == None )
{
GotoState('Dead');
}
else
{
GetAxes(Rotation,X,Y,Z);

//update viewrotation
ViewRotation = Rotation;
// Calculate Delta to be applied on ViewRotation
DeltaRot.Yaw = PlayerInput.aTurn;
DeltaRot.Pitch = PlayerInput.aLookUp;
ProcessViewRotation( DeltaTime, ViewRotation, DeltaRot );
SetRotation(ViewRotation);

// Update acceleration.
NewAccel = PlayerInput.aForward*X + PlayerInput.aStrafe*Y;
NewAccel.Z = 0;
// pawn face newaccel direction //

//===
OldRot = Pawn.Rotation;
if( Pawn != None )
{
if( NewAccel.X > 0.0 || NewAccel.X < 0.0 || NewAccel.Y > 0.0 || NewAccel.Y < 0.0 )
NewRot = Rotator(NewAccel);
else
NewRot = Pawn.Rotation;
}
Pawn.FaceRotation(RInterpTo(OldRot,NewRot,Deltatim e,90000,true),Deltatime);
//===

NewAccel = Pawn.AccelRate * Normal(NewAccel);
DoubleClickMove = PlayerInput.CheckForDoubleClickMove( DeltaTime/WorldInfo.TimeDilation );
bDoubleJump = false;

if( bPressedJump && Pawn.CannotJumpNow() )
{
bSaveJump = true;
bPressedJump = false;
}
else
{
bSaveJump = false;
}

ProcessMove(DeltaTime, NewAccel, DoubleClickMove,Rotation);

bPressedJump = bSaveJump;
}
}

event BeginState(Name PreviousStateName)
{
DoubleClickDir = DCLICK_None;
bPressedJump = false;
GroundPitch = 0;
if ( Pawn != None )
{
Pawn.ShouldCrouch(false);
if (Pawn.Physics != PHYS_Falling && Pawn.Physics != PHYS_RigidBody) // FIXME HACK!!!
Pawn.SetPhysics(PHYS_Walking);
}
}

event EndState(Name NextStateName)
{
GroundPitch = 0;
if ( Pawn != None )
{
Pawn.SetRemoteViewPitch( 0 );
if ( bDuck == 0 )
{
Pawn.ShouldCrouch(false);
}
}
}

Begin:
}

ceora
05-27-2012, 03:47 AM
Thank's a lot ;D, and good tutorial it helped me to understand something!
i have another question, what is the difference between extend the camera, playercontroller camera function or Pawn calccamera??
i know that extending the camera function i can use more stuff, but in a lot of example i see the camera is calculated in all the three class at the same time. i can't really understand it!

JJandDjango
06-03-2012, 01:58 AM
Just came across this thread today and was very excited to see the results on my own machine. I was curious on something related to the Pawn's aiming: does anyone know how to take this tutorial and have the pawn aim towards the center of the camera? Or maybe just a nudge in the right direction on doing that? I actually have the "RPG orbit" style camera described above working fine and have the shoulder camera working as a regular shoulder camera should when LeftShift is held down (except having the pawn aim up or down depending on the angle of the camera).

inxamii
06-05-2012, 10:03 AM
Does anybody knows why this Scripts have NO sounds at all? all kind of sounds are disabled.

McTune
06-06-2012, 01:14 AM
Does anybody knows why this Scripts have NO sounds at all? all kind of sounds are disabled.

this extends gameinfo class Not utgame thus there are no sounds you have to put that in yourself. I recomend examining the UTgame scripts so you can see how its built. its time consuming but not hard.

Rtyper
08-06-2012, 01:26 PM
I followed this and it's working nicely, thanks!
One issue though is that I can't figure out how to get the player to hold a weapon? I have the sockets set up on my player mesh, but running over a weaponpickup factory does nothing at all (somewhat understandably, given the classes this derives from) but even manually giving the player inventory though kismet doesn't work. :S Any ideas?

Baesky
08-19-2012, 08:52 AM
excellent article!
I suggest beginner read this at least 3 times. what different between this article and others is that pawn extends from game pawn, not UTPawn.

Nmzik
08-25-2012, 10:38 AM
thanks!It is working perfectly!Is it possible that when i am in Freecam i can rotate my aim?( i extend weapon from udkweapon)

Jayfight
08-27-2012, 01:11 PM
so i'm trying to get a cam that does firstperson, thirdperson, and shouldercam. but i want the thirdperson camera to be freespining and the character to turn seperate based on direction input while the firstperson and shoulder cams or set to have the character turn with the camera

i have tried to combine the thirdperson/shouldercam from Psilocybe and the rfeespin cam from McTune and i got the thirdperson cam working right but the first and shoulder cams also freespin and i was hoping someone might tell me how i can add the command behindview into the scripts without breaking the thirdperson cam

i have tried to figure out how to add it into the camera.uc and the playercontroller.uc but idk how to tell the engine what it does

there is a line in my playercontroller.uc the allows me to tell the game to hide or unhide the player mesh when i press a button
function HideMesh(bool meshVisible)
{
Pawn.Mesh.SetOwnerNoSee(meshVisible);
}

and i thought maybe i could that for behindview as well, but like i said idk how to write the same thing for behindview to work

any help would be appreciated thanks

raycornea
11-03-2012, 12:40 PM
I have a question on using scripted camera ingame:

I want to change the camera from the ones i've used in a cinematic(to show different perpectives + effects and such) to the default one (which can only be found in the Pawn.uc script)

A snippet

simulated function bool CalcCamera( float fDeltaTime, out vector out_CamLoc, out rotator out_CamRot, out float out_FOV )
{
local vector HitLoc,HitNorm, End, Start, vecCamHeight;

vecCamHeight = vect(-20,20,0);
vecCamHeight.Z = CamHeight;
Start = Location;
End = (Location+vecCamHeight)-(Vector(Controller.Rotation) * CamOffsetDistance); //cam follow behind player controller
out_CamLoc = End;

//trace to check if cam running into wall/floor
if(Trace(HitLoc,HitNorm,End,Start,false,vect(12,12 ,12))!=none)
{
out_CamLoc = HitLoc + vecCamHeight;
}

return true;
}

Zeitlos
11-16-2012, 01:15 PM
hey guys
I got the august build, have copy and pasted this tutorial (except i haven't created a game content folder... just the YOURGAME folder and the 4 .uc class files in the classes folder)

....but I cant find this "UDK launcher" thats mentioned.

so i try to jump into the UDK Game and it says "scripts outdated... build now?"

I hit okay and it builds with a few small yellow warnings but otherwise okay.

i then jump back into UDK game again, hit instant action and start a game but i dont have a 3rd person camera. Can anyone advise me what i'm doing wrong please? Its really butchering my head :/


ta
ant

You have to do the same procedure for DefaultGame.ini that you did for DefaultGameUDK.ini

atmadaenygma
11-20-2012, 09:34 PM
Thank you so much for this tutorial, after tons of googling I have found a 3rd person camera that does everything that I need.

I do have one problem though.

I have replaced the skeletal mesh with my own mesh and it appears to be floating several feet in the air.

http://i789.photobucket.com/albums/yy173/atmadaenygma/Inherit%20Game%20Problem%20solving/floating_character.jpg

I know that he has been zeroed out but floats, he is about half the size of the skeletalmesh default or the characters in udk as My game needs to be very very big so I am going to use small characters on a large map.

thnk you in advance for helping me.

daimaku
11-24-2012, 11:38 AM
the problem is the size of your collision cyllinder, you can reduce it's height or you can modify the location.z origin of the skeletal mesh in the skeletal mesh editor, in the properties windows.

blaklion
11-24-2012, 04:35 PM
I like the camera and thanks a lot. I wanted to know though how you can modify the pawn's rotation such that on ThirdPerson the pawn rotates based on the acceleration(e.g. pressing a makes the pawn rotate left) and on ShoulderCam it rotates with the camera. and also how are you supposed to assign a weapon as the class does not extend from UT

vklax
11-29-2012, 11:53 AM
Hey there sorry to bother you. I just wanted to know, could this code be used for a four legged character (quadraped) or is it made such that it will only work on a two legged character.

zoix
02-06-2013, 10:35 AM
Hey guys,

Has anyone tried this code with the alteration of the Pawn class inheriting from the UTPawn class instead? I'd like to do this so I do not have to add code for handling sound and other stuff.

Supamigit
02-09-2013, 09:39 AM
Well after a few secs i got your modfied camera working and well im was IMPRESSED but alas with all that i learnt, i cannot for the Life of my get a Gun in the game, ive tried default properties calls, for LINKGUN, found some code for CustomLinkGun setup tried to modify into this script..

ANYONE gte this working WITH THIS script?

Please dont give me the I didnt look for the information reply ( its a waste of a post)

Thanks to the maker and all that have been involved in this 3rd person adventure

zoix
02-09-2013, 01:58 PM
Well after a few secs i got your modfied camera working and well im was IMPRESSED but alas with all that i learnt, i cannot for the Life of my get a Gun in the game, ive tried default properties calls, for LINKGUN, found some code for CustomLinkGun setup tried to modify into this script..

ANYONE gte this working WITH THIS script?

Please dont give me the I didnt look for the information reply ( its a waste of a post)

Thanks to the maker and all that have been involved in this 3rd person adventure

Have you tried extending from the UTPawn instead?

yanghr
02-20-2013, 10:24 PM
Thanks, you help me a lot ^_^

dibe91
02-23-2013, 04:49 PM
hello! I followed the tutorial but when I try to open I get an error le'editor against you echo the following:

Unreal Frontend started 23/02/2013 22:46:06...
[COMMANDLET 'UDK.exe make' STARTED IN ''] feb 23, 10:46
Init: Version: 10246
Init: Epic Internal: 0
Init: Compiled (32-bit): Jul 27 2012 15:48:01
Init: Command line:
Init: Base directory: C:\UDK\UDK-2012-07\Binaries\Win32\
Init: Character set: Unicode
Log: Executing Class UnrealEd.MakeCommandlet
--------------------Core - Release--------------------
--------------------Engine - Release--------------------
--------------------IpDrv - Release--------------------
--------------------GFxUI - Release--------------------
--------------------GameFramework - Release--------------------
--------------------UnrealEd - Release--------------------
--------------------GFxUIEditor - Release--------------------
--------------------WinDrv - Release--------------------
--------------------OnlineSubsystemPC - Release--------------------
--------------------OnlineSubsystemSteamworks - Release--------------------
--------------------OnlineSubsystemGameCenter - Release--------------------
--------------------UDKBase - Release--------------------
--------------------UTEditor - Release--------------------
--------------------UTGame - Release--------------------
--------------------UTGameContent - Release--------------------
--------------------GOWGame - Release--------------------
Analyzing...
C:\UDK\UDK-2012-07\Development\Src\GOWGame\Classes\GOWGameCamera.u c(94) : Error, Unexpected 'if'
Compile aborted due to errors.
Warning/Error Summary
---------------------
C:\UDK\UDK-2012-07\Development\Src\GOWGame\Classes\GOWGameCamera.u c(94) : Error, Unexpected 'if'
Failure - 1 error(s), 0 warning(s)
Execution of commandlet took: 4.66 seconds
[feb 23, 10:46 ] COMMANDLET 'UDK.exe make' FAILED

[Skipping Cook]

[Skipping Launch]

[Skipping Package Game]

[feb 23, 10:46 ] PIPELINE FAILED TO COMPLETE.

LePasi
02-24-2013, 10:02 AM
Hello and thanks for this tutorial :D !

I just set up VS2010 with nFringe for UDK .... i double checked it, it seems to be alright and set up correctly.

I followed this Tutorial, Step by step, from top to bottom, from start to finish. Twice.
I made a small Testmap, just for testing.

When i launch UDK Game, it does something in black box ( :) ) and in the end there are just 2 Warnings (something with lighting, no worries about it) and NO ERRORS.
I launch the UDK Game again, and voila , i loads automatically my Testmap.

But the script doesn't seem to work at all, it's like NOTHING has changed. Still default FirstPersonView. It's like it doesn't really use my scripts.

Has i missed something, that kinda tells UDK to use the script or start the script or whatever i don't know :( ???

maybe someone can help me, would be great !
THANKS

PAsi

Edit: Has it something to do with the GameType i set on my map ? just wonder ...

LePasi
02-24-2013, 11:30 AM
Got it ! Works fine !!
If you still can't get this to work:

In the UDK Editor go to View > World Properties > Game Type.
And here make sure you choose "YourGameInfo" under Default Game Type. Otherwise it won't use my "YourGameInfo.uc" ....

Does anyone know why ?

Pasi

Cx Sandman
02-25-2013, 07:37 PM
it could work.

derpa
03-05-2013, 10:11 AM
First off, awesome tut, thank you! I've been looking for the right 3rd person cam for a while. Everything worked like a champ right away. I did run into one problem though, and I can't seem to figure it out. After I implemented all the code for the camera functions, my 'Dodge' stopped working. I've added `Logs just about everywhere in my Pawn and PC classes to figure out whats going on, and I still can't figure out why 'Dodge' broke but 'DoubleJump' still works. If anyone has any ideas, that'd be awesome.

Pawn class:



class TWPawn extends UDKPawn
config(Game);

var bool bDodging;
var bool bDodgeCapable;
var int JumpBootCharge;
var float DodgeDuration;
var float DodgeSpeed;
var float DodgeSpeedZ;
var eDoubleClickDir CurrentDir;

var bool bStopOnDoubleLanding;
var float DoubleJumpThreshold;


var DynamicLightEnvironmentComponent LightEnvironment;


//This lets the pawn tell the PlayerController what Camera Style to set the camera in initially (more on this later).
simulated function name GetDefaultCameraMode(PlayerController RequestedBy)
{
return 'ThirdPerson';
}

//only update pawn rotation while moving
simulated function FaceRotation(rotator NewRotation, float DeltaTime)
{
// Do not update Pawn's rotation if no accel
if (Normal(Acceleration)!=vect(0,0,0))
{
if ( Physics == PHYS_Ladder )
{
NewRotation = OnLadder.Walldir;
}
else if ( (Physics == PHYS_Walking) || (Physics == PHYS_Falling) )
{
NewRotation = rotator((Location + Normal(Acceleration))-Location);
NewRotation.Pitch = 0;
}

SetRotation(NewRotation);
}

}

function bool Dodge(eDoubleClickDir DoubleClickMove)
{
local vector X,Y,Z, TraceStart, TraceEnd, Dir, Cross, HitLocation, HitNormal;
local Actor HitActor;
local rotator TurnRot;

`Log("Dodge Function"); // never logs this

if ( bIsCrouched || bWantsToCrouch || (Physics != PHYS_Walking && Physics != PHYS_Falling) )
{
return false;
}

TurnRot.Yaw = Rotation.Yaw;
GetAxes(TurnRot,X,Y,Z);

if ( Physics == PHYS_Falling )
{
if (DoubleClickMove == DCLICK_Forward)
{
TraceEnd = -X;
}
else if (DoubleClickMove == DCLICK_Back)
{
TraceEnd = X;
}
else if (DoubleClickMove == DCLICK_Left)
{
TraceEnd = Y;
}
else if (DoubleClickMove == DCLICK_Right)
{
TraceEnd = -Y;
}

TraceStart = Location - (CylinderComponent.CollisionHeight - 16)*Vect(0,0,1) + TraceEnd * (CylinderComponent.CollisionRadius - 16);
TraceEnd = TraceStart + TraceEnd * 40.0;
HitActor = Trace(HitLocation, HitNormal, TraceEnd, TraceStart, false, vect(16,16,16));

if ( (HitActor == None) || (HitNormal.Z < -0.1) )
{
return false;
}

if ( !HitActor.bWorldGeometry )
{
if ( !HitActor.bBlockActors )
{
return false;
}
if ( (Pawn(HitActor) != None) && (Vehicle(HitActor) == None) )
{
return false;
}
}
}

`Log("DoubleClickMove"); // never logs this
if (DoubleClickMove == DCLICK_Forward)
{
Dir = X;
Cross = Y;
}
else if (DoubleClickMove == DCLICK_Back)
{
Dir = X;
Cross = Y;
}
else if (DoubleClickMove == DCLICK_Left)
{
Dir = X;
Cross = Y;
}
else if (DoubleClickMove == DCLICK_Right)
{
Dir = X;
Cross = Y;
}

if ( AIController(Controller) != None )
{
Cross = vect(0,0,0);
}
`Log(Cross); // never logs this
return PerformDodge(DoubleClickMove, Dir, Cross);
}

/* BotDodge()
returns appropriate vector for dodge in direction Dir (which should be normalized)
*/
function vector BotDodge(Vector Dir)
{
local vector Vel;
`Log("BotDodge Function");

Vel = DodgeSpeed*Dir;
Vel.Z = DodgeSpeedZ;
return Vel;
}

function bool PerformDodge(eDoubleClickDir DoubleClickMove, vector Dir, vector Cross)
{
local float VelocityZ;

`Log("PerformDodge Function"); // never logs this

if ( Physics == PHYS_Falling )
{
TakeFallingDamage();
}

bDodging = true;
bReadyToDoubleJump = true;
VelocityZ = Velocity.Z;
Velocity = (DodgeSpeed * Dir) + (Velocity Dot Cross) * Cross;

if ( VelocityZ < -200 )
Velocity.Z = VelocityZ + DodgeSpeedZ;
else
Velocity.Z = DodgeSpeedZ;

CurrentDir = DoubleClickMove;
SetPhysics(PHYS_Falling);
//SoundGroupClass.Static.PlayDodgeSound(self);
return true;
}

function DoDoubleJump( bool bUpdating )
{
if ( !bIsCrouched && !bWantsToCrouch )
{
if ( !IsLocallyControlled() || AIController(Controller) != None )
{
MultiJumpRemaining = 0;
}
Velocity.Z = JumpZ + MultiJumpBoost;
//UTInventoryManager(InvManager).OwnerEvent('MultiJu mp');
SetPhysics(PHYS_Falling);
//BaseEyeHeight = DoubleJumpEyeHeight;
//if (!bUpdating)
//{
// SoundGroupClass.Static.PlayDoubleJumpSound(self);
//}
}
}

function bool DoJump( bool bUpdating )
{
// This extra jump allows a jumping or dodging pawn to jump again mid-air
// (via thrusters). The pawn must be within +/- DoubleJumpThreshold velocity units of the
// apex of the jump to do this special move.
if ( !bUpdating && CanDoubleJump() && (Abs(Velocity.Z) < DoubleJumpThreshold) && IsLocallyControlled() )
{
if ( PlayerController(Controller) != None )
{
PlayerController(Controller).bDoubleJump = true;
}
DoDoubleJump(bUpdating);
MultiJumpRemaining = 0;
return true;
}

if (bJumpCapable && !bIsCrouched && !bWantsToCrouch && (Physics == PHYS_Walking || Physics == PHYS_Ladder || Physics == PHYS_Spider))
{
if ( Physics == PHYS_Spider )
{
Velocity = JumpZ * Floor;
}
else if ( Physics == PHYS_Ladder )
{
Velocity.Z = 0;
}
else if ( bIsWalking )
{
Velocity.Z = Default.JumpZ;
}
else
{
Velocity.Z = JumpZ;
}
if (Base != None && !Base.bWorldGeometry && Base.Velocity.Z > 0.f)
{
if ( (WorldInfo.WorldGravityZ != WorldInfo.DefaultGravityZ) && (GetGravityZ() == WorldInfo.WorldGravityZ) )
{
Velocity.Z += Base.Velocity.Z * sqrt(GetGravityZ()/WorldInfo.DefaultGravityZ);
}
else
{
Velocity.Z += Base.Velocity.Z;
}
}
SetPhysics(PHYS_Falling);
bReadyToDoubleJump = true;
bDodging = false;
//if ( !bUpdating )
//{
// PlayJumpingSound();
//}
return true;
}
return false;
}

event Landed(vector HitNormal, actor FloorActor)
{
//local vector Impulse;

Super.Landed(HitNormal, FloorActor);
/**
// adds impulses to vehicles and dynamicSMActors (e.g. KActors)
Impulse.Z = Velocity.Z * 4.0f; // 4.0f works well for landing on a Scorpion
if (UTVehicle(FloorActor) != None)
{
UTVehicle(FloorActor).Mesh.AddImpulse(Impulse, Location);
}
else if (DynamicSMActor(FloorActor) != None)
{
DynamicSMActor(FloorActor).StaticMeshComponent.Add Impulse(Impulse, Location);
}
*/
/**
if ( Velocity.Z < -200 )
{
OldZ = Location.Z;
bJustLanded = bUpdateEyeHeight && (Controller != None) && Controller.LandingShake();
}
*/
//if (UTInventoryManager(InvManager) != None)
//{
// UTInventoryManager(InvManager).OwnerEvent('Landed' );
//}
//if ((MultiJumpRemaining < MaxMultiJump && bStopOnDoubleLanding) || bDodging || Velocity.Z < -2 * JumpZ)
//{
// slow player down if double jump landing
// Velocity.X *= 0.1;
// Velocity.Y *= 0.1;
//}

//AirControl = DefaultAirControl;
MultiJumpRemaining = MaxMultiJump;
bDodging = false;
bReadyToDoubleJump = false;
//if (UTBot(Controller) != None)
//{
// UTBot(Controller).ImpactVelocity = vect(0,0,0);
//}

//if(!bHidden)
//{
// PlayLandingSound();
//}
//if (Velocity.Z < -MaxFallSpeed)
//{
// SoundGroupClass.Static.PlayFallingDamageLandSound( self);
//}
//else if (Velocity.Z < MaxFallSpeed * -0.5)
//{
// SoundGroupClass.Static.PlayLandSound(self);
//}

SetBaseEyeheight();
}

function bool CanDoubleJump()
{
return ( (MultiJumpRemaining > 0) && (Physics == PHYS_Falling) && (bReadyToDoubleJump) );
}

function bool CanMultiJump()
{
return ( MaxMultiJump > 0 );
}

exec function Sprint()
{
GroundSpeed=1000.0;
}

exec function NormalSpeed()
{
GroundSpeed=500.0;
}

DefaultProperties
{
GroundSpeed=500.0;
MaxFallSpeed=+1250.0;
AccelRate=2048.0;

DodgeSpeed=10000.0;
DodgeSpeedZ=0.1;
bdodging=false;
JumpBootCharge=2;

bCanDoubleJump=true;
MaxMultiJump=2;
MultiJumpRemaining=2;
MultiJumpBoost=20.0;
MaxJumpHeight=900.0
MaxDoubleJumpHeight=1800.0;
DoubleJumpThreshold=320.0;
bStopOnDoubleLanding=false;

Components.Remove(Sprite);
//Setting up the light environment
Begin Object Class=DynamicLightEnvironmentComponent Name=MyLightEnvironment
ModShadowFadeoutTime=0.25;
MinTimeBetweenFullUpdates=0.2;
AmbientGlow=(R=.01,G=.01,B=.01,A=1);
AmbientShadowColor=(R=0.15,G=0.15,B=0.15);
//LightShadowMode=LightShadow_ModulateBetter;
//ShadowFilterQuality=SFQ_High;
bSynthesizeSHLight=TRUE;
End Object
Components.Add(MyLightEnvironment);

//Setting up the mesh and animset components
Begin Object Class=SkeletalMeshComponent Name=InitialSkeletalMesh
CastShadow=true;
bCastDynamicShadow=true;
bOwnerNoSee=false;
LightEnvironment=MyLightEnvironment;
BlockRigidBody=true;
CollideActors=true;
BlockZeroExtent=true;

//What to change if you'd like to use your own meshes and animations
PhysicsAsset=PhysicsAsset'CH_AnimCorrupt.Mesh.SK_C H_Corrupt_Male_Physics';
AnimSets(0)=AnimSet'CH_AnimHuman.Anims.K_AnimHuman _AimOffset';
AnimSets(1)=AnimSet'CH_AnimHuman.Anims.K_AnimHuman _BaseMale';
AnimTreeTemplate=AnimTree'CH_AnimHuman_Tree.AT_CH_ Human';
SkeletalMesh=SkeletalMesh'TWContent.tw_models.Snow man';
End Object

//Setting up a proper collision cylinder
Mesh=InitialSkeletalMesh;
Components.Add(InitialSkeletalMesh);
CollisionType=COLLIDE_BlockAll;

Begin Object Name=CollisionCylinder
CollisionRadius=+0023.000000;
CollisionHeight=+0050.000000;
End Object
CylinderComponent=CollisionCylinder;

InventoryManagerClass=class'TWGame.TWInventoryMana ger';
}




Player Controller Class:



class TWPlayerController extends UDKPlayerController
config(TWInput);

var float PreDist;

simulated event PostBeginPlay()
{
super.PostBeginPlay();
`Log("I'm alive");
}

//begin free rotate camera code

state PlayerWalking
{
ignores SeePlayer, HearNoise, Bump;

event NotifyPhysicsVolumeChange( PhysicsVolume NewVolume )
{
if ( NewVolume.bWaterVolume && Pawn.bCollideWorld )
{
GotoState(Pawn.WaterMovementState);
}
}

function ProcessMove(float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot)
{
if( Pawn == None )
{
return;
}

if (Role == ROLE_Authority)
{
//Update ViewPitch for remote clients
Pawn.SetRemoteViewPitch( Rotation.Pitch );
}

Pawn.Acceleration = NewAccel;
CheckJumpOrDuck();
}

function PlayerMove( float DeltaTime )
{
local vector X,Y,Z, NewAccel;
local eDoubleClickDir DoubleClickMove;
local bool bSaveJump;
local Rotator DeltaRot, ViewRotation, OldRot, NewRot;

if( Pawn == None )
{
GotoState('Dead');
}
else
{
GetAxes(Rotation,X,Y,Z);
//update viewrotation
ViewRotation = Rotation;

//Calculate Delta to be applied on ViewRotation
DeltaRot.Yaw = PlayerInput.aTurn;
DeltaRot.Pitch = PlayerInput.aLookUp;
ProcessViewRotation( DeltaTime, ViewRotation, DeltaRot );
SetRotation(ViewRotation);

//Update acceleration.
NewAccel = PlayerInput.aForward*X + PlayerInput.aStrafe*Y;
NewAccel.Z = 0;
// pawn face newaccel direction //

//===
OldRot = Pawn.Rotation;

if( Pawn != None )
{
if( NewAccel.X > 0.0 || NewAccel.X < 0.0 || NewAccel.Y > 0.0 || NewAccel.Y < 0.0 )
{
NewRot = Rotator(NewAccel);
}
else
{
NewRot = Pawn.Rotation;
}
}

Pawn.FaceRotation(RInterpTo(OldRot,NewRot,Deltatim e,90000,true),Deltatime);
//===

NewAccel = Pawn.AccelRate * Normal(NewAccel);
DoubleClickMove = PlayerInput.CheckForDoubleClickMove( DeltaTime/WorldInfo.TimeDilation );
bDoubleJump = false;

if( bPressedJump && Pawn.CannotJumpNow() )
{
bSaveJump = true;
bPressedJump = false;
}
else
{
bSaveJump = false;
}

ProcessMove(DeltaTime, NewAccel, DoubleClickMove, Rotation);
bPressedJump = bSaveJump;
}
}

event BeginState(Name PreviousStateName)
{
DoubleClickDir = DCLICK_None;
bPressedJump = false;
GroundPitch = 0;

if ( Pawn != None )
{
Pawn.ShouldCrouch(false);

if (Pawn.Physics != PHYS_Falling && Pawn.Physics != PHYS_RigidBody) // FIXME HACK!!!
{
Pawn.SetPhysics(PHYS_Walking);
}
}
}

event EndState(Name NextStateName)
{
GroundPitch = 0;

if ( Pawn != None )
{
Pawn.SetRemoteViewPitch( 0 );

if ( bDuck == 0 )
{
Pawn.ShouldCrouch(false);
}
}
}

Begin:
}

//end free rotate camera code

exec function CamZoomOut()
{
if (PlayerCamera.FreeCamDistance < 512) //Checks value of FreeCamDistance against max value
{
/*This portion increases the camera distance.
By taking a base zoom increment (64) and multiplying it by the current distance (d) over 256, we decrease the zoom increment for when the camera is close,
(d < 256), and increase it for when it's far away (d > 256). Just a little feature to make the zoom feel better. You can tweak the values or take out the
scaling altogether and just use the base zoom increment if you like */

PlayerCamera.FreeCamDistance += ( 64 * (PlayerCamera.FreeCamDistance / 256));
}
}

exec function CamZoomIn()
{
if (PlayerCamera.FreeCamDistance > 64) //Checks value of FreeCamDistance against minimum
{
/*This portion increases the camera distance.
By taking a base zoom increment (64) and multiplying it by the current distance (d) over 256, we decrease the zoom increment for when the camera is close,
(d < 256), and increase it for when it's far away (d > 256). Just a little feature to make the zoom feel better. You can tweak the values or take out the
scaling altogether and just use the base zoom increment if you like */

PlayerCamera.FreeCamDistance -= (64 * (PlayerCamera.FreeCamDistance / 256));
}
}

exec function ShoulderCam()
{
`Log("Shoulder Cam");
PreDist = PlayerCamera.FreeCamDistance; //stores previous camera distance
TWPlayerCamera(PlayerCamera).CameraStyle = 'ShoulderCam'; //type casting camera script to access the variable CameraStyle
}

exec function NormalCam()
{
`Log("Normal Cam");
PlayerCamera.FreeCamDistance = PreDist; //restoring the previous camera distance
TWPlayerCamera(PlayerCamera).CameraStyle = 'ThirdPerson'; //restoring the previous camera style
}

exec function Sprint()
{
TWPawn(Pawn).Sprint();
}

exec function NormalSpeed()
{
TWPawn(Pawn).NormalSpeed();
}

DefaultProperties
{
CameraClass=class'TWPlayerCamera' //Telling the PC to use your custom camera script
DefaultFOV=90.f //Telling the PC what the default field of view should be
}



Player Camera Class:



class TWPlayerCamera extends Camera;

var float Dist;
var float TargetFOV; //lerp target for field of view
var float Z; //current Z axis offset
var float TargetZ; //lerp target for Z offset
var float Offset; //current amount of XY offset
var float TargetOffset; //lerp target for XY offset
var float pival; //Pi

function UpdateViewTarget(out TViewTarget OutVT, float DeltaTime)
{
local vector Loc, Pos, HitLocation, HitNormal;
local rotator Rot;
local Actor HitActor;
local CameraActor CamActor;
local bool bDoNotApplyModifiers;
local TPOV OrigPOV;

//store previous POV
OrigPOV = OutVT.POV;

//default FOV
OutVT.POV.FOV = DefaultFOV;

//viewing through a camera actor
CamActor = CameraActor(OutVT.Target);
if (CamActor != None)
{
CamActor.GetCameraView(DeltaTime, OutVT.POV);

//grab aspect ratio from the CameraActor
bConstrainAspectRatio = bConstrainAspectRatio || CamActor.bConstrainAspectRatio;
OutVT.AspectRatio = CamActor.AspectRatio;

//see if the CameraActor wants to override the PostProcess settings
CamOverridePostProcessAlpha = CamActor.CamOverridePostProcessAlpha;
CamPostProcessSettings = CamActor.CamOverridePostProcess;
}
else
{
//give Pawn viewtarget a chance to dictate the camera position
//if Pawn doesn't override the camera view, then proceed with defaults
if (Pawn(OutVT.Target) == None || !Pawn(OutVT.Target).CalcCamera(DeltaTime, OutVT.POV.Location, OutVT.POV.Rotation, OutVT.POV.FOV))
{
//don't apply modifiers when using these debug camera modes
bDoNotApplyModifiers = true;

switch(CameraStyle)
{
case 'Fixed' : //no update, keeps previous view
OutVT.POV = OrigPOV;
break;

case 'ThirdPerson' : //enters here as long as CameraStyle is still set to ThirdPerson

case 'FreeCam' :

case 'ShoulderCam' : //shoulder cam case
//setting camera location and rotation to the viewtarget's
Loc = OutVT.Target.Location;
Rot = OutVT.Target.Rotation;

if (CameraStyle == 'ThirdPerson')
{
Rot = PCOwner.Rotation; //set camera rotation to that of Pawn
TargetZ = 0; //no Z axis offset desired
TargetFOV = 90; //set FOV to default of 90 degrees
TargetOffset = 0; //no XY offset desired
}

if (CameraStyle == 'ShoulderCam')
{
Rot = PCOwner.Rotation; //still use Pawn rotation to set camera rotation
FreeCamDistance = 64;
TargetFOV = 60.f; //create zoom effect
TargetZ = 32; //set camera height just above Pawn's head; modify this value per character dimensions
TargetOffset = 32; //set camera horizontal offset above Pawn's shoulders; modify this value per character dimensions
}

if (CameraStyle == 'FreeCam')
{
Rot = PCOwner.Rotation;
}

Loc += FreeCamOffset >> Rot;
Loc.Z += Z; //set Z coordinate offset for shoulder view

//linear interpolation algorithms (3). these are the "smoothing" so the camera doesn't jump between zoom levels
if (Dist != FreeCamDistance)
{
Dist = Lerp(Dist, FreeCamDistance, 0.15); //increment Dist towards FreeCamDistance, which is where we want camera to be. increments a percentage of the distance between them according to third variable (.15/15%)
}

if (Z != TargetZ)
{
Z = Lerp(Z, TargetZ, 0.1);
}

if (DefaultFOV != TargetFOV)
{
DefaultFOV = Lerp(DefaultFOV, TargetFOV, 0.1);
}

if (Offset != TargetOffset)
{
Offset = Lerp(Offset, TargetOffset, 0.1);
}

//instead of using FreeCamDistance here, which would cause the camera to jump by the entire increment, use Dist which increments in small steps to the desired value of FreeCamDistance using the Lerp function above
Pos = (Loc - Vector(Rot) * Dist);

//map character offset from Pawn coordinates to world coordinates
Pos.X += Offset * sin(-Rot.Yaw * pival * 2 / 65536);
Pos.Y += Offset * cos(Rot.Yaw * pival * 2 / 65536);

//this determines if the camera will pass through a mesh by tracing a path to the view target
HitActor = Trace(HitLocation, HitNormal, Pos, Loc, false, vect(12,12,12));

//this is where the location and rotation of the camera are actually set
OutVT.POV.Location = (HitActor == None) ? Pos : HitLocation;
OutVT.POV.Rotation = Rot;

break; //this is where the code leaves the switch/case statement, preventing it from executing the commands intended for the FirstPerson case

case 'FirstPerson' : //simple first person, view through viewtarget's "eyes"
default : OutVT.Target.GetActorEyesViewPoint(OutVT.POV.Locat ion, OutVT.POV.Rotation);
break;
}
}
}

if (!bDoNotApplyModifiers)
{
//apply camera modifiers at the end (view, shakes, etc.)
ApplyCameraModifiers(DeltaTime, OutVT.POV);
}
}

DefaultProperties
{
FreeCamDistance = 256.f;
pival = 3.14159;
}



If anyone can see what might be causing this, that would be fantastic. Thanks again for the tut, and thanks in advance for the help! :D

JKordero
03-06-2013, 04:03 PM
I dont know if Im making a double post... sorry about that...
this tutorial work just fine for me... just a question... there is a way to put the camara in order to looks like Mirrors Edge? like... the camera is the eyes and when you look down you can see your body?

thnks so much

pdcsky
03-20-2013, 09:15 AM
Got it ! Works fine !!
If you still can't get this to work:

In the UDK Editor go to View > World Properties > Game Type.
And here make sure you choose "YourGameInfo" under Default Game Type. Otherwise it won't use my "YourGameInfo.uc" ....

Does anyone know why ?

Pasi


I can't find "YourGameInfo" in default game type.
I followed the tutorial forwards and backwards
Is there something I need to check?

GunnerJnr
03-25-2013, 02:38 PM
great tutorial thanks man

GunnerJnr
03-25-2013, 02:40 PM
I can't find "YourGameInfo" in default game type.
I followed the tutorial forwards and backwards
Is there something I need to check?

did you go into the defaultgame.ini and change the game type and game server to your game info etc...

You'll need to go in to UDKGame\config and edit DefaultEngine.ini, and DefaultGameUDK.ini (make sure to turn of read-only on these files. In DefaultEngine.ini you'll need to edit:


Code:
Lines 6, 7 and 8,
Map=UTFrontEnd.udk
LocalMap=UTFrontEnd.udk
TransitionMap=EnvyEntry.udk
Change the value of the first two entries to the map you'd like to start on,
and if you like, change the third entry to your own custom loading screen map.

Add: +EditPackages=YourGame under [UnrealEd.EditorEngine] on line 15
In DefaultGameUDK.ini you'll need to edit:


Code:
Lines 5, 6 and 7,
DefaultGame=UTGame.UTDeathmatch
DefaultServerGame=UTGame.UTDeathmatch
PlayerControllerClassName=UTGame.UTPlayerControlle r
Change the first two entries to YourGame.YourGameInfo, and the third entry to YourGame.YourGamePlayerController.
Now for a couple of notes: First off, please note that this ini editing is quite basic and does not change any behavior related to how UDK builds packages, or includes packages when you "make" the game from the front end. For more advanced ini editing please check out tutorials such as The Ball for more information. Second, for your custom maps and content you'll need to create a folder "YourGame" under UDKGame\Content.

GunnerJnr
03-26-2013, 09:22 AM
Hello everybody as regards to making a gun work with this camera system it seems to be very challenging even with creating a custom weapon still no joy. But I have a feeling its because of 3 classes!!!

As you can see he picks it up then it vanishes!



http://www.youtube.com/watch?v=zauuI_qSW3g

I think it has something to do with the

[YOURGAME]PlayerController class extending from GamePlayerController,
Example:
class RhonePlayerController extends GamePlayerController;

[YOUR]Pawn class extending from the GamePawn
Example:
class RhonePawn extends GamePawn;

[YOURGAME]GameInfo class extending from GameInfo.
Example:
class RhoneGameInfo extends GameInfo;

Now if I extend them from UTPlayerController and UTPawn I can start with a gun, pick up guns and use them and switch between weapons. BUT I lose all the functionality of the custom camera by changing these settings, it just goes back to the basic 'FPS'. So maybe something needs to be changed or added to the DefaultEngine.ini. e.g. [RhoneGame.RhoneGame] with some settings?? this has really stumped me but I know im getting closer.

Also David Voyles suggested adding

defaultproperties
{
....
bCanPickupInventory=True
...

But if anybody knows a solution to this plese help, it will greatly appreciated then we can share the solution with all so future inspiring game devs wont have to go through what we do lol.

P.S I have already added the info:

+EditPackages=YourGame under [UnrealEd.EditorEngine]

&

DefaultGame=UTGame.UTDeathmatch
DefaultServerGame=UTGame.UTDeathmatch
PlayerControllerClassName=UTGame.UTPlayerControlle r

and changed the values to suit my game.

================================================== ========================

GunnerJnr
03-26-2013, 11:03 AM
After playing about changes the classes the my game classes extend to, I think I may of found the bug why we cannot use a weapon with this camera code!

When changing


class RhonePlayerController extends GamePlayerController;

TO


class RhonePlayerController extends UTPlayerController;



http://www.youtube.com/watch?v=pfcdQNdkBCc

As you can see the pawn picks up the gun (to the little mesh its not visible, to the big hidden mesh behind, which im assuming is the real pawn it is visible). So my conclusion is that this is the bug now I just got to find a way of fixing it!

GunnerJnr
03-26-2013, 12:34 PM
PROBLEM SOLVED, for anybody wanted to add a gun to their player I suggest following this brilliant extension to this tutorial works perfectly

TUTORIAL CAN BE FOUND HERE: http://forums.epicgames.com/threads/804974-GoW-Camera-Tutorial-extension

AS you can see in the video its now working



http://www.youtube.com/watch?v=JlMhgWAJEpc

GunnerJnr
03-26-2013, 01:08 PM
I only have one small error now and that is when I run my level from the batch file it starts in the basic fps mode its not picking up my game info code! hmmm any suggestions??

Oh and I forgot to mention that yes I have used GameInfo in the editor and the config files

GunnerJnr
03-26-2013, 07:51 PM
I only have one small error now and that is when I run my level from the batch file it starts in the basic fps mode its not picking up my game info code! hmmm any suggestions??

Oh and I forgot to mention that yes I have used GameInfo in the editor and the config files

Solved it just need to add this to GameInfo class for anybody else who has this trouble

WOW took a while but i found the fix to get it running in the batch file. Just needed to add this to the GameInfo class.


static event class<GameInfo> SetGameType(string MapName, string Options, string Portal)
{
return class'RhoneGame.RhoneGameInfo';
}

SuperMeatBoyInc
03-28-2013, 12:45 PM
W0w who knew such an old post could be so helpful :D

thanks alot!! helped me create my own cam.... but i'm still having problems with how to rotate the pawn when in free cam...

any suggestions on what could help me?

GunnerJnr
04-03-2013, 03:35 PM
W0w who knew such an old post could be so helpful :D

thanks alot!! helped me create my own cam.... but i'm still having problems with how to rotate the pawn when in free cam...

any suggestions on what could help me?

Use the w,a,s,d keys to move the pawn whilst using the mouse to move the camera, scroll camera in any direction as far in or out as you want with mouse scroll wheel and use right mouse click or shift for shoulder style zoom, also f key for playing dead and r key for shooting alternate weapon style.

Also why im here I have edited my camera a bit to be a fixed over shoulder cam but im now having trouble implemented the zoom, can any body help with this I want it so when I zoom it gives me a kind of fps style zoom like the player is looking down the barrel. code can be found here

HELP-Please-On-Implementing-a-shoulder-style-GOW-zoom! (http://forums.epicgames.com/threads/952179-HELP-Please-On-Implementing-a-shoulder-style-GOW-zoom!)

fsntico
05-26-2013, 11:39 PM
Worked, but i have 2 questions: My pawn does't have sound.

and a have this error:

:\UDK\UDK-2013-02\Development\Src\YourGame\Classes\YourGamePawn.u c(12) : Warning, Unknown property in defaults: LightShadowMode=LightShadow_ModulateBetter (looked in DynamicLightEnvironmentComponent)
C:\UDK\UDK-2013-02\Development\Src\YourGame\Classes\YourGamePawn.u c(13) : Warning, Unknown property in defaults: ShadowFilterQuality=SFQ_High (looked in DynamicLightEnvironmentComponent)
Warning, Can't find files matching C:\UDK\UDK-2013-02\Binaries\Win32\..\..\Development\Src\Utactionpa wn\Classes\*.uc
Success - 0 error(s), 3 warning(s)
Execution of commandlet took: 7.82 seconds
[mai 27, 12:25 ] COMMANDLET 'UDK.exe make -full' SUCCEEDED

justinray02
06-09-2013, 12:49 PM
im trying to make it so when you scroll down it will change third person to shoulder or vicaversa
i have it good except i dont know what if to use to check the camera mode
i tried
if (CameraStyle == 'ShoulderCam')
but that doesnt work

justinray02
06-09-2013, 01:02 PM
im trying to make it so when you scroll down it will change third person to shoulder or vicaversa
i have it good except i dont know what if to use to check the camera mode
i tried
if (CameraStyle == 'ShoulderCam')
but that doesnt work

breen3d
10-15-2013, 06:58 PM
I'm REALLY hoping that someone can help me.

Using this script, I made this YouTube video (http://www.youtube.com/watch?v=b-11LdzqPqw) explaining the issue I'm having with objects attaching to my character when I start a server game. The attachment is programmed within Kismet. Also, all Kismet related player input commands are being ignored as well. All I can do is move the player around and jump. Even the sounds are gone.

Anyone have any idea why this would be? Does it have something to do with the game type not being set to UTDeathmatch or what? None of these classes reference UT code it appears, so I was thinking that maybe that had something to do with it.

HELP!!! :D

Thanks,

-David Breen

led2012
12-28-2013, 04:32 PM
I followed the tutorial, part by part, and this error keeps on showing after I launch UDK Editor


C:\UDK\UDK-2013-02\Development\Src\Engine\Classes\FogVolumeSpheric alDensityInfo.uc(28) : Error, BEGIN OBJECT: Can't create subobject as Class DrawLightRadiusComponent hasn't been compiled yet.
C:\UDK\UDK-2013-02\Development\Src\Engine\Classes\WindPointSource. uc(22) : Error, BEGIN OBJECT: Can't create subobject as Class DrawLightRadiusComponent hasn't been compiled yet.
C:\UDK\UDK-2013-02\Development\Src\Engine\Classes\LensFlareSource. uc(225) : Error, BEGIN OBJECT: Can't create subobject as Class DrawLightRadiusComponent hasn't been compiled yet.
C:\UDK\UDK-2013-02\Development\Src\Engine\Classes\PointLight.uc(41 ) : Error, BEGIN OBJECT: Can't create subobject as Class DrawLightRadiusComponent hasn't been compiled yet.
C:\UDK\UDK-2013-02\Development\Src\Engine\Classes\PointLight.uc(45 ) : Error, BEGIN OBJECT: Can't create subobject as Class DrawLightRadiusComponent hasn't been compiled yet.
C:\UDK\UDK-2013-02\Development\Src\Engine\Classes\SpotLight.uc(42) : Error, BEGIN OBJECT: Can't create subobject as Class DrawLightRadiusComponent hasn't been compiled yet.
C:\UDK\UDK-2013-02\Development\Src\Engine\Classes\SpotLight.uc(58) : Error, BEGIN OBJECT: Can't create subobject as Class DrawLightRadiusComponent hasn't been compiled yet.

I need help on this :(

daimaku
12-28-2013, 05:58 PM
have you modified any base engine classes ? i never get any error on the Engine folder.

Hex0n
03-14-2014, 09:35 PM
Hey, I succeed to get it working on my classes extending from UDKGame, but is it normal that when I turn the view with the mouse, the character turns so much that the weapon doesn't aim any more in the direction of the view ? :eek:

Although it's still firing on the right point.

Hex0n
03-17-2014, 06:13 PM
Mmmh... Is anyone related to this tutorial/code still present here ?