Custom engine which caps framerate to 60fps and fixes timestep to 1/60

Custom engine which caps framerate to 60fps and fixes timestep to 1/60
This commit is contained in:
Kevin Poretti 2022-01-17 16:51:59 -05:00
parent 289c60102b
commit ac61585f5c
7 changed files with 74 additions and 2 deletions

View File

@ -28,6 +28,9 @@ AppliedDefaultGraphicsPerformance=Maximum
+ActiveGameNameRedirects=(OldGameName="/Script/TP_SideScroller",NewGameName="/Script/KOFForever")
+ActiveClassRedirects=(OldClassName="TP_SideScrollerGameMode",NewClassName="KOFForeverGameMode")
+ActiveClassRedirects=(OldClassName="TP_SideScrollerCharacter",NewClassName="KOFForeverCharacter")
GameEngine=/Script/KOFForever.KOFGameEngine
EditorEngine=/Script/UnrealEd.EditorEngine
UnrealEdEngine=/Script/KOFForever.KOFEdEngine
[SystemSettingsEditor]
r.Editor.SkipSourceControlCheckForEditablePackages = 1

View File

@ -11,7 +11,8 @@
"AdditionalDependencies": [
"Paper2D",
"Engine",
"CoreUObject"
"CoreUObject",
"UnrealEd"
]
}
]

View File

@ -8,6 +8,6 @@ public class KOFForever : ModuleRules
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "Paper2D" });
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "Paper2D", "UnrealEd" });
}
}

View File

@ -0,0 +1,14 @@
#include "Engine/KOFEdEngine.h"
void UKOFEdEngine::Tick(float DeltaSeconds, bool bIdleMode)
{
Super::Tick(1.0f / 60.0f, bIdleMode);
}
float UKOFEdEngine::GetMaxTickRate(float DeltaTime, bool bAllowFrameRateSmoothing) const
{
return 60.0f;
}

View File

@ -0,0 +1,14 @@
#include "Engine/KOFGameEngine.h"
void UKOFGameEngine::Tick(float DeltaSeconds, bool bIdleMode)
{
Super::Tick(1.0f / 60.0f, bIdleMode);
}
float UKOFGameEngine::GetMaxTickRate(float DeltaTime, bool bAllowFrameRateSmoothing) const
{
return 60.0f;
}

View File

@ -0,0 +1,20 @@
#pragma once
#include "CoreMinimal.h"
#include "Editor/UnrealEdEngine.h"
#include "KOFEdEngine.generated.h"
/**
*
*/
UCLASS()
class KOFFOREVER_API UKOFEdEngine : public UUnrealEdEngine
{
GENERATED_BODY()
virtual void Tick(float DeltaSeconds, bool bIdleMode) override;
virtual float GetMaxTickRate(float DeltaTime, bool bAllowFrameRateSmoothing) const override;
};

View File

@ -0,0 +1,20 @@
#pragma once
#include "CoreMinimal.h"
#include "Engine/GameEngine.h"
#include "KOFGameEngine.generated.h"
/**
*
*/
UCLASS()
class KOFFOREVER_API UKOFGameEngine : public UGameEngine
{
GENERATED_BODY()
virtual void Tick(float DeltaSeconds, bool bIdleMode) override;
virtual float GetMaxTickRate(float DeltaTime, bool bAllowFrameRateSmoothing) const override;
};