Announcement

Collapse
No announcement yet.

Unable to load objects after cooking

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

    Unable to load objects after cooking

    EDIT: I am using 02-2012 build of UDK

    I have an issue with my game so I decided to make a short and simple test.
    Following the tutorials on http://udn.epicgames.com/Three/Camer...icalGuide.html I made a single camera module in a completely new and empty custom game.
    (the classes and the ini files are listed below).
    I made a new map, set the Game Type in the World info and saved it without modifying anything else.
    I added a simple "exec" function to list some of the classes in order to confirm that they are all loading.
    • Compiles without a single warning
    • Runs in Editor, in Mobile preview, in console without any problems


    Code:
    --------------------Tst - Release--------------------
    Package Tst changed, recompiling
    Analyzing...
    Scripts successfully compiled - saving package 'C:\UDK\UDK-2012-02\Binaries\Win32\..\..\UDKGame\Script\Tst.u'
    Success - 0 error(s), 0 warning(s)
    Execution of commandlet took:  3.33 seconds
    [Apr 2, 11:15 PM] COMMANDLET 'UDK.exe make' SUCCEEDED
    I chose the default PC build profile "DM-Deck" and just removed the default map, put mine there and set it to "Override Default" then cooked it without any warnings whatsoever (apart from the bugging "Failed to find supported game type(s)..")

    Code:
    Cooking [Seekfree] TGameMap
    Failed to find supported game type(s) for TGameMap
    Success - 0 error(s), 0 warning(s)
    Execution of commandlet took:  6.05 seconds
    [Apr 2, 11:16 PM] COMMANDLET 'UDK.exe CookPackages -platform=PC TGameMap.udk -multilanguagecook=INT' SUCCEEDED
    When I run it though my custom camera module that extends from Object - based abstract class does not load....

    Anyone has any idea how do I fix this?
    I tried setting the classes in "dependson", but to no effect.


    Click image for larger version

Name:	cook_problem.jpg
Views:	1
Size:	20.9 KB
ID:	3252404



    //==============Ini settings============
    DefaultGame.ini
    Code:
    [Engine.GameInfo]
    DefaultGame=Tst.TGameInfo
    DefaultServerGame=Tst.TGameInfo
    DefaultGameType=Tst.TGameInfo
    PlayerControllerClassName=Tst.TPc
    DefaultEngine.ini
    Code:
    +EditPackages=Tst
    //==============Listing of classes===============

    TGameInfo.uc (GameInfo)
    Code:
    class TGameInfo extends FrameworkGame;
    
    /** Custom Pawn Archetype for easier usage in Editor */
    var() const TPawn _PawnArchetype;
    
    function Pawn SpawnDefaultPawnFor(Controller NewPlayer, NavigationPoint StartSpot)
    {
    	local Pawn LocPawn;
    	local Rotator LocStartRot;
    	// don't allow roll or pitch and set Yaw to initial Yaw
    	LocStartRot.Yaw = StartSpot.Rotation.Yaw;
    	// return none if no params sent
    	if (NewPlayer == none || StartSpot == none)
    	{
    		`warn("no player and no start spot");
    		return none;
    	}
    	LocPawn = Spawn( _PawnArchetype.Class,,, StartSpot.Location, LocStartRot, _PawnArchetype);
    	return LocPawn;
    }
    
    DefaultProperties
    {
    	PlayerControllerClass = class'Tst.TPc'
    	_PawnArchetype = TPawn'ChainedContent.Archetypes.TestPawn'
    	bRestartLevel=false
    	bDelayedStart=false
    }
    TPc.uc (PlayerController)
    Code:
    class TPc extends GamePlayerController;
    
    var CamModule Camera_activeModule;
    
    exec function ll()
    {
    	WorldInfo.Game.Broadcast(self, "Controller:"@self.Class);
    	WorldInfo.Game.Broadcast(self, "Pawn:"@Pawn.Class);
    	WorldInfo.Game.Broadcast(self, "Camera:"@PlayerCamera.Class);
    	WorldInfo.Game.Broadcast(self, "CameraModule:"@ TPCam(self.PlayerCamera)._CurrentCamera.Class);
    }
    
    DefaultProperties
    {
    	CameraClass=class'Tst.TPCam'
    }
    TPawn.uc (Pawn)
    Code:
    class TPawn extends GamePawn;
    
    /** Character light environment */
    var() const DynamicLightEnvironmentComponent _LightEnvironment;
    
    simulated function bool CalcCamera( float fDeltaTime, out vector out_CamLoc, out rotator out_CamRot, out float out_FOV )
    {
    	//return false to allow custom camera to control its location and rotation
    	return false;
    }
    
    DefaultProperties
    {
    	Components.Remove( Sprite )
    	Begin Object Class=DynamicLightEnvironmentComponent Name=MyLightEnvironment
    		bSynthesizeSHLight=true
    		bIsCharacterLightEnvironment=true
    		bUseBooleanEnvironmentShadowing=false
    	End Object
    	Components.Add( MyLightEnvironment )
    	_LightEnvironment=MyLightEnvironment
    
    	Begin Object Class=SkeletalMeshComponent Name=MySkeletalMeshComponent
    		bCacheAnimSequenceNodes=false
    		AlwaysLoadOnClient=true
    		AlwaysLoadOnServer=true
    		CastShadow=true
    		BlockRigidBody=true
    		bUpdateSkelWhenNotRendered=false
    		bIgnoreControllersWhenNotRendered=true
    		bUpdateKinematicBonesFromAnimation=true
    		bCastDynamicShadow=true
    		RBChannel=RBCC_Untitled3
    		RBCollideWithChannels=(Untitled3=true)
    		LightEnvironment=MyLightEnvironment
    		bOverrideAttachmentOwnerVisibility=true
    		bAcceptsDynamicDecals=false
    		bHasPhysicsAssetInstance=true
    		TickGroup=TG_PreAsyncWork
    		MinDistFactorForKinematicUpdate=0.2f
    		bChartDistanceFactor=true
    		RBDominanceGroup=20
    		Scale=1.f
    		bAllowAmbientOcclusion=false
    		bUseOnePassLightingOnTranslucency=true
    		bPerBoneMotionBlur=true
    	End Object
    	Mesh=MySkeletalMeshComponent
    	Components.Add( MySkeletalMeshComponent )
    
    	// colision
    	Begin Object Name=CollisionCylinder
    		CollisionRadius=+0021.000000
    		CollisionHeight=+0044.000000
    	End Object
    	CylinderComponent=CollisionCylinder
    }
    TPCam.uc (Camera)
    Code:
    class TPCam extends Camera;
    
    var TPc _PlayerOwner;
    var CamModule _CurrentCamera;
    
    function PostBeginPlay()
    {
    	local class<CamModule> LocClass;
    	Super.PostBeginPlay();
    	// Setup camera mode
    	if(_CurrentCamera == None)
    	{
    		LocClass = class<CamModule>( DynamicLoadObject( "Tst.CamModule_Iso", class'Class' ) );
    		_CurrentCamera = CreateCamera(LocClass);
    	}
    }
    // set a reference to PC
    function InitializeFor(PlayerController PC)
    {
    	//do parent initialization
    	Super.InitializeFor(PC);
    	//set PlayerOwner to player controller
    	_PlayerOwner = TPc(PC);
    }
    //create new camera and initialaze
    function CamModule CreateCamera(class<CamModule> CameraClass)
    {
    	local CamModule LocCamera;
    	LocCamera = new(Outer) CameraClass;
    	LocCamera._PlayerCamera = self;
    	_CurrentCamera = LocCamera;
    	return LocCamera;
    }
    
    function UpdateViewTarget(out TViewTarget OutVT, float DeltaTime)
    {
    	_CurrentCamera.UpdateCamera(Pawn(OutVT.Target), self, DeltaTime, OutVT);
    	ApplyCameraModifiers(DeltaTime, OutVT.POV);
    	// set camera's location and rotation, to handle cases where we are not locked to view target
    	SetRotation(OutVT.POV.Rotation);
    	SetLocation(OutVT.POV.Location);
    }
    
    DefaultProperties
    {
    }
    CamModule.uc (abstract camera module class)
    Code:
    class CamModule extends Object
    	abstract;
    
    /** Angle of 45° */
    const ANGLE_FORTY_FIVE = 8192;
    /** Angle of 360° */
    const MAX_CAMERA_ROTATION_ANGLE = 65536;
    /** Angle of -360° */
    const MIN_CAMERA_ROTATION_ANGLE = -65536;
    /** owning camera */
    var transient TPCam _PlayerCamera;
    
    /**
     * Calculate new camera location and rotation
     * 
     * @param P
     * @param CameraActor
     * @param DeltaTime
     * @param OutVT
     */
    function UpdateCamera(Pawn P, TPCam CameraActor, float DeltaTime, out TViewTarget OutVT);
    
    DefaultProperties
    {
    }
    CamModule_Iso.uc (Isometric - side module)
    Code:
    class CamModule_Iso extends CamModule;
    
    /** Distance to offset the camera from the player */
    var float _fCamOffsetDistance;
    /** Pitch angle of the camera */
    var int _iIsoCamAngle;
    /** Current rotation angle of the camera */
    var int _iRotCamAngle;
    
    function UpdateCamera(Pawn P, TPCam CameraActor, float DeltaTime, out TViewTarget OutVT)
    {
    	// align camera to player with height (Z) offset
    	OutVT.POV.Location = OutVT.Target.Location;
    	OutVT.POV.Location.Z += Sin(_iIsoCamAngle * UnrRotToRad) * _fCamOffsetDistance;
    	OutVT.POV.Location.X -= Cos(_iRotCamAngle * UnrRotToRad) * _fCamOffsetDistance;
    	OutVT.POV.Location.Y -= Sin(_iRotCamAngle * UnrRotToRad) * _fCamOffsetDistance;
    	// set camera rotation - face down
    	OutVT.POV.Rotation.Pitch = -1 * _iIsoCamAngle;
    	// rotate camera if it is flipped (*0)
    	OutVT.POV.Rotation.Yaw = _iRotCamAngle;
    	OutVT.POV.Rotation.Roll = 0;
    }
    
    DefaultProperties
    {
    	_iIsoCamAngle = 6420
    	_fCamOffsetDistance = 384.0
    	_iRotCamAngle = 0.0;
    }

    #2
    Resolved

    From the UDK documentation at: http://udn.epicgames.com/Three/Conte...ontent Cooking

    Loaded dynamically from any level: If no seekfree package (native script, map) references the object, and the object is loaded at runtime, we expect LoadPackage to be the way to load the object, since DynamicLoadObject will return NULL on a console unless the object is already loaded via LoadPackage.

    Solution: In [Engine.PackagesToAlwaysCook] section of your game's DefaultEngine.ini, mark it as a standalone seekfree package:

    [Engine.PackagesToAlwaysCook]
    +SeekFreePackage=MyGamePackage

    Comment

    Working...
    X