Live Demo Tweaks
Copied Main Menu to gameplay scene Added Pause functionality (ESC key) Save & Restore discovered zones Applied vertical offset to asteroids (no more intersections!) Nebula shader optimized to improve early exit Nebula shader outputs light scattering to second render target Modified depth of field shader to use nebula light scattering
This commit is contained in:
parent
968783bf9c
commit
ca1ce9859d
47 changed files with 5106 additions and 2385 deletions
|
|
@ -8,7 +8,7 @@ using Newtonsoft.Json;
|
|||
using Unity.Mathematics;
|
||||
using static Unity.Mathematics.math;
|
||||
|
||||
[MessagePackObject, JsonObject(MemberSerialization.OptIn), RuntimeInspectable]
|
||||
[Inspectable, MessagePackObject, JsonObject(MemberSerialization.OptIn), RuntimeInspectable]
|
||||
public class CapacitorData : BehaviorData
|
||||
{
|
||||
[Inspectable, JsonProperty("capacity"), Key(1), RuntimeInspectable]
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ using Newtonsoft.Json;
|
|||
using Unity.Mathematics;
|
||||
using static Unity.Mathematics.math;
|
||||
|
||||
[MessagePackObject, JsonObject(MemberSerialization.OptIn), RuntimeInspectable]
|
||||
[Inspectable, MessagePackObject, JsonObject(MemberSerialization.OptIn), RuntimeInspectable]
|
||||
public class CockpitData : BehaviorData
|
||||
{
|
||||
public override IBehavior CreateInstance(ItemManager context, Entity entity, EquippedItem item)
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ using Newtonsoft.Json;
|
|||
using Unity.Mathematics;
|
||||
using static Unity.Mathematics.math;
|
||||
|
||||
[MessagePackObject, JsonObject(MemberSerialization.OptIn), RuntimeInspectable]
|
||||
[Inspectable, MessagePackObject, JsonObject(MemberSerialization.OptIn), RuntimeInspectable]
|
||||
public class HeatStorageData : BehaviorData
|
||||
{
|
||||
public override IBehavior CreateInstance(ItemManager context, Entity entity, EquippedItem item)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ using Newtonsoft.Json;
|
|||
using Unity.Mathematics;
|
||||
using static Unity.Mathematics.math;
|
||||
|
||||
[MessagePackObject, JsonObject(MemberSerialization.OptIn), RuntimeInspectable]
|
||||
[Inspectable, MessagePackObject, JsonObject(MemberSerialization.OptIn), RuntimeInspectable]
|
||||
public class RadiatorData : BehaviorData
|
||||
{
|
||||
[Inspectable, JsonProperty("emissivity"), Key(1), RuntimeInspectable]
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ using UniRx;
|
|||
using Unity.Mathematics;
|
||||
using static Unity.Mathematics.math;
|
||||
|
||||
[MessagePackObject, JsonObject(MemberSerialization.OptIn), RuntimeInspectable]
|
||||
[Inspectable, MessagePackObject, JsonObject(MemberSerialization.OptIn), RuntimeInspectable]
|
||||
public class ReactorData : BehaviorData
|
||||
{
|
||||
[Inspectable, JsonProperty("charge"), Key(1), RuntimeInspectable]
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ using Newtonsoft.Json;
|
|||
using Unity.Mathematics;
|
||||
using static Unity.Mathematics.math;
|
||||
|
||||
[MessagePackObject, JsonObject(MemberSerialization.OptIn), RuntimeInspectable]
|
||||
[Inspectable, MessagePackObject, JsonObject(MemberSerialization.OptIn), RuntimeInspectable]
|
||||
public class ShieldData : BehaviorData
|
||||
{
|
||||
[Inspectable, JsonProperty("efficiency"), Key(1), RuntimeInspectable]
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ using Newtonsoft.Json;
|
|||
using Unity.Mathematics;
|
||||
using static Unity.Mathematics.math;
|
||||
|
||||
[MessagePackObject, JsonObject(MemberSerialization.OptIn), EntityTypeRestriction(HullType.Ship), RuntimeInspectable]
|
||||
[Inspectable, MessagePackObject, JsonObject(MemberSerialization.OptIn), EntityTypeRestriction(HullType.Ship), RuntimeInspectable]
|
||||
public class ThrusterData : BehaviorData
|
||||
{
|
||||
[Inspectable, JsonProperty("thrust"), Key(1), RuntimeInspectable]
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@ using Newtonsoft.Json;
|
|||
using Unity.Mathematics;
|
||||
using static Unity.Mathematics.math;
|
||||
|
||||
[Union(0, typeof(InstantWeaponData)),
|
||||
[Inspectable,
|
||||
Union(0, typeof(InstantWeaponData)),
|
||||
Union(1, typeof(LauncherData)),
|
||||
Union(2, typeof(ConstantWeaponData)),
|
||||
Union(3, typeof(ChargedWeaponData)),
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ using Newtonsoft.Json;
|
|||
using Unity.Mathematics;
|
||||
using static Unity.Mathematics.math;
|
||||
|
||||
[MessagePackObject, JsonObject(MemberSerialization.OptIn), Order(1000), RuntimeInspectable]
|
||||
[Inspectable, MessagePackObject, JsonObject(MemberSerialization.OptIn), Order(1000), RuntimeInspectable]
|
||||
public class WearData : BehaviorData
|
||||
{
|
||||
[InspectableTemperature, JsonProperty("perSecond"), Key(1)]
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ public class GlobalSettingsAttribute : Attribute { }
|
|||
[AttributeUsage(AttributeTargets.Class)]
|
||||
public class ExternalEntryAttribute : Attribute { }
|
||||
|
||||
[AttributeUsage(AttributeTargets.All, Inherited = false)]
|
||||
public class InspectableAttribute : Attribute { }
|
||||
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using MessagePack;
|
||||
using MessagePack.ReactivePropertyExtension;
|
||||
using MessagePack.Resolvers;
|
||||
|
||||
public static class RegisterResolver
|
||||
|
|
@ -15,7 +16,8 @@ public static class RegisterResolver
|
|||
MathResolver.Instance,
|
||||
TypeResolver.Instance,
|
||||
NativeGuidResolver.Instance,
|
||||
StandardResolver.Instance
|
||||
StandardResolver.Instance,
|
||||
ReactivePropertyResolver.Instance
|
||||
);
|
||||
var options = MessagePackSerializerOptions.Standard.WithResolver(resolver);
|
||||
MessagePackSerializer.DefaultOptions = options;
|
||||
|
|
|
|||
|
|
@ -393,7 +393,7 @@ public class DockingBayData : CargoBayData
|
|||
public int2 MaxSize;
|
||||
}
|
||||
|
||||
[RethinkTable("Items"), Inspectable, MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
||||
[RethinkTable("Items"), MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
||||
public class WeaponItemData : GearData
|
||||
{
|
||||
[Inspectable, JsonProperty("range"), Key(21)]
|
||||
|
|
|
|||
|
|
@ -34,16 +34,16 @@ public class ItemManager
|
|||
public CultCache ItemData { get; }
|
||||
public GameplaySettings GameplaySettings { get; }
|
||||
|
||||
public double Time
|
||||
{
|
||||
get => _time;
|
||||
set
|
||||
{
|
||||
_deltaTime = (float) (value - _time);
|
||||
_time = value;
|
||||
//Log($"GameContext delta time: {_deltaTime}");
|
||||
}
|
||||
}
|
||||
// public double Time
|
||||
// {
|
||||
// get => _time;
|
||||
// set
|
||||
// {
|
||||
// _deltaTime = (float) (value - _time);
|
||||
// _time = value;
|
||||
// //Log($"GameContext delta time: {_deltaTime}");
|
||||
// }
|
||||
// }
|
||||
|
||||
// private readonly Dictionary<CraftedItemData, int> Tier = new Dictionary<CraftedItemData, int>();
|
||||
|
||||
|
|
|
|||
|
|
@ -34,11 +34,15 @@ public class SavedGame
|
|||
|
||||
[Key(8)]
|
||||
public SectorGenerationSettings Settings;
|
||||
|
||||
[Key(9)]
|
||||
public int[] DiscoveredZones;
|
||||
|
||||
public SavedGame() { }
|
||||
|
||||
public SavedGame(Sector sector, Zone currentZone, Entity currentEntity)
|
||||
{
|
||||
DiscoveredZones = sector.DiscoveredZones.Select(dz => Array.IndexOf(sector.Zones, dz)).ToArray();
|
||||
Settings = sector.Settings;
|
||||
Factions = sector.HomeZones.Keys.Select(f => f.ID).ToArray();
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ using System.Threading.Tasks;
|
|||
using DataStructures.ViliWonka.Heap;
|
||||
using MIConvexHull;
|
||||
using JM.LinqFaster;
|
||||
using UniRx;
|
||||
using Unity.Mathematics;
|
||||
using static Unity.Mathematics.math;
|
||||
using Random = Unity.Mathematics.Random;
|
||||
|
|
@ -14,6 +15,7 @@ public class Sector
|
|||
{
|
||||
public Dictionary<Faction, SectorZone> HomeZones = new Dictionary<Faction, SectorZone>();
|
||||
public Dictionary<Faction, SectorZone> BossZones = new Dictionary<Faction, SectorZone>();
|
||||
public HashSet<SectorZone> DiscoveredZones = new HashSet<SectorZone>();
|
||||
|
||||
public SectorGenerationSettings Settings { get; }
|
||||
public Faction[] Factions { get; }
|
||||
|
|
@ -46,6 +48,7 @@ public class Sector
|
|||
PackedContents = zone.Contents
|
||||
};
|
||||
}).ToArray();
|
||||
foreach (var i in savedGame.DiscoveredZones) DiscoveredZones.Add(Zones[i]);
|
||||
for (var i = 0; i < Zones.Length; i++)
|
||||
{
|
||||
Zones[i].AdjacentZones = savedGame.Zones[i].AdjacentZones.Select(azi => Zones[azi]).ToList();
|
||||
|
|
@ -165,6 +168,9 @@ public class Sector
|
|||
// Entrance is the zone furthest from the exit
|
||||
Entrance = Zones.MaxBy(z => Exit.Distance[z]);
|
||||
|
||||
DiscoveredZones.Add(Entrance);
|
||||
foreach(var z in Entrance.AdjacentZones) DiscoveredZones.Add(z);
|
||||
|
||||
// Find all zones on the exit path where removing that zone would disconnect the entrance from the exit
|
||||
// Disregard "corridor" zones with only two adjacent zones
|
||||
var chokePoints = ExitPath
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ public class PlanetSettings
|
|||
public ExponentialCurve FogTintRadius;
|
||||
public ExponentialCurve LightRadius;
|
||||
public ExponentialCurve BodyRadius;
|
||||
public float AsteroidVerticalOffset = -5f;
|
||||
public ExponentialLerp AsteroidSize;
|
||||
public ExponentialLerp AsteroidHitpoints;
|
||||
public ExponentialLerp AsteroidRespawnTime;
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ public class Zone
|
|||
var pos = OrbitData.Evaluate((float) frac(_time / Settings.OrbitPeriod.Evaluate(beltData.Asteroids[i].Distance) +
|
||||
beltData.Asteroids[i].Phase)) * beltData.Asteroids[i].Distance + orbitPosition;
|
||||
belt.NewVelocities[i] = pos - belt.Positions[i].xz;
|
||||
belt.NewPositions[i] = float3(pos.x, GetHeight(pos), pos.y);
|
||||
belt.NewPositions[i] = float3(pos.x, GetHeight(pos) + Settings.AsteroidVerticalOffset, pos.y);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue