This commit is contained in:
2022-11-10 17:09:37 +02:00
parent 411c341278
commit 36c09efac0
12 changed files with 24 additions and 23 deletions

View File

@@ -8,9 +8,6 @@
"References": [ "References": [
{ {
"Name": "$(EnginePath)/Flax.flaxproj" "Name": "$(EnginePath)/Flax.flaxproj"
},
{
"Name": "$(ProjectPath)/Plugins/FidelityFX-FSR/FidelityFX-FSR.flaxproj"
} }
], ],
"DefaultScene": "194e05f445ece24ec5448d886e1334df", "DefaultScene": "194e05f445ece24ec5448d886e1334df",

View File

@@ -21,9 +21,9 @@ namespace Game
private GPUTexture texture; private GPUTexture texture;
private GPUTexture texture2; private GPUTexture texture2;
public override PostProcessEffectLocation Location => PostProcessEffectLocation.Default; //public override PostProcessEffectLocation Location => PostProcessEffectLocation.Default;
public override int Order => 110; //public override int Order => 110;
public override bool CanRender => camera.IsActive; //public override bool CanRender => camera.IsActive;
private bool useMainCamera = true; private bool useMainCamera = true;
public bool rescaleModel = true; public bool rescaleModel = true;

View File

@@ -14,8 +14,8 @@ namespace Game
Config config = new Config(); Config config = new Config();
if (!File.Exists(path)) if (!File.Exists(path))
return config; return config;
using FileStream file = File.OpenRead(path); /*using*/ FileStream file = File.OpenRead(path);
using StreamReader sr = new StreamReader(file); /*using*/ StreamReader sr = new StreamReader(file);
string line; string line;
while ((line = sr.ReadLine()?.Trim()) != null) while ((line = sr.ReadLine()?.Trim()) != null)

View File

@@ -78,6 +78,7 @@ namespace Game
private void LoadConfig(Scene scene, Guid guid) private void LoadConfig(Scene scene, Guid guid)
{ {
Console.Print("Loading config file"); Console.Print("Loading config file");
AssetManager.Globals.ResetValues(); AssetManager.Globals.ResetValues();
foreach (var line in AssetManager.Config.GetLines()) foreach (var line in AssetManager.Config.GetLines())

View File

@@ -1,7 +1,7 @@
using System; using System;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using FidelityFX; //using FidelityFX;
using FlaxEditor.Content.Settings; using FlaxEditor.Content.Settings;
using FlaxEngine; using FlaxEngine;
@@ -10,7 +10,7 @@ namespace Game
// Holds Console variables and commands to control engine behaviour // Holds Console variables and commands to control engine behaviour
public static class EngineSubsystem public static class EngineSubsystem
{ {
private static FSR _fsrPlugin; //private static FSR _fsrPlugin;
// TODO: this should manually set all postprocessing values to 0 or disabled // TODO: this should manually set all postprocessing values to 0 or disabled
/*[ConsoleVariable("r_postprocessing")] /*[ConsoleVariable("r_postprocessing")]
@@ -98,7 +98,7 @@ namespace Game
} }
} }
public static FSR FsrPlugin /*public static FSR FsrPlugin
{ {
get get
{ {
@@ -143,6 +143,7 @@ namespace Game
} }
} }
} }
*/
[ConsoleVariable("cl_showweapon")] [ConsoleVariable("cl_showweapon")]
public static string ShowWeapon public static string ShowWeapon

View File

@@ -1070,7 +1070,7 @@ namespace Game
int modelIndex = 0; int modelIndex = 0;
// TODO: read sdf data from texture and dump it to file, and reuse it when generating sdf data // TODO: read sdf data from texture and dump it to file, and reuse it when generating sdf data
using var sha1 = new SHA1Managed(); /*using*/ var sha1 = new SHA1Managed();
string mapHash = sha1.ComputeHash(Encoding.UTF8.GetBytes(levelScript.MapName + levelScript.MapTimestamp.Ticks.ToString())).ToString(); string mapHash = sha1.ComputeHash(Encoding.UTF8.GetBytes(levelScript.MapName + levelScript.MapTimestamp.Ticks.ToString())).ToString();
foreach (var model in sdfModels.ToList()) foreach (var model in sdfModels.ToList())
@@ -1108,7 +1108,7 @@ namespace Game
var task = Task.Run(() => var task = Task.Run(() =>
{ {
Stopwatch sw = Stopwatch.StartNew(); Stopwatch sw2 = Stopwatch.StartNew();
FlaxEngine.Debug.Log($"Generating level SDF ({sdfModels.Count} models)..."); FlaxEngine.Debug.Log($"Generating level SDF ({sdfModels.Count} models)...");
ParallelOptions opts = new ParallelOptions(); ParallelOptions opts = new ParallelOptions();
@@ -1143,7 +1143,7 @@ namespace Game
}); });
FlaxEngine.Debug.Log($"Generated level SDF in {sw.Elapsed.TotalMilliseconds}ms"); FlaxEngine.Debug.Log($"Generated level SDF in {sw2.Elapsed.TotalMilliseconds}ms");
}); });
} }
} }

View File

@@ -52,7 +52,7 @@ namespace Game
if (initialized) if (initialized)
return; return;
if (Engine.CommandLine.Contains("-server")) /*if (Engine.CommandLine.Contains("-server"))
{ {
StartServer(); StartServer();
ServerAddress = "localhost"; ServerAddress = "localhost";
@@ -69,7 +69,7 @@ namespace Game
StartServer(); StartServer();
ServerAddress = "localhost"; ServerAddress = "localhost";
ConnectServer(); ConnectServer();
} }*/
//#endif //#endif
initialized = true; initialized = true;

View File

@@ -52,7 +52,7 @@ namespace Game
public override void Deinit() public override void Deinit()
{ {
FlaxEditor.Editor.Instance.PlayModeBegin -= OnPlayModeBegin; //FlaxEditor.Editor.Instance.PlayModeBegin -= OnPlayModeBegin;
} }
private void OnPlayModeBegin() private void OnPlayModeBegin()

View File

@@ -36,7 +36,7 @@ namespace Game
private static void OnClientUpdate() private static void OnClientUpdate()
{ {
using Utilities.ScopeProfiler _ = Utilities.ProfileScope("NetworkManager_OnClientUpdate"); /*using*/ Utilities.ScopeProfiler _ = Utilities.ProfileScope("NetworkManager_OnClientUpdate");
while (client.PopEvent(out NetworkEvent networkEvent)) while (client.PopEvent(out NetworkEvent networkEvent))
switch (networkEvent.EventType) switch (networkEvent.EventType)
@@ -98,6 +98,7 @@ namespace Game
default: default:
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();
} }
_.Dispose();
} }
private static void OnClientActorSpawned(Actor actor) private static void OnClientActorSpawned(Actor actor)

View File

@@ -94,7 +94,7 @@ namespace Game
private static void OnServerUpdate() private static void OnServerUpdate()
{ {
using Utilities.ScopeProfiler _ = Utilities.ProfileScope("NetworkManager_OnServerUpdate"); /*using*/ Utilities.ScopeProfiler _ = Utilities.ProfileScope("NetworkManager_OnServerUpdate");
while (server.PopEvent(out NetworkEvent networkEvent)) while (server.PopEvent(out NetworkEvent networkEvent))
switch (networkEvent.EventType) switch (networkEvent.EventType)
@@ -170,6 +170,7 @@ namespace Game
default: default:
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();
} }
_.Dispose();
} }
private static void OnServerActorSpawned(Actor actor) private static void OnServerActorSpawned(Actor actor)

View File

@@ -166,7 +166,7 @@ namespace Game
else if (playerId == NetworkManager.LocalPlayerClientId) else if (playerId == NetworkManager.LocalPlayerClientId)
{ {
Console.Print("local player: " + playerId.ToString()); Console.Print("local player: " + playerId.ToString());
string demoPath = System.IO.Path.Combine(AssetManager.DemoPath, $"{DateTimeOffset.Now.ToUnixTimeSeconds()}.gdem"); string demoPath = System.IO.Path.Combine(AssetManager.DemoPath, $"{DateTimeOffset.Now.UtcTicks}.gdem");
input = new PlayerInputLocal(demoPath); // TODO: support recording input = new PlayerInputLocal(demoPath); // TODO: support recording
PlayerId = playerId; PlayerId = playerId;
} }
@@ -400,7 +400,7 @@ namespace Game
if (distance < 0.00000001f) if (distance < 0.00000001f)
{ {
hits = Array.Empty<RayCastHit>(); hits = new RayCastHit[0];//Array.Empty<RayCastHit>();
return false; return false;
} }

View File

@@ -14,7 +14,7 @@ namespace Game
/// </summary> /// </summary>
public abstract class GGamePlugin : GamePlugin public abstract class GGamePlugin : GamePlugin
{ {
public virtual Type[] PluginDependencies { get => Array.Empty<Type>(); } public virtual Type[] PluginDependencies { get => new Type[0]; }
public bool Initialized { get; private set; } public bool Initialized { get; private set; }
public bool Deinitialized { get; private set; } public bool Deinitialized { get; private set; }
@@ -91,7 +91,7 @@ namespace Game
/// </summary> /// </summary>
public abstract class GEditorPlugin : EditorPlugin public abstract class GEditorPlugin : EditorPlugin
{ {
public virtual Type[] PluginDependencies { get => Array.Empty<Type>(); } public virtual Type[] PluginDependencies { get => new Type[0]; }
public bool Initialized { get; private set; } public bool Initialized { get; private set; }
public bool Deinitialized { get; private set; } public bool Deinitialized { get; private set; }