diff --git a/Assets/SimulationConfigSimple.asset.meta b/Assets/Configs.meta similarity index 52% rename from Assets/SimulationConfigSimple.asset.meta rename to Assets/Configs.meta index 4dc46f8..c438ad9 100644 --- a/Assets/SimulationConfigSimple.asset.meta +++ b/Assets/Configs.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: f95ae714d3d58b64aaea2fb7b009af9f -NativeFormatImporter: +guid: df58f75918cee2c48bb2986daa4c7f8d +folderAsset: yes +DefaultImporter: externalObjects: {} - mainObjectFileID: 11400000 userData: assetBundleName: assetBundleVariant: diff --git a/Assets/Configs/simulation_config.proto b/Assets/Configs/simulation_config.proto new file mode 100644 index 0000000..38b32ac --- /dev/null +++ b/Assets/Configs/simulation_config.proto @@ -0,0 +1,98 @@ +syntax = "proto3"; + +package SimulationConfigProto; + +message ProtobufConfig { + double step_time = 1; + repeated MissileConfigProto missile_configs = 2; + repeated TargetConfigProto target_configs = 3; +} + +enum MissileTypeProto { + HYDRA_70 = 0; + MICROMISSILE = 1; +} + +enum TargetTypeProto { + DRONE = 0; + MISSILE = 1; +} + +enum ConfigColorProto { + BLUE = 0; + GREEN = 1; + RED = 2; +} + +enum LineStyleProto { + DOTTED = 0; + SOLID = 1; +} + +enum MarkerProto { + TRIANGLE_UP = 0; + TRIANGLE_DOWN = 1; + SQUARE = 2; +} + +enum SensorTypeProto { + IDEAL = 0; +} + +message Vector3Proto { + double x = 1; + double y = 2; + double z = 3; +} + +message InitialStateProto { + Vector3Proto position = 1; + Vector3Proto velocity = 2; +} + +message LaunchConfigProto { + double launch_time = 1; +} + +message SensorConfigProto { + SensorTypeProto type = 1; + double frequency = 2; +} + +message DynamicConfigProto { + LaunchConfigProto launch_config = 1; + SensorConfigProto sensor_config = 2; +} + +message PlottingConfigProto { + ConfigColorProto color = 1; + LineStyleProto linestyle = 2; + MarkerProto marker = 3; +} + +message SubmunitionAgentConfigProto { + MissileTypeProto missile_type = 1; + InitialStateProto initial_state = 2; + DynamicConfigProto dynamic_config = 3; + PlottingConfigProto plotting_config = 4; +} + +message SubmunitionsConfigProto { + int32 num_submunitions = 1; + LaunchConfigProto launch_config = 2; + SubmunitionAgentConfigProto agent_config = 3; +} + +message MissileConfigProto { + MissileTypeProto missile_type = 1; + InitialStateProto initial_state = 2; + DynamicConfigProto dynamic_config = 3; + PlottingConfigProto plotting_config = 4; + SubmunitionsConfigProto submunitions_config = 5; +} + +message TargetConfigProto { + TargetTypeProto target_type = 1; + InitialStateProto initial_state = 2; + PlottingConfigProto plotting_config = 3; +} \ No newline at end of file diff --git a/Assets/SimulationConfigHydra70.asset.meta b/Assets/Configs/simulation_config.proto.meta similarity index 52% rename from Assets/SimulationConfigHydra70.asset.meta rename to Assets/Configs/simulation_config.proto.meta index c88d77d..13938d6 100644 --- a/Assets/SimulationConfigHydra70.asset.meta +++ b/Assets/Configs/simulation_config.proto.meta @@ -1,8 +1,7 @@ fileFormatVersion: 2 -guid: 6d7c61b7d025c9b49b3410fd1195a525 -NativeFormatImporter: +guid: a739996d4385c0f408a96e21ca42a239 +DefaultImporter: externalObjects: {} - mainObjectFileID: 11400000 userData: assetBundleName: assetBundleVariant: diff --git a/Assets/Scenes/MainScene.unity b/Assets/Scenes/MainScene.unity index e2b9cc6..4f90e43 100644 --- a/Assets/Scenes/MainScene.unity +++ b/Assets/Scenes/MainScene.unity @@ -2626,6 +2626,37 @@ MeshRenderer: m_SortingLayer: 0 m_SortingOrder: 0 m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &1960520300 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1960520301} + m_Layer: 0 + m_Name: GameObject + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1960520301 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1960520300} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 1715.5709, y: 1660.0452, z: 811.7122} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &2052906803 GameObject: m_ObjectHideFlags: 0 @@ -2705,3 +2736,4 @@ SceneRoots: - {fileID: 1255004942} - {fileID: 564968303} - {fileID: 1457077473} + - {fileID: 1960520301} diff --git a/Assets/Scripts/Config/ConfigLoader.cs b/Assets/Scripts/Config/ConfigLoader.cs new file mode 100644 index 0000000..6ecf771 --- /dev/null +++ b/Assets/Scripts/Config/ConfigLoader.cs @@ -0,0 +1,117 @@ +using System.IO; +using UnityEngine; +using Newtonsoft.Json; + +public static class ConfigLoader { + public static SimulationConfig LoadSimulationConfig(string configFileName) { + string configFilePath = Path.Combine(Application.streamingAssetsPath, "Configs", configFileName); + if (File.Exists(configFilePath)) { + string json = File.ReadAllText(configFilePath); + SimulationConfig config = JsonConvert.DeserializeObject(json, new JsonSerializerSettings { + Converters = { new Newtonsoft.Json.Converters.StringEnumConverter() } + }); + return config; + } else { + Debug.LogError($"Configuration file not found at path: {configFilePath}"); + return null; + } + } + + public static void PrintSimulationConfig(SimulationConfig config) + { + if (config == null) + { + Debug.Log("SimulationConfig is null"); + return; + } + + Debug.Log("SimulationConfig:"); + Debug.Log($"Time Scale: {config.timeScale}"); + + Debug.Log("Missile Swarm Configurations:"); + for (int i = 0; i < config.missile_swarm_configs.Count; i++) + { + PrintSwarmConfig(config.missile_swarm_configs[i], $"Missile Swarm {i + 1}"); + } + + Debug.Log("Target Swarm Configurations:"); + for (int i = 0; i < config.target_swarm_configs.Count; i++) + { + PrintSwarmConfig(config.target_swarm_configs[i], $"Target Swarm {i + 1}"); + } + } + + private static void PrintSwarmConfig(SwarmConfig swarmConfig, string swarmName) + { + Debug.Log($"{swarmName}:"); + Debug.Log($" Number of Agents: {swarmConfig.num_agents}"); + PrintAgentConfig(swarmConfig.agent_config); + } + + private static void PrintAgentConfig(AgentConfig agentConfig) + { + Debug.Log(" Agent Configuration:"); + Debug.Log($" Missile Type: {agentConfig.missile_type}"); + Debug.Log($" Target Type: {agentConfig.target_type}"); + PrintInitialState(agentConfig.initial_state); + PrintStandardDeviation(agentConfig.standard_deviation); + PrintDynamicConfig(agentConfig.dynamic_config); + PrintPlottingConfig(agentConfig.plotting_config); + PrintSubmunitionsConfig(agentConfig.submunitions_config); + } + + private static void PrintInitialState(InitialState initialState) + { + Debug.Log(" Initial State:"); + Debug.Log($" Position: {initialState.position}"); + Debug.Log($" Rotation: {initialState.rotation}"); + Debug.Log($" Velocity: {initialState.velocity}"); + } + + private static void PrintStandardDeviation(StandardDeviation standardDeviation) + { + Debug.Log(" Standard Deviation:"); + Debug.Log($" Position: {standardDeviation.position}"); + Debug.Log($" Velocity: {standardDeviation.velocity}"); + } + + private static void PrintDynamicConfig(DynamicConfig dynamicConfig) + { + Debug.Log(" Dynamic Configuration:"); + Debug.Log($" Launch Time: {dynamicConfig.launch_config.launch_time}"); + Debug.Log($" Sensor Type: {dynamicConfig.sensor_config.type}"); + Debug.Log($" Sensor Frequency: {dynamicConfig.sensor_config.frequency}"); + } + + private static void PrintPlottingConfig(PlottingConfig plottingConfig) + { + Debug.Log(" Plotting Configuration:"); + Debug.Log($" Color: {plottingConfig.color}"); + Debug.Log($" Line Style: {plottingConfig.linestyle}"); + Debug.Log($" Marker: {plottingConfig.marker}"); + } + + private static void PrintSubmunitionsConfig(SubmunitionsConfig submunitionsConfig) + { + if (submunitionsConfig == null) + { + Debug.Log(" Submunitions Configuration: None"); + return; + } + + Debug.Log(" Submunitions Configuration:"); + Debug.Log($" Number of Submunitions: {submunitionsConfig.num_submunitions}"); + Debug.Log($" Launch Time: {submunitionsConfig.launch_config.launch_time}"); + PrintSubmunitionAgentConfig(submunitionsConfig.agent_config); + } + + private static void PrintSubmunitionAgentConfig(SubmunitionAgentConfig agentConfig) + { + Debug.Log(" Submunition Agent Configuration:"); + Debug.Log($" Missile Type: {agentConfig.missile_type}"); + PrintInitialState(agentConfig.initial_state); + PrintStandardDeviation(agentConfig.standard_deviation); + PrintDynamicConfig(agentConfig.dynamic_config); + PrintPlottingConfig(agentConfig.plotting_config); + } +} \ No newline at end of file diff --git a/Assets/Scripts/Config/ConfigLoader.cs.meta b/Assets/Scripts/Config/ConfigLoader.cs.meta new file mode 100644 index 0000000..2141bd2 --- /dev/null +++ b/Assets/Scripts/Config/ConfigLoader.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: da3b9eead33b94a4f8df7a4af7a79d49 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Config/SimulationConfig.cs b/Assets/Scripts/Config/SimulationConfig.cs index 94b3b70..7fa87a2 100644 --- a/Assets/Scripts/Config/SimulationConfig.cs +++ b/Assets/Scripts/Config/SimulationConfig.cs @@ -1,119 +1,123 @@ -using System.Collections; +using System; using System.Collections.Generic; using UnityEngine; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; -[CreateAssetMenu(fileName = "SimulationConfig", menuName = "Simulation/Config", order = 1)] -public class SimulationConfig : ScriptableObject { - [Header("Simulation Settings")] - public float timeScale = 0.05f; - [Header("Missile Swarm Configurations")] - public List missile_swarm_configs = new List(); +[Serializable] +public class SimulationConfig { + [Header("Simulation Settings")] + public float timeScale = 0.05f; - [Header("Target Swarm Configurations")] - public List target_swarm_configs = new List(); + [Header("Missile Swarm Configurations")] + public List missile_swarm_configs = new List(); + + [Header("Target Swarm Configurations")] + public List target_swarm_configs = new List(); } -[System.Serializable] +[Serializable] public class DynamicConfig { - public LaunchConfig launch_config; - public SensorConfig sensor_config; + public LaunchConfig launch_config; + public SensorConfig sensor_config; } -[System.Serializable] + [Serializable] public class SwarmConfig { - public int num_agents; - public AgentConfig agent_config; + public int num_agents; + public AgentConfig agent_config; } -[System.Serializable] +[Serializable] public class AgentConfig { - public MissileType missile_type; - public TargetType target_type; - public InitialState initial_state; - public StandardDeviation standard_deviation; - public DynamicConfig dynamic_config; - public PlottingConfig plotting_config; - public SubmunitionsConfig submunitions_config; + public MissileType missile_type; + public TargetType target_type; + public InitialState initial_state; + public StandardDeviation standard_deviation; + public DynamicConfig dynamic_config; + public PlottingConfig plotting_config; + public SubmunitionsConfig submunitions_config; - public static AgentConfig FromSubmunitionAgentConfig(SubmunitionAgentConfig submunitionConfig) { - return new AgentConfig { - missile_type = submunitionConfig.missile_type, - initial_state = submunitionConfig.initial_state, - standard_deviation = submunitionConfig.standard_deviation, - dynamic_config = submunitionConfig.dynamic_config, - plotting_config = submunitionConfig.plotting_config, - - // Set other fields as needed, using default values if not present in SubmunitionAgentConfig - target_type = TargetType.DRONE, // Or another default value - submunitions_config = null // Or a default value if needed - }; - } + public static AgentConfig FromSubmunitionAgentConfig(SubmunitionAgentConfig submunitionConfig) { + return new AgentConfig { + missile_type = submunitionConfig.missile_type, + initial_state = submunitionConfig.initial_state, + standard_deviation = submunitionConfig.standard_deviation, + dynamic_config = submunitionConfig.dynamic_config, + plotting_config = submunitionConfig.plotting_config, + // Set other fields as needed, using default values if not present in SubmunitionAgentConfig + target_type = TargetType.DRONE, // Or another default value + submunitions_config = null // Or a default value if needed + }; + } } -[System.Serializable] +[Serializable] public class InitialState { - public Vector3 position; - public Vector3 rotation; - public Vector3 velocity; + public Vector3 position; + public Vector3 rotation; + public Vector3 velocity; } -[System.Serializable] +[Serializable] public class StandardDeviation { - public Vector3 position; - public Vector3 velocity; + public Vector3 position; + public Vector3 velocity; } -[System.Serializable] +[Serializable] public class LaunchConfig { - public float launch_time; + public float launch_time; } -[System.Serializable] +[Serializable] public class PlottingConfig { - public Color color; - public LineStyle linestyle; - public Marker marker; + public ConfigColor color; + public LineStyle linestyle; + public Marker marker; } -[System.Serializable] +[Serializable] public class SubmunitionsConfig { - public int num_submunitions; - public LaunchConfig launch_config; - public SubmunitionAgentConfig agent_config; + public int num_submunitions; + public LaunchConfig launch_config; + public SubmunitionAgentConfig agent_config; } -[System.Serializable] +[Serializable] public class SubmunitionAgentConfig { - public MissileType missile_type; - public InitialState initial_state; - public StandardDeviation standard_deviation; - public DynamicConfig dynamic_config; - public PlottingConfig plotting_config; + public MissileType missile_type; + public InitialState initial_state; + public StandardDeviation standard_deviation; + public DynamicConfig dynamic_config; + public PlottingConfig plotting_config; } -[System.Serializable] +[Serializable] public class SensorConfig { - public SensorType type; - public float frequency; + public SensorType type; + public float frequency; } -[System.Serializable] +[Serializable] public class TargetConfig { - public TargetType target_type; - public InitialState initial_state; - public PlottingConfig plotting_config; - public string prefabName; + public TargetType target_type; + public InitialState initial_state; + public PlottingConfig plotting_config; + public string prefabName; } +// Enums +[JsonConverter(typeof(StringEnumConverter))] public enum MissileType { HYDRA_70, MICROMISSILE } - +[JsonConverter(typeof(StringEnumConverter))] public enum TargetType { DRONE, MISSILE } - +[JsonConverter(typeof(StringEnumConverter))] public enum ConfigColor { BLUE, GREEN, RED } - +[JsonConverter(typeof(StringEnumConverter))] public enum LineStyle { DOTTED, SOLID } - +[JsonConverter(typeof(StringEnumConverter))] public enum Marker { TRIANGLE_UP, TRIANGLE_DOWN, SQUARE } - +[JsonConverter(typeof(StringEnumConverter))] public enum SensorType { IDEAL } \ No newline at end of file diff --git a/Assets/Scripts/SimManager.cs b/Assets/Scripts/SimManager.cs index 4f383c6..587defd 100644 --- a/Assets/Scripts/SimManager.cs +++ b/Assets/Scripts/SimManager.cs @@ -61,6 +61,8 @@ public class SimManager : MonoBehaviour { } else { Destroy(gameObject); } + simulationConfig = ConfigLoader.LoadSimulationConfig("seven_missiles_seven_drone_targets.json"); + Debug.Log(simulationConfig); } void Start() { diff --git a/Assets/SimulationConfigHydra70.asset b/Assets/SimulationConfigHydra70.asset deleted file mode 100644 index 5c84786..0000000 --- a/Assets/SimulationConfigHydra70.asset +++ /dev/null @@ -1,193 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 79f1fe138866d6a40b209a4edcf2ee06, type: 3} - m_Name: SimulationConfigHydra70 - m_EditorClassIdentifier: - timeScale: 1 - missile_swarm_configs: - - num_agents: 10 - agent_config: - missile_type: 0 - target_type: 0 - initial_state: - position: {x: 0, y: 20, z: 0} - rotation: {x: -45, y: 0, z: 0} - velocity: {x: 0, y: 10, z: 10} - standard_deviation: - position: {x: 10, y: 0, z: 10} - velocity: {x: 5, y: 0, z: 1} - dynamic_config: - launch_config: - launch_time: 0 - sensor_config: - type: 0 - frequency: 100 - plotting_config: - color: {r: 0, g: 0, b: 0, a: 0} - linestyle: 0 - marker: 0 - submunitions_config: - num_submunitions: 7 - launch_config: - launch_time: 4 - agent_config: - missile_type: 1 - initial_state: - position: {x: -171.3253, y: 683.85236, z: 846.74677} - rotation: {x: 0, y: 0, z: 0} - velocity: {x: -45.325005, y: 110.16025, z: 216.10002} - standard_deviation: - position: {x: 5, y: 5, z: 5} - velocity: {x: 0, y: 0, z: 0} - dynamic_config: - launch_config: - launch_time: 0 - sensor_config: - type: 0 - frequency: 100 - plotting_config: - color: {r: 0, g: 0, b: 0, a: 0} - linestyle: 0 - marker: 0 - - num_agents: 10 - agent_config: - missile_type: 0 - target_type: 0 - initial_state: - position: {x: 200, y: 20, z: 0} - rotation: {x: -60, y: 0, z: 0} - velocity: {x: 0, y: 10, z: 12} - standard_deviation: - position: {x: 10, y: 0, z: 10} - velocity: {x: 5, y: 0, z: 1} - dynamic_config: - launch_config: - launch_time: 10 - sensor_config: - type: 0 - frequency: 100 - plotting_config: - color: {r: 0, g: 0, b: 0, a: 0} - linestyle: 0 - marker: 0 - submunitions_config: - num_submunitions: 7 - launch_config: - launch_time: 12 - agent_config: - missile_type: 1 - initial_state: - position: {x: -3.2042065, y: 781.2401, z: 1043.2384} - rotation: {x: 0, y: 0, z: 0} - velocity: {x: -72.93396, y: 249.48598, z: 385.07947} - standard_deviation: - position: {x: 5, y: 5, z: 5} - velocity: {x: 0, y: 0, z: 0} - dynamic_config: - launch_config: - launch_time: 0 - sensor_config: - type: 0 - frequency: 100 - plotting_config: - color: {r: 0, g: 0, b: 0, a: 0} - linestyle: 0 - marker: 0 - - num_agents: 10 - agent_config: - missile_type: 0 - target_type: 0 - initial_state: - position: {x: -100, y: 20, z: 0} - rotation: {x: -45, y: 0, z: 0} - velocity: {x: 0, y: 10, z: 10} - standard_deviation: - position: {x: 10, y: 0, z: 10} - velocity: {x: 5, y: 0, z: 3} - dynamic_config: - launch_config: - launch_time: 20 - sensor_config: - type: 0 - frequency: 100 - plotting_config: - color: {r: 0, g: 0, b: 0, a: 0} - linestyle: 0 - marker: 0 - submunitions_config: - num_submunitions: 7 - launch_config: - launch_time: 23 - agent_config: - missile_type: 1 - initial_state: - position: {x: -246.4463, y: 976.02924, z: 1081.1262} - rotation: {x: 0, y: 0, z: 0} - velocity: {x: -31.540234, y: 178.44958, z: 249.32939} - standard_deviation: - position: {x: 5, y: 5, z: 5} - velocity: {x: 0, y: 0, z: 0} - dynamic_config: - launch_config: - launch_time: 0 - sensor_config: - type: 0 - frequency: 100 - plotting_config: - color: {r: 0, g: 0, b: 0, a: 0} - linestyle: 0 - marker: 0 - target_swarm_configs: - - num_agents: 200 - agent_config: - missile_type: 0 - target_type: 0 - initial_state: - position: {x: 0, y: 600, z: 6000} - rotation: {x: 90, y: 0, z: 0} - velocity: {x: 0, y: 0, z: -50} - standard_deviation: - position: {x: 1000, y: 200, z: 100} - velocity: {x: 0, y: 0, z: 25} - dynamic_config: - launch_config: - launch_time: 0 - sensor_config: - type: 0 - frequency: 0 - plotting_config: - color: {r: 0, g: 0, b: 0, a: 0} - linestyle: 0 - marker: 0 - submunitions_config: - num_submunitions: 0 - launch_config: - launch_time: 0 - agent_config: - missile_type: 0 - initial_state: - position: {x: 0, y: 0, z: 0} - rotation: {x: 0, y: 0, z: 0} - velocity: {x: 0, y: 0, z: 0} - standard_deviation: - position: {x: 0, y: 0, z: 0} - velocity: {x: 0, y: 0, z: 0} - dynamic_config: - launch_config: - launch_time: 0 - sensor_config: - type: 0 - frequency: 0 - plotting_config: - color: {r: 0, g: 0, b: 0, a: 0} - linestyle: 0 - marker: 0 diff --git a/Assets/SimulationConfigMany.asset b/Assets/SimulationConfigMany.asset deleted file mode 100644 index b1f84d3..0000000 --- a/Assets/SimulationConfigMany.asset +++ /dev/null @@ -1,109 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 79f1fe138866d6a40b209a4edcf2ee06, type: 3} - m_Name: SimulationConfigMany - m_EditorClassIdentifier: - timeScale: 0.2 - missile_swarm_configs: - - num_agents: 200 - agent_config: - missile_type: 1 - target_type: 0 - initial_state: - position: {x: 0, y: 10, z: 0} - rotation: {x: -45, y: 0, z: 0} - velocity: {x: 0, y: 0, z: 10} - standard_deviation: - position: {x: 10, y: 10, z: 10} - velocity: {x: 0, y: 0, z: 0} - dynamic_config: - launch_config: - launch_time: 0 - sensor_config: - type: 0 - frequency: 0 - plotting_config: - color: {r: 0, g: 0, b: 0, a: 0} - linestyle: 0 - marker: 0 - submunitions_config: - num_submunitions: 0 - launch_config: - launch_time: 0 - agent_config: - missile_type: 0 - initial_state: - position: {x: 0, y: 0, z: 0} - rotation: {x: 0, y: 0, z: 0} - velocity: {x: 0, y: 0, z: 0} - standard_deviation: - position: {x: 0, y: 0, z: 0} - velocity: {x: 0, y: 0, z: 0} - dynamic_config: - launch_config: - launch_time: 0 - sensor_config: - type: 0 - frequency: 0 - plotting_config: - color: {r: 0, g: 0, b: 0, a: 0} - linestyle: 0 - marker: 0 - prefabName: - prefabName: Micromissile - target_swarm_configs: - - num_agents: 200 - agent_config: - missile_type: 0 - target_type: 0 - initial_state: - position: {x: 0, y: 400, z: 3000} - rotation: {x: 90, y: 0, z: 0} - velocity: {x: 0, y: 0, z: -150} - standard_deviation: - position: {x: 500, y: 200, z: 100} - velocity: {x: 0, y: 0, z: 50} - dynamic_config: - launch_config: - launch_time: 0 - sensor_config: - type: 0 - frequency: 0 - plotting_config: - color: {r: 0, g: 0, b: 0, a: 0} - linestyle: 0 - marker: 0 - submunitions_config: - num_submunitions: 0 - launch_config: - launch_time: 0 - agent_config: - missile_type: 0 - initial_state: - position: {x: 0, y: 0, z: 0} - rotation: {x: 0, y: 0, z: 0} - velocity: {x: 0, y: 0, z: 0} - standard_deviation: - position: {x: 0, y: 0, z: 0} - velocity: {x: 0, y: 0, z: 0} - dynamic_config: - launch_config: - launch_time: 0 - sensor_config: - type: 0 - frequency: 0 - plotting_config: - color: {r: 0, g: 0, b: 0, a: 0} - linestyle: 0 - marker: 0 - prefabName: - prefabName: DroneTarget diff --git a/Assets/SimulationConfigSimple.asset b/Assets/SimulationConfigSimple.asset deleted file mode 100644 index 552288a..0000000 --- a/Assets/SimulationConfigSimple.asset +++ /dev/null @@ -1,105 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 79f1fe138866d6a40b209a4edcf2ee06, type: 3} - m_Name: SimulationConfigSimple - m_EditorClassIdentifier: - timeScale: 1 - missile_swarm_configs: - - num_agents: 1 - agent_config: - missile_type: 0 - target_type: 0 - initial_state: - position: {x: 0, y: 20, z: 0} - rotation: {x: -45, y: 0, z: 0} - velocity: {x: 0, y: 10, z: 10} - standard_deviation: - position: {x: 10, y: 0, z: 10} - velocity: {x: 5, y: 0, z: 1} - dynamic_config: - launch_config: - launch_time: 0 - sensor_config: - type: 0 - frequency: 100 - plotting_config: - color: {r: 0, g: 0, b: 0, a: 0} - linestyle: 0 - marker: 0 - submunitions_config: - num_submunitions: 7 - launch_config: - launch_time: 4 - agent_config: - missile_type: 1 - initial_state: - position: {x: 0, y: 0, z: 0} - rotation: {x: 0, y: 0, z: 0} - velocity: {x: 0, y: 0, z: 0} - standard_deviation: - position: {x: 5, y: 5, z: 5} - velocity: {x: 0, y: 0, z: 0} - dynamic_config: - launch_config: - launch_time: 0 - sensor_config: - type: 0 - frequency: 100 - plotting_config: - color: {r: 0, g: 0, b: 0, a: 0} - linestyle: 0 - marker: 0 - target_swarm_configs: - - num_agents: 7 - agent_config: - missile_type: 0 - target_type: 0 - initial_state: - position: {x: 0, y: 600, z: 6000} - rotation: {x: 90, y: 0, z: 0} - velocity: {x: 0, y: 0, z: -50} - standard_deviation: - position: {x: 1000, y: 200, z: 100} - velocity: {x: 0, y: 0, z: 25} - dynamic_config: - launch_config: - launch_time: 0 - sensor_config: - type: 0 - frequency: 0 - plotting_config: - color: {r: 0, g: 0, b: 0, a: 0} - linestyle: 0 - marker: 0 - submunitions_config: - num_submunitions: 0 - launch_config: - launch_time: 0 - agent_config: - missile_type: 0 - initial_state: - position: {x: 0, y: 0, z: 0} - rotation: {x: 0, y: 0, z: 0} - velocity: {x: 0, y: 0, z: 0} - standard_deviation: - position: {x: 0, y: 0, z: 0} - velocity: {x: 0, y: 0, z: 0} - dynamic_config: - launch_config: - launch_time: 0 - sensor_config: - type: 0 - frequency: 0 - plotting_config: - color: {r: 0, g: 0, b: 0, a: 0} - linestyle: 0 - marker: 0 diff --git a/Assets/SimulationConfigMany.asset.meta b/Assets/StreamingAssets.meta similarity index 52% rename from Assets/SimulationConfigMany.asset.meta rename to Assets/StreamingAssets.meta index 30ff1a7..87a9c2f 100644 --- a/Assets/SimulationConfigMany.asset.meta +++ b/Assets/StreamingAssets.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: b7e9e8f13e8db0f47a33344c45790f20 -NativeFormatImporter: +guid: 4357e847dbac6fc47886c005b4206b1f +folderAsset: yes +DefaultImporter: externalObjects: {} - mainObjectFileID: 11400000 userData: assetBundleName: assetBundleVariant: diff --git a/Assets/StreamingAssets/Configs.meta b/Assets/StreamingAssets/Configs.meta new file mode 100644 index 0000000..e520da4 --- /dev/null +++ b/Assets/StreamingAssets/Configs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 70b0ca10540c7004da69662c480a00cc +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/StreamingAssets/Configs/seven_missiles_seven_drone_targets.json b/Assets/StreamingAssets/Configs/seven_missiles_seven_drone_targets.json new file mode 100644 index 0000000..1a8a1c9 --- /dev/null +++ b/Assets/StreamingAssets/Configs/seven_missiles_seven_drone_targets.json @@ -0,0 +1,99 @@ +{ + "timeScale": 1, + "missile_swarm_configs": [ + { + "num_agents": 1, + "agent_config": { + "missile_type": "HYDRA_70", + "target_type": "DRONE", + "initial_state": { + "position": { "x": 0, "y": 20, "z": 0 }, + "rotation": { "x": -45, "y": 0, "z": 0 }, + "velocity": { "x": 0, "y": 10, "z": 10 } + }, + "standard_deviation": { + "position": { "x": 10, "y": 0, "z": 10 }, + "velocity": { "x": 5, "y": 0, "z": 1 } + }, + "dynamic_config": { + "launch_config": { "launch_time": 0 }, + "sensor_config": { + "type": "IDEAL", + "frequency": 100 + } + }, + "submunitions_config": { + "num_submunitions": 7, + "launch_config": { "launch_time": 4 }, + "agent_config": { + "missile_type": "MICROMISSILE", + "initial_state": { + "position": { "x": 0, "y": 0, "z": 0 }, + "rotation": { "x": 0, "y": 0, "z": 0 }, + "velocity": { "x": 0, "y": 0, "z": 0 } + }, + "standard_deviation": { + "position": { "x": 5, "y": 5, "z": 5 }, + "velocity": { "x": 0, "y": 0, "z": 0 } + }, + "dynamic_config": { + "launch_config": { "launch_time": 0 }, + "sensor_config": { + "type": "IDEAL", + "frequency": 100 + } + } + } + } + } + } + ], + "target_swarm_configs": [ + { + "num_agents": 7, + "agent_config": { + "missile_type": "HYDRA_70", + "target_type": "DRONE", + "initial_state": { + "position": { "x": 0, "y": 600, "z": 6000 }, + "rotation": { "x": 90, "y": 0, "z": 0 }, + "velocity": { "x": 0, "y": 0, "z": -50 } + }, + "standard_deviation": { + "position": { "x": 1000, "y": 200, "z": 100 }, + "velocity": { "x": 0, "y": 0, "z": 25 } + }, + "dynamic_config": { + "launch_config": { "launch_time": 0 }, + "sensor_config": { + "type": "IDEAL", + "frequency": 0 + } + }, + "submunitions_config": { + "num_submunitions": 0, + "launch_config": { "launch_time": 0 }, + "agent_config": { + "missile_type": "HYDRA_70", + "initial_state": { + "position": { "x": 0, "y": 0, "z": 0 }, + "rotation": { "x": 0, "y": 0, "z": 0 }, + "velocity": { "x": 0, "y": 0, "z": 0 } + }, + "standard_deviation": { + "position": { "x": 0, "y": 0, "z": 0 }, + "velocity": { "x": 0, "y": 0, "z": 0 } + }, + "dynamic_config": { + "launch_config": { "launch_time": 0 }, + "sensor_config": { + "type": "IDEAL", + "frequency": 0 + } + } + } + } + } + } + ] +} \ No newline at end of file diff --git a/Assets/StreamingAssets/Configs/seven_missiles_seven_drone_targets.json.meta b/Assets/StreamingAssets/Configs/seven_missiles_seven_drone_targets.json.meta new file mode 100644 index 0000000..9de1279 --- /dev/null +++ b/Assets/StreamingAssets/Configs/seven_missiles_seven_drone_targets.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: e0c9493619e84524083dc7a2928765c8 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/manifest.json b/Packages/manifest.json index 5af7236..aa56620 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -3,6 +3,7 @@ "com.unity.collab-proxy": "2.5.1", "com.unity.feature.development": "1.0.1", "com.unity.ide.cursor": "https://github.com/boxqkrtm/com.unity.ide.cursor.git", + "com.unity.nuget.newtonsoft-json": "3.2.1", "com.unity.render-pipelines.universal": "14.0.11", "com.unity.textmeshpro": "3.0.6", "com.unity.timeline": "1.7.6", diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index 534ff6b..8761560 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -86,6 +86,13 @@ "dependencies": {}, "url": "https://packages.unity.com" }, + "com.unity.nuget.newtonsoft-json": { + "version": "3.2.1", + "depth": 0, + "source": "registry", + "dependencies": {}, + "url": "https://packages.unity.com" + }, "com.unity.performance.profile-analyzer": { "version": "1.2.2", "depth": 1,