Announcement

Collapse
No announcement yet.

[Tutorial] Third Person Game with GOW camera

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Originally posted by Shirogr View Post
    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.

    Comment


      Warning, Can't find files matching

      Originally posted by dangerdex View Post
      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.

      Comment


        Originally posted by Insipidus View Post
        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\_____"

        Comment


          weapon help

          has anyone got weapons to work for them any help be great thanks

          Comment


            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:

            Code:
            [UnrealEd.EditorEngine]
            EditPackagesOutPath=..\..\UDKGame\Script
            FRScriptOutputPath=..\..\UDKGame\ScriptFinalRelease
            +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.

            Comment


              Thanks for the help @Dvoyles

              The updated tutorial can be found at my site: http://disturbedprogrammer.com/index...ials&Itemid=63

              Again, the author is still: Psilocybe

              Comment


                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:

                Code:
                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.
                Code:
                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?

                Comment


                  Originally posted by Dvoyles View Post
                  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:

                  Code:
                  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.
                  Code:
                  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?

                  Comment


                    Sure thing! The only alterations I have made from the code in this tutorial, is the addition above.

                    Code:
                    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.Location, 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 );
                    }

                    Code:
                    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
                    }
                    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
                    }
                    Code:
                    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_CH_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

                    Comment


                      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)

                      Comment


                        @Dvoyles

                        What is this supposed to mean?

                        PHP Code:
                        Rot PCOwner.Owner.Rotation
                        Also, missing your input bindings.

                        Comment


                          Great tutorial,but i get one trouble



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

                          Comment


                            When that happens is either an error in some .ini files or some asset.

                            I would bet on the .ini file.

                            Comment


                              Originally posted by Saishy View Post
                              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

                              Comment


                                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...apons---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

                                Comment

                                Working...
                                X