Announcement

Collapse
No announcement yet.

Tutorial:How to create your own game without UTClasses !

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

    Tutorial:How to create your own game without UTClasses !

    hello guys,
    this is my research and this will help you start over UDK development and create your game prototype .
    create these file with these content :

    first of all
    in ..\Development\Src\ folder create these folder :
    yourgame
    |
    -----> classes
    then in this folder
    create these :

    yourgame.uc
    Code:
    class yourGame extends GameInfo;
    defaultproperties
    {
    	PlayerControllerClass=class'yourGame.yourPlayerController'
    	DefaultPawnClass=class'yourGame.yourPawn'
    	bDelayedStart=false
    }
    then

    yourplayercontroller.uc
    Code:
    class yourPlayerController extends GamePlayerController
    	dependson(yourPawn);
    defaultproperties
    {
    	//CameraClass=class'yourCamera'
    }
    then

    yourpawn.uc
    Code:
    class yourPawn extends GamePawn placeable;
    
    enum Ecamerastyle
    {
    	Fixed,
    	ThirdPerson,
    	FreeCam,
    	FreeCam_Default,
    	FirstPerson
    };
    var() Ecamerastyle	camerastyle;
    simulated function bool CalcCamera(float fDeltaTime, out vector out_CamLoc, out rotator out_CamRot, out float out_FOV)
    {
    
    	local vector start, end, hl, hn, myLocation;
    	local actor a;
    	myLocation = Location;
    	start = Location;
    	
    	if (Controller != none)
    	{
    		end = myLocation - Vector(Controller.Rotation) * 196.f;
    	}
    	else
    	{
    		end = myLocation - Vector(Rotation) * 196.f;
    	}
    	
    	//start.Z += 120.f;
    	end.Z += 120.f;
    	
    	a = Trace(hl, hn, end, start, false);
    	
    	if (a != none)
    	{
    		out_CamLoc = hl;
    	}
    	else
    	{
    		out_CamLoc = end;
    	}
    	
    	out_CamRot = Rotator(Location - out_CamLoc);
    	return true;
    }
    
    simulated function name GetDefaultCameraMode( PlayerController RequestedBy )
    {
    	`Log("Calling the ThirdPerson Cam");
    	switch( CameraStyle )
    	{
    		case 0:	return 'Fixed';	break;
    		case 1:	return 'ThirdPerson';	break;
    		case 2:	return 'FreeCam';	break;
    		case 3:	return 'FreeCam_Default';	break;
    		case 4:	return 'FirstPerson';	break;
    		default:return 'ThirdPerson';	break;
    	}
    	return 'ThirdPerson';
    }
    
    defaultproperties
    {
    	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)
    
        Begin Object Class=SkeletalMeshComponent Name=InitialSkeletalMesh
    		CastShadow=true
    		bCastDynamicShadow=true
    		bOwnerNoSee=false
    		LightEnvironment=MyLightEnvironment;
            
            CollideActors=true;
            BlockZeroExtent=true;
    		 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'
    				
    		RBCollideWithChannels=(Default=true,GameplayPhysics=true,Pawn=true)
    		bHasPhysicsAssetInstance=true
    		PhysicsWeight=1.0f
    		BlockRigidBody=true;
    			
    		End Object
    	
    	Mesh=InitialSkeletalMesh;
    	Components.Add(InitialSkeletalMesh);
    
    	CollisionType=COLLIDE_BlockAll
        // added to stop the pawn from floating in the air.. not sure why it does.
    	Begin Object Name=CollisionCylinder
    	CollisionRadius=+0021.000000
    	CollisionHeight=+0048.000000
    	End Object
    
    	CylinderComponent=CollisionCylinder
    	
    	camerastyle=thirdperson;
    }
    ok, all classes done !
    then goto ..\UTGame\Config\ and open these file then edit them to :

    defaultgame.ini
    Code:
    [Engine.GameInfo]
    DefaultGame=yourGame.yourGame
    DefaultServerGame=yourGame.yourGame
    PlayerControllerClassName=yourGame.yourPlayerController
    then

    defaultengine.ini
    Code:
    ModEditPackages=yourGame
    ok mission Completed !!!
    i hope you enjoy this !

    #2
    Dont forget UTGameClientViewport.

    Comment


      #3
      nope, this is working !

      Comment


        #4
        Really good tut. where have you been when i started)))

        may i ask?

        when i use GamePlayerController or PlayerController i cant move... only mousing work
        but when i use UTPlayerController all works. and i dont know why. (i am not use any UT classes or function in game)

        class xcPlayerController extends UTPlayerController;
        and no init and no other functions. and no dependson(yourPawn);
        maybe this is reason?

        Comment


          #5
          dependson(); just means the class inside the brackets is compiled before the class that contains the "dependson" so it is probably a good idea to have it in this example

          Comment


            #6
            thank you !

            Comment


              #7
              Nice, but....

              why not using UTClasses? in most cases they contains lots of things you will need, otherwise you have enough knowledge you wont need this tut ^^

              Comment


                #8
                Originally posted by ken_13 View Post
                nope, this is working !
                Ofcourse it works, but even overriding just the default gameinfo alone would still work. The idea was to start a game from non UT classes... The game is default set to use UTGameClientViewport instead of the engine version.

                @BLackHornet - The only place I've come across anything useful thus far in the UT demo script package source was the UTUIScene because it has some functions like SetScreenResolution() and StartDedicatedServer(). Is it too much to ask for a list of useful UT classes?

                Comment


                  #9
                  so you never checked the weapon sources, or any other UTGame source to have a look how to do things? thats great for you...but i suppose most of ppl use this files to gain knowledge and learn how to do things

                  Comment


                    #10
                    Originally posted by MadDogMorgan View Post
                    Ofcourse it works, but even overriding just the default gameinfo alone would still work. The idea was to start a game from non UT classes... The game is default set to use UTGameClientViewport instead of the engine version.

                    @BLackHornet - The only place I've come across anything useful thus far in the UT demo script package source was the UTUIScene because it has some functions like SetScreenResolution() and StartDedicatedServer(). Is it too much to ask for a list of useful UT classes?
                    There is a native console command to change resolution on the fly:
                    Code:
                    setres 1024x768x32
                    For dedicated server, see: http://forums.epicgames.com/showthread.php?t=716215

                    There goes all your need to use UT classes

                    Comment


                      #11
                      Lol, actually that thread is actually posted by a member on the team I'm working with and it says we need to extend UTUIScene... Don't know what you read :P
                      And I've had no lock getting setres to work but I'll take your word it does. ALthough it will be kind of redundant seeing as we're extending UTUIScene.

                      EDIT: Oh sorry missed a post up there :P
                      so you never checked the weapon sources, or any other UTGame source to have a look how to do things? thats great for you...but i suppose most of ppl use this files to gain knowledge and learn how to do things
                      Oh no yeah ofcourse I do. I recently wrote the search query options out for the mod I'm working on and, if not for the prefix UT being replaced with ORN and a few variables added and removed it's a carbon copy. Sorry if I sounded arrogant before, what I would like to know is what UT classes are useful to override i.e. What would I be missing out on by not?

                      Comment


                        #12
                        ah, then i missunderstood, excuse me please

                        Comment


                          #13
                          Originally posted by MadDogMorgan View Post
                          Sorry if I sounded arrogant before, what I would like to know is what UT classes are useful to override i.e. What would I be missing out on by not?
                          I thought that depending on the UT classes you use you end up having to use them all, because they depend on each other?

                          Comment


                            #14
                            Well that depends again on whether or not the class has native code and the native code uses variables of a UT specific type. Otherwise you should be able to make a succesful override out of any UT class.

                            Comment


                              #15
                              Originally posted by MadDogMorgan View Post
                              Well that depends again on whether or not the class has native code and the native code uses variables of a UT specific type. Otherwise you should be able to make a succesful override out of any UT class.
                              Thats good to know, thanks!

                              Comment

                              Working...
                              X