From 21344950459c0fac09b733d57f1665bb0e9c9aad Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Tue, 6 Jan 2026 15:03:52 +0100 Subject: [PATCH] (A little) Performance improvements --- .editorconfig | 34 +- .../NanoBrain/LinearAlgebra/src/Direction.cs | 71 +- .../NanoBrain/LinearAlgebra/src/Spherical.cs | 25 + Assets/NanoBrain/Neuroid.cs | 17 +- Assets/NanoBrain/Nucleus.cs | 7 +- Assets/NanoBrain/Perception.cs | 60 +- Assets/NanoBrain/Perceptoid.cs | 80 +- Assets/NanoBrain/Receptor.cs | 75 +- Assets/NanoBrain/SensoryNeuroid.cs | 88 +- .../VisualEditor/Editor/NanoBrainInspector.cs | 5 +- Assets/NanoBrain/VisualEditor/NanoBrainObj.cs | 12 +- Assets/Scenes/Boids/Boids.unity | 2 +- Assets/Scenes/Boids/Scripts/Boid.cs | 6 +- Assets/Scenes/Boids/Scripts/RoamingNucleus.cs | 4 +- .../Scenes/Boids/Scripts/SwarmingNucleus.cs | 56 +- Assets/Scenes/Boids/SwarmingBrain.asset | 870 ++++++------------ 16 files changed, 589 insertions(+), 823 deletions(-) diff --git a/.editorconfig b/.editorconfig index 64e4e80..1ec7f97 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,23 +1,19 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# top-most EditorConfig file root = true +[*] +indent_style = space +indent_size = 4 +end_of_line = crlf +charset = utf-8 +trim_trailing_whitespace = false +insert_final_newline = false +max_line_length = 80 + [*.cs] -# Use tabs for indentation -indent_style = space # To use spaces, you could set this to 'space' -indent_size = 2 # Standard C# indent size - -# Alignment and Style Rules -csharp_indent_case_contents = true -csharp_new_line_after_open_brace = all csharp_new_line_before_open_brace = none -csharp_new_line_before_else = true -csharp_new_line_before_catch = true -csharp_new_line_before_finally = true -csharp_new_line_before_members_in_object_initializers = true -csharp_new_line_before_members_in_anonymous_types = true -csharp_new_line_between_query_expression_clauses = true - -# Limit the number of characters in a line -max_line_length = 100 # This setting does not enforce it; it's a guideline. - -[*.{cs,vb}] -dotnet_diagnostic.IDE1006.severity = none \ No newline at end of file +# Suppress warnings everywhere +dotnet_diagnostic.IDE1006.severity = none +dotnet_diagnostic.IDE0130.severity = none \ No newline at end of file diff --git a/Assets/NanoBrain/LinearAlgebra/src/Direction.cs b/Assets/NanoBrain/LinearAlgebra/src/Direction.cs index dfc90bd..95b8d6a 100644 --- a/Assets/NanoBrain/LinearAlgebra/src/Direction.cs +++ b/Assets/NanoBrain/LinearAlgebra/src/Direction.cs @@ -3,7 +3,8 @@ using System; using Vector3Float = UnityEngine.Vector3; #endif -namespace LinearAlgebra { +namespace LinearAlgebra +{ /// /// A direction in 3D space @@ -16,7 +17,8 @@ namespace LinearAlgebra { /// rotation has been applied. /// The angles are automatically normalized to stay within the abovenmentioned /// ranges. - public struct Direction { + public struct Direction + { /// @brief horizontal angle, range = (-180..180] degrees public AngleFloat horizontal; /// @brief vertical angle, range in degrees = (-90..90] degrees @@ -29,7 +31,8 @@ namespace LinearAlgebra { /// The vertical angle /// The direction will be normalized automatically /// to ensure the angles are within the allowed ranges - public Direction(AngleFloat horizontal, AngleFloat vertical) { + public Direction(AngleFloat horizontal, AngleFloat vertical) + { this.horizontal = horizontal; this.vertical = vertical; this.Normalize(); @@ -43,8 +46,10 @@ namespace LinearAlgebra { /// The direction /// The direction will be normalized automatically /// to ensure the angles are within the allowed ranges - public static Direction Degrees(float horizontal, float vertical) { - Direction d = new() { + public static Direction Degrees(float horizontal, float vertical) + { + Direction d = new() + { horizontal = AngleFloat.Degrees(horizontal), vertical = AngleFloat.Degrees(vertical) }; @@ -57,8 +62,10 @@ namespace LinearAlgebra { /// The horizontal angle in radians /// The vertical angle in radians /// The direction - public static Direction Radians(float horizontal, float vertical) { - Direction d = new() { + public static Direction Radians(float horizontal, float vertical) + { + Direction d = new() + { horizontal = AngleFloat.Radians(horizontal), vertical = AngleFloat.Radians(vertical) }; @@ -66,7 +73,8 @@ namespace LinearAlgebra { return d; } - public override readonly string ToString() { + public override readonly string ToString() + { return $"Direction(h: {this.horizontal}, v: {this.vertical})"; } @@ -99,8 +107,10 @@ namespace LinearAlgebra { /// public readonly static Direction right = Degrees(90, 0); - private void Normalize() { - if (this.vertical > AngleFloat.deg90 || this.vertical < -AngleFloat.deg90) { + private void Normalize() + { + if (this.vertical > AngleFloat.deg90 || this.vertical < -AngleFloat.deg90) + { this.horizontal += AngleFloat.deg180; this.vertical = AngleFloat.deg180 - this.vertical; } @@ -142,11 +152,12 @@ namespace LinearAlgebra { /// Convert the direction into a carthesian vector /// /// The carthesian vector corresponding to this direction. - public Vector3Float ToVector3() { + public Vector3Float ToVector3() + { // Quaternion q = Quaternion.Euler(90 - this.vertical.inDegrees, this.horizontal.inDegrees, 0); // Vector3Float v = q * Vector3Float.forward; // return v; - // Convert degrees to radians + // Convert degrees to radians float radH = this.horizontal.inRadians; float radV = this.vertical.inRadians; @@ -166,7 +177,8 @@ namespace LinearAlgebra { /// The direction /// Information about the length of the carthesian vector is not /// included in this transformation - public static Direction FromVector3(Vector3Float v) { + public static Direction FromVector3(Vector3Float v) + { AngleFloat horizontal = AngleFloat.Atan2(v.horizontal, v.depth); AngleFloat vertical = AngleFloat.deg90 - AngleFloat.Acos(v.vertical); Direction d = new(horizontal, vertical); @@ -181,7 +193,8 @@ namespace LinearAlgebra { /// /// /// True when the direction angles are equal, false otherwise. - public static bool operator ==(Direction d1, Direction d2) { + public static bool operator ==(Direction d1, Direction d2) + { bool horizontalEq = d1.horizontal == d2.horizontal; bool verticalEq = d1.vertical == d2.vertical; return horizontalEq && verticalEq; @@ -193,13 +206,15 @@ namespace LinearAlgebra { /// /// /// True when the direction angles are not equal, false otherwise. - public static bool operator !=(Direction d1, Direction d2) { + public static bool operator !=(Direction d1, Direction d2) + { bool horizontalNEq = d1.horizontal != d2.horizontal; bool verticalNEq = d1.vertical != d2.vertical; return horizontalNEq || verticalNEq; } - public override readonly bool Equals(object obj) { + public override readonly bool Equals(object obj) + { if (obj is not Direction d) return false; @@ -209,10 +224,32 @@ namespace LinearAlgebra { } - public override readonly int GetHashCode() { + public override readonly int GetHashCode() + { return HashCode.Combine(horizontal, vertical); } + public static AngleFloat UnsignedAngle(Direction d1, Direction d2) + { + // Convert angles from degrees to radians + float horizontal1Rad = d1.horizontal.inRadians; + float vertical1Rad = d1.vertical.inRadians; + + float horizontal2Rad = d2.horizontal.inRadians; + float vertical2Rad = d2.vertical.inRadians; + + // Calculate the cosine of the angle using the spherical law of cosines + float cosTheta = MathF.Sin(vertical1Rad) * MathF.Sin(vertical2Rad) + + MathF.Cos(vertical1Rad) * MathF.Cos(vertical2Rad) * + MathF.Cos(horizontal1Rad - horizontal2Rad); + + // Clip cosTheta to the valid range for acos + cosTheta = Float.Clamp(cosTheta, -1.0f, 1.0f); + + // Calculate the angle + AngleFloat angle = AngleFloat.Acos(cosTheta); + return angle; + } } } \ No newline at end of file diff --git a/Assets/NanoBrain/LinearAlgebra/src/Spherical.cs b/Assets/NanoBrain/LinearAlgebra/src/Spherical.cs index 1c92faa..e1e3ab6 100644 --- a/Assets/NanoBrain/LinearAlgebra/src/Spherical.cs +++ b/Assets/NanoBrain/LinearAlgebra/src/Spherical.cs @@ -137,5 +137,30 @@ namespace LinearAlgebra { return r; } + public static float Distance(Spherical v1, Spherical v2) { + // Convert degrees to radians + float thetaARadians = v1.direction.horizontal.inRadians; + float phiARadians = v1.direction.vertical.inRadians;// DegreesToRadians(phiA); + float thetaBRadians = v2.direction.horizontal.inRadians; // DegreesToRadians(thetaB); + float phiBRadians = v2.direction.vertical.inRadians; // DegreesToRadians(phiB); + + // Calculate sine and cosine values + float sinPhiA = MathF.Sin(phiARadians); + float cosPhiA = MathF.Cos(phiARadians); + float sinPhiB = MathF.Sin(phiBRadians); + float cosPhiB = MathF.Cos(phiBRadians); + + // Calculate the cosine of the difference in azimuthal angles + float cosThetaDifference = MathF.Cos(thetaARadians - thetaBRadians); + + // Apply the spherical law of cosines + float distance = MathF.Sqrt( + v1.distance * v1.distance + + v2.distance * v2.distance - + 2 * v1.distance * v2.distance * (sinPhiA * sinPhiB * cosThetaDifference + cosPhiA * cosPhiB) + ); + + return distance; + } } } \ No newline at end of file diff --git a/Assets/NanoBrain/Neuroid.cs b/Assets/NanoBrain/Neuroid.cs index 0bd9c90..287c23b 100644 --- a/Assets/NanoBrain/Neuroid.cs +++ b/Assets/NanoBrain/Neuroid.cs @@ -74,7 +74,7 @@ public class Neuroid : Nucleus { } public virtual void UpdateState() { - Vector3 result = Vector3.zero; + Vector3 resultVector = Vector3.zero; foreach (Synapse synapse in this.synapses) { Nucleus synapseNucleus = synapse.nucleus; if (synapseNucleus is Neuroid neuroid && neuroid.isSleeping) @@ -87,14 +87,21 @@ public class Neuroid : Nucleus { float magnitude = weight * activatedValue; //Debug.Log($"{this.name} {synapseNucleus.outputValue.direction} {synapseNucleus.outputValue.direction.horizontal}{synapseNucleus.outputValue.direction.vertical} {direction}"); - result += direction * magnitude; + resultVector += direction * magnitude; } if (average && this.synapses.Count > 0) - result /= this.synapses.Count; + resultVector /= this.synapses.Count; - this.outputValue = Spherical.FromVector3(result); + Spherical result = Spherical.FromVector3(resultVector); + float d = Spherical.Distance(result, this.outputValue); + if (d < 0.1f) { + //Debug.Log($"insignificant update: {d}"); + return; + } + + this.outputValue = result; //Spherical.FromVector3(resultVector); //this.stale = 0; - this.Refresh(); + //this.Refresh(); foreach (Receiver receiver in this.receivers) { if (receiver.nucleus is Neuroid neuroid) diff --git a/Assets/NanoBrain/Nucleus.cs b/Assets/NanoBrain/Nucleus.cs index b114911..7b49319 100644 --- a/Assets/NanoBrain/Nucleus.cs +++ b/Assets/NanoBrain/Nucleus.cs @@ -76,13 +76,12 @@ public class Nucleus { } [System.NonSerialized] - private int stale = 0; + private int stale = 1000; public bool isSleeping => this.stale > 2; - public void Refresh() { - //this.stale = 0; - } public void IncreaseAge() { this.stale++; + if (isSleeping) + _outputValue = Spherical.zero; } [System.NonSerialized] public int layerIx; diff --git a/Assets/NanoBrain/Perception.cs b/Assets/NanoBrain/Perception.cs index 46ca2ab..f98077d 100644 --- a/Assets/NanoBrain/Perception.cs +++ b/Assets/NanoBrain/Perception.cs @@ -29,32 +29,32 @@ public class Perception : Nucleus { return null; } - public void SendPositions(Nucleus receivingNeuroid, int thingType = 0, float weight = 1.0f) { - Receiver receiver = new() { - thingType = thingType, - neuroid = receivingNeuroid - }; - positionReceivers.Add(receiver); - foreach (SensoryNeuroid neuroid in sensoryNeuroids) { - if (neuroid != null) { - neuroid.AddReceiver(receivingNeuroid); - receivingNeuroid.SetWeight(neuroid, weight); - } - } - } - public void SendVelocities(Nucleus receivingNeuroid, int thingType = 0, float weight = 1.0f) { - Receiver receiver = new() { - thingType = thingType, - neuroid = receivingNeuroid - }; - velocityReceivers.Add(receiver); - foreach (SensoryNeuroid neuroid in sensoryNeuroids) { - if (neuroid != null && neuroid.velocityNeuroid != null) { - neuroid.velocityNeuroid.AddReceiver(receivingNeuroid); - receivingNeuroid.SetWeight(neuroid, weight); - } - } - } + // public void SendPositions(Nucleus receivingNeuroid, int thingType = 0, float weight = 1.0f) { + // Receiver receiver = new() { + // thingType = thingType, + // neuroid = receivingNeuroid + // }; + // positionReceivers.Add(receiver); + // foreach (SensoryNeuroid neuroid in sensoryNeuroids) { + // if (neuroid != null) { + // neuroid.AddReceiver(receivingNeuroid); + // receivingNeuroid.SetWeight(neuroid, weight); + // } + // } + // } + // public void SendVelocities(Nucleus receivingNeuroid, int thingType = 0, float weight = 1.0f) { + // Receiver receiver = new() { + // thingType = thingType, + // neuroid = receivingNeuroid + // }; + // velocityReceivers.Add(receiver); + // foreach (SensoryNeuroid neuroid in sensoryNeuroids) { + // if (neuroid != null && neuroid.velocityNeuroid != null) { + // neuroid.velocityNeuroid.AddReceiver(receivingNeuroid); + // receivingNeuroid.SetWeight(neuroid, weight); + // } + // } + // } public void ProcessStimulus(int thingId, int thingType, Vector3 localPosition, string name = "Sensing") { int availableIx = -1; @@ -97,10 +97,10 @@ public class Perception : Nucleus { receiver.neuroid.GetInputFrom(neuroid); } } - foreach (Receiver receiver in velocityReceivers) { - if (receiver.thingType == 0 || receiver.thingType == thingType) - receiver.neuroid.GetInputFrom(neuroid.velocityNeuroid); - } + // foreach (Receiver receiver in velocityReceivers) { + // if (receiver.thingType == 0 || receiver.thingType == thingType) + // receiver.neuroid.GetInputFrom(neuroid.velocityNeuroid); + // } //neuroid.receptor.position = localPosition; neuroid.receptor.ProcessStimulus(333, localPosition); diff --git a/Assets/NanoBrain/Perceptoid.cs b/Assets/NanoBrain/Perceptoid.cs index 75fd6e2..54e9a36 100644 --- a/Assets/NanoBrain/Perceptoid.cs +++ b/Assets/NanoBrain/Perceptoid.cs @@ -6,7 +6,7 @@ public class Perceptoid : Neuroid { // A neuroid which has no neurons as input // But receives value from a receptor public Receptor receptor; - public VelocityNeuroid velocityNeuroid; + //public VelocityNeuroid velocityNeuroid; #region Serialization @@ -16,12 +16,8 @@ public class Perceptoid : Neuroid { public override void Rebuild(NanoBrainObj brain) { base.Rebuild(brain); - //this.receptor = new Receptor(this); - this.receptor = Perceptoid.GetReceptor(brain, thingType); - if (this.receptor == null) - this.receptor = new Receptor(this); - else - this.receptor.perceptei.Add(this); + this.receptor = Receptor.GetReceptor(brain, thingType); + this.receptor.perceptei.Add(this); } public override void Deserialize(Nucleus nucleus) { @@ -52,18 +48,18 @@ public class Perceptoid : Neuroid { #endregion Serialization - public Perceptoid(NanoBrainObj brain, string name) : base(name) { - this.brain = brain; - if (this.brain != null) { - this.brain.perceptei.Add(this); - } - else - Debug.LogError("No neuroid network"); + // public Perceptoid(NanoBrainObj brain, string name) : base(name) { + // this.brain = brain; + // if (this.brain != null) { + // this.brain.perceptei.Add(this); + // } + // else + // Debug.LogError("No neuroid network"); - this.nucleusType = nameof(Perceptoid); - this.name = name; - this.receptor = new Receptor(this); - } + // this.nucleusType = nameof(Perceptoid); + // this.name = name; + // this.receptor = new Receptor(this); + // } public Perceptoid(NanoBrainObj brain, int thingType, string name = "sensor") : base(name) { this.brain = brain; @@ -76,26 +72,25 @@ public class Perceptoid : Neuroid { this.nucleusType = nameof(Perceptoid); this.name = name; this.thingType = thingType; - this.receptor = new Receptor(this) { - thingType = thingType - }; - this.velocityNeuroid = new(brain, name + ": velocity"); - // The velocity neuroid received position data from this - this.AddReceiver(velocityNeuroid); + this.receptor = Receptor.GetReceptor(brain, thingType); + this.receptor.perceptei.Add(this); + // this.velocityNeuroid = new(brain, name + ": velocity"); + // // The velocity neuroid received position data from this + // this.AddReceiver(velocityNeuroid); } public void Replace(int thingType, string name = "sensor") { this.name = name; - this.thingType = thingType; + //this.thingType = thingType; this.receptor.thingType = thingType; this.receptor.localPosition = Spherical.zero; this.outputValue = Spherical.zero; this.receivers = new(); - this.AddReceiver(velocityNeuroid); + // this.AddReceiver(velocityNeuroid); - this.velocityNeuroid.Replace(name + ": velocity"); + // this.velocityNeuroid.Replace(name + ": velocity"); } public override void UpdateState() { @@ -119,7 +114,7 @@ public class Perceptoid : Neuroid { if (receiver.nucleus is Neuroid neuroid) neuroid.SetInput(this); //this.stale = 0; - this.Refresh(); + //this.Refresh(); } public void UpdateState(int thingId, Spherical receptorValue) { @@ -139,18 +134,23 @@ public class Perceptoid : Neuroid { // if (average && this.synapses.Count > 0) // result /= this.synapses.Count + 1; + float d = Spherical.Distance(result, this.outputValue); + if (d < 0.1f) { + //Debug.Log($"insignificant update: {d}"); + return; + } this.outputValue = result; foreach (Receiver receiver in this.receivers) if (receiver.nucleus is Neuroid neuroid) neuroid.SetInput(this); //this.stale = 0; - this.Refresh(); + //this.Refresh(); } public static Perceptoid GetPerception(NanoBrainObj brain, int thingType = 0) { foreach (Nucleus nucleus in brain.nuclei) { - if (nucleus is Perceptoid perceptoid && (thingType == 0 || perceptoid.thingType == thingType)) + if (nucleus is Perceptoid perceptoid && (thingType == 0 || perceptoid.receptor.thingType == thingType)) return perceptoid; } return null; @@ -159,7 +159,7 @@ public class Perceptoid : Neuroid { public static void ProcessStimulus(NanoBrainObj brain, int thingType, Vector3 localPosition) { Perceptoid selectedPerceptoid = null; foreach (Perceptoid nucleus in brain.perceptei) { - if (nucleus is Perceptoid perceptoid && (thingType == 0 || perceptoid.thingType == thingType)) + if (nucleus is Perceptoid perceptoid && (thingType == 0 || perceptoid.receptor.thingType == thingType)) if (selectedPerceptoid == null) { selectedPerceptoid = perceptoid; if (perceptoid.isSleeping) { @@ -176,11 +176,15 @@ public class Perceptoid : Neuroid { //selectedPerceptoid.receptor.position = localPosition; selectedPerceptoid.receptor.ProcessStimulus(888, localPosition); } - public static Receptor GetReceptor(NanoBrainObj brain, int thingType) { - foreach (Perceptoid perceptoid in brain.perceptei) { - if (thingType == 0 || perceptoid.thingType == thingType) - return perceptoid.receptor; - } - return null; - } + + // public static Receptor GetReceptor(NanoBrainObj brain, int thingType) { + // foreach (Perceptoid perceptoid in brain.perceptei) { + // if (perceptoid.receptor != null) { + // if (thingType == 0 || perceptoid.receptor.thingType == thingType) + // return perceptoid.receptor; + // } + // } + // Receptor receptor = new(thingType); + // return receptor; + // } } diff --git a/Assets/NanoBrain/Receptor.cs b/Assets/NanoBrain/Receptor.cs index 5f64972..18b8089 100644 --- a/Assets/NanoBrain/Receptor.cs +++ b/Assets/NanoBrain/Receptor.cs @@ -1,47 +1,92 @@ using System.Collections.Generic; -using System.Linq; using UnityEngine; using LinearAlgebra; public class Receptor { - - + /// + /// The list of perceptoid which can process stimuli from this receptor + /// public List perceptei = new(); - public int thingId; - public int thingType; + //public int thingId; + private int _thingType = 0; + public int thingType { + get { return _thingType; } + set { + _thingType = value; + foreach (Perceptoid perceptoid in perceptei) { + perceptoid.thingType = _thingType; + } + } + } public Spherical localPosition; + public float distanceResolution = 0.1f; + public float directionResolution = 5; - public Receptor(Perceptoid perceptoid) { - this.perceptei.Add(perceptoid); + public Receptor(NanoBrainObj brain, int thingType) { + this.thingType = thingType; + //this.perceptei.Add(perceptoid); + brain.receptors.Add(this); } + public static Receptor GetReceptor(NanoBrainObj brain, int thingType) { + foreach (Receptor receptor in brain.receptors) { + if (thingType == 0 || receptor.thingType == thingType) + return receptor; + } + Receptor newReceptor = new(brain, thingType); + return newReceptor; + } - public virtual void ProcessStimulus(int thingId, Vector3 localPosition) { - this.thingId = thingId; - this.localPosition = Spherical.FromVector3(localPosition); + public virtual void ProcessStimulus(int thingId, Vector3 newLocalPositionVector) { + Spherical newLocalPosition = Spherical.FromVector3(newLocalPositionVector); + + Spherical previousLocalPosition = this.localPosition; + this.localPosition = newLocalPosition; Perceptoid selectedPerceptoid = null; foreach (Perceptoid perceptoid in this.perceptei) { - if (perceptoid.thingId == this.thingId) { + if (perceptoid.thingId == thingId) { + // We found an existing perceptoid for this thing selectedPerceptoid = perceptoid; + // Do not look any further + + // This does not do a lot.... + float deltaDistance = newLocalPosition.distance - previousLocalPosition.distance; + // See if the change is significant + AngleFloat deltaDirection = Direction.UnsignedAngle(newLocalPosition.direction, previousLocalPosition.direction); + if (deltaDistance < this.distanceResolution && deltaDirection.inDegrees < directionResolution) { + // The difference is not significant we don't process this data. + this.localPosition = previousLocalPosition; + return; + } break; } - else if (perceptoid.isSleeping) + else if (perceptoid.isSleeping) { + // A sleeping perceptoid is not active and can therefore always be reused selectedPerceptoid = perceptoid; + // Look further because we could find a existing perceptoid for this thing + } + else if (selectedPerceptoid == null) { + // If we haven't found a perceptoid yet, just start by taking the first selectedPerceptoid = perceptoid; } + else if (selectedPerceptoid.isSleeping == false) { - if (perceptoid.receptor.localPosition.magnitude < selectedPerceptoid.receptor.localPosition.magnitude) + // If no existing or sleeping perceptoid is found, we look for the perceptoid + // we the furthest (least interesting) stimulus + if (perceptoid.receptor.localPosition.magnitude < selectedPerceptoid.receptor.localPosition.magnitude) { + Debug.Log($"{selectedPerceptoid.name} {selectedPerceptoid.receptor.localPosition.magnitude} {perceptoid.receptor.localPosition.magnitude} "); selectedPerceptoid = perceptoid; + } } } if (selectedPerceptoid == null) { Debug.Log("No perceptoid selected, stimulus is ignored"); return; } - //Debug.Log($"Stimulus {thingId} {selectedPerceptoid.thingId}"); - selectedPerceptoid.UpdateState(this.thingId, this.localPosition); + // Debug.Log($"Stimulus {thingType} {thingId} {selectedPerceptoid.name}"); + selectedPerceptoid.UpdateState(thingId, this.localPosition); } } \ No newline at end of file diff --git a/Assets/NanoBrain/SensoryNeuroid.cs b/Assets/NanoBrain/SensoryNeuroid.cs index 1c12129..ffc4e4a 100644 --- a/Assets/NanoBrain/SensoryNeuroid.cs +++ b/Assets/NanoBrain/SensoryNeuroid.cs @@ -37,16 +37,16 @@ public class SensoryNeuroid : Neuroid { // A neuroid which has no neurons as input // But receives value from a receptor public Receptor receptor; - public VelocityNeuroid velocityNeuroid; + //public VelocityNeuroid velocityNeuroid; public SensoryNeuroid(NanoBrainObj brain, int thingId, string name = "sensor") : base(brain, name) { this.name = name + ": position"; // this.receptor = new Receptor(this) { // thingType = thingId // }; - this.velocityNeuroid = new(brain, name + ": velocity"); - // The velocity neuroid received position data from this - this.AddReceiver(velocityNeuroid); + // this.velocityNeuroid = new(brain, name + ": velocity"); + // // The velocity neuroid received position data from this + // this.AddReceiver(velocityNeuroid); } public void Replace(int thingId, string name = "sensor") { @@ -57,11 +57,11 @@ public class SensoryNeuroid : Neuroid { this.outputValue = Spherical.zero; this.receivers = new(); - this.AddReceiver(velocityNeuroid); + // this.AddReceiver(velocityNeuroid); - // this.velocityNeuroid.name = name + ": velocity"; - // this.velocityNeuroid.receivers = new(); - this.velocityNeuroid.Replace(name + ": velocity"); + // // this.velocityNeuroid.name = name + ": velocity"; + // // this.velocityNeuroid.receivers = new(); + // this.velocityNeuroid.Replace(name + ": velocity"); } public override void UpdateState() { @@ -88,49 +88,49 @@ public class SensoryNeuroid : Neuroid { if (receiver.nucleus is Neuroid neuroid) neuroid.SetInput(this); //this.stale = 0; - this.Refresh(); + //this.Refresh(); } } -public class VelocityNeuroid : Neuroid { - // Would be best if this was received through a synapse via a loop.... - private Vector3 lastPosition = Vector3.zero; - private float lastValueTime = 0; +// public class VelocityNeuroid : Neuroid { +// // Would be best if this was received through a synapse via a loop.... +// private Vector3 lastPosition = Vector3.zero; +// private float lastValueTime = 0; - public VelocityNeuroid(NanoBrainObj net, string name = "velocity") : base(net, name) { - } +// public VelocityNeuroid(NanoBrainObj net, string name = "velocity") : base(net, name) { +// } - public void Replace(string name = "velocity") { - this.name = name; - this.receivers = new(); - this.lastPosition = Vector3.zero; - this.lastValueTime = 0; - } +// public void Replace(string name = "velocity") { +// this.name = name; +// this.receivers = new(); +// this.lastPosition = Vector3.zero; +// this.lastValueTime = 0; +// } - public override void UpdateState() { - // Assuming only one synapse for now.... - //Vector3 currentPosition = this.synapses.First().Key.outputValue; - Spherical currentPosition = this.synapses.First().nucleus.outputValue; - Vector3 currentPositionV3 = currentPosition.ToVector3(); - float currentValueTime = Time.time; +// public override void UpdateState() { +// // Assuming only one synapse for now.... +// //Vector3 currentPosition = this.synapses.First().Key.outputValue; +// Spherical currentPosition = this.synapses.First().nucleus.outputValue; +// Vector3 currentPositionV3 = currentPosition.ToVector3(); +// float currentValueTime = Time.time; - if (lastValueTime != 0) { - float deltaTime = currentValueTime - lastValueTime; - Vector3 translation = currentPositionV3 - lastPosition; - Vector3 velocity = translation / deltaTime; +// if (lastValueTime != 0) { +// float deltaTime = currentValueTime - lastValueTime; +// Vector3 translation = currentPositionV3 - lastPosition; +// Vector3 velocity = translation / deltaTime; - // No activation function... - this.outputValue = Spherical.FromVector3(velocity); - //this.stale = 0; - this.Refresh(); +// // No activation function... +// this.outputValue = Spherical.FromVector3(velocity); +// //this.stale = 0; +// //this.Refresh(); - foreach (Receiver receiver in receivers) { - if (receiver.nucleus is Neuroid neuroid) - neuroid.SetInput(this); - } - } +// foreach (Receiver receiver in receivers) { +// if (receiver.nucleus is Neuroid neuroid) +// neuroid.SetInput(this); +// } +// } - this.lastValueTime = currentValueTime; - this.lastPosition = currentPositionV3; - } -} \ No newline at end of file +// this.lastValueTime = currentValueTime; +// this.lastPosition = currentPositionV3; +// } +// } \ No newline at end of file diff --git a/Assets/NanoBrain/VisualEditor/Editor/NanoBrainInspector.cs b/Assets/NanoBrain/VisualEditor/Editor/NanoBrainInspector.cs index 0a694e0..5f65741 100644 --- a/Assets/NanoBrain/VisualEditor/Editor/NanoBrainInspector.cs +++ b/Assets/NanoBrain/VisualEditor/Editor/NanoBrainInspector.cs @@ -398,8 +398,9 @@ public class NanoBrainInspector : Editor { return; this.currentNucleus.name = EditorGUILayout.TextField(this.currentNucleus.name); - if (this.currentNucleus is Perceptoid currentPerceptoid) - currentPerceptoid.thingType = EditorGUILayout.IntField("Thing Type", currentPerceptoid.thingType); + if (this.currentNucleus is Perceptoid currentPerceptoid) { + currentPerceptoid.receptor.thingType = EditorGUILayout.IntField("Thing Type", currentPerceptoid.receptor.thingType); + } else if (this.currentNucleus is Neuroid neuroid) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Activation Curve", GUILayout.Width(150)); diff --git a/Assets/NanoBrain/VisualEditor/NanoBrainObj.cs b/Assets/NanoBrain/VisualEditor/NanoBrainObj.cs index 970a2ac..1a52db1 100644 --- a/Assets/NanoBrain/VisualEditor/NanoBrainObj.cs +++ b/Assets/NanoBrain/VisualEditor/NanoBrainObj.cs @@ -12,6 +12,7 @@ public class NanoBrainObj : ScriptableObject, ISerializationCallbackReceiver { public List nuclei = new(); public List perceptei = new(); + public List receptors = new(); // This is probably always the first element in the nuclei list... [System.NonSerialized] @@ -34,14 +35,14 @@ public class NanoBrainObj : ScriptableObject, ISerializationCallbackReceiver { foreach (Nucleus nucleus in nuclei) { //nucleus.stale++; nucleus.IncreaseAge(); - if (nucleus.isSleeping) - nucleus.outputValue = Spherical.zero; + // if (nucleus.isSleeping) + // nucleus.outputValue = Spherical.zero; } foreach (Perceptoid perception in perceptei) { //perception.stale++; perception.IncreaseAge(); - if (perception.isSleeping) - perception.outputValue = Spherical.zero; + // if (perception.isSleeping) + // perception.outputValue = Spherical.zero; } } @@ -84,6 +85,9 @@ public class NanoBrainObj : ScriptableObject, ISerializationCallbackReceiver { if (nucleus.brain == null) nucleus.brain = this; + if (nucleus.name == "Boid1") + Debug.Log(" Found boiid1"); + visitedNuclei.Add(nucleus); if (nucleus.synapses != null) { HashSet visitedSynapses = new(); diff --git a/Assets/Scenes/Boids/Boids.unity b/Assets/Scenes/Boids/Boids.unity index 9c0eb11..a2bc83e 100644 --- a/Assets/Scenes/Boids/Boids.unity +++ b/Assets/Scenes/Boids/Boids.unity @@ -680,7 +680,7 @@ AudioListener: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1633626499} - m_Enabled: 1 + m_Enabled: 0 --- !u!20 &1633626501 Camera: m_ObjectHideFlags: 0 diff --git a/Assets/Scenes/Boids/Scripts/Boid.cs b/Assets/Scenes/Boids/Scripts/Boid.cs index ac78915..ef7846d 100644 --- a/Assets/Scenes/Boids/Scripts/Boid.cs +++ b/Assets/Scenes/Boids/Scripts/Boid.cs @@ -27,9 +27,9 @@ public class Boid : MonoBehaviour { this.id = this.GetInstanceID(); nanoBrain = GetComponent(); - boundaryReceptor = Perceptoid.GetReceptor(nanoBrain.brain, BoundaryType); - boidReceptor = Perceptoid.GetReceptor(nanoBrain.brain, BoidType); - boidVelocityReceptor = Perceptoid.GetReceptor(nanoBrain.brain, BoidVelocityType); + boundaryReceptor = Receptor.GetReceptor(nanoBrain.brain, BoundaryType); + boidReceptor = Receptor.GetReceptor(nanoBrain.brain, BoidType); + boidVelocityReceptor = Receptor.GetReceptor(nanoBrain.brain, BoidVelocityType); sc = FindFirstObjectByType(); diff --git a/Assets/Scenes/Boids/Scripts/RoamingNucleus.cs b/Assets/Scenes/Boids/Scripts/RoamingNucleus.cs index 513f05e..de86097 100644 --- a/Assets/Scenes/Boids/Scripts/RoamingNucleus.cs +++ b/Assets/Scenes/Boids/Scripts/RoamingNucleus.cs @@ -1,3 +1,4 @@ +/* public class Roaming : Nucleus { public Neuroid avoidance; @@ -14,4 +15,5 @@ public class Roaming : Nucleus { public override void AddReceiver(Nucleus receiver) { output.AddReceiver(receiver); } -} \ No newline at end of file +} +*/ \ No newline at end of file diff --git a/Assets/Scenes/Boids/Scripts/SwarmingNucleus.cs b/Assets/Scenes/Boids/Scripts/SwarmingNucleus.cs index a269b01..a5d715d 100644 --- a/Assets/Scenes/Boids/Scripts/SwarmingNucleus.cs +++ b/Assets/Scenes/Boids/Scripts/SwarmingNucleus.cs @@ -1,37 +1,37 @@ -using UnityEngine; -using LinearAlgebra; +// using UnityEngine; +// using LinearAlgebra; -public class Swarming : Nucleus { - public Neuroid cohesion; - public Neuroid alignment; - public Neuroid avoidance; - public Neuroid boundary; +// public class Swarming : Nucleus { +// public Neuroid cohesion; +// public Neuroid alignment; +// public Neuroid avoidance; +// public Neuroid boundary; - public Neuroid output; +// public Neuroid output; - //public override Spherical outputValue { get => output.outputValue; set => output.outputValue = value; } +// //public override Spherical outputValue { get => output.outputValue; set => output.outputValue = value; } - public Swarming(NanoBrainObj brain, Perception perception, SwarmControl sc) : base("Swarming Nucleus") { - this.cohesion = new(brain, "Cohesion") { inverse = false }; - perception.SendPositions(this.cohesion, Boid.BoidType); +// public Swarming(NanoBrainObj brain, Perception perception, SwarmControl sc) : base("Swarming Nucleus") { +// this.cohesion = new(brain, "Cohesion") { inverse = false }; +// perception.SendPositions(this.cohesion, Boid.BoidType); - this.alignment = new(brain, "Alignment") { average = true }; - perception.SendVelocities(this.alignment, Boid.BoidType); +// this.alignment = new(brain, "Alignment") { average = true }; +// perception.SendVelocities(this.alignment, Boid.BoidType); - this.avoidance = new(brain, "Avoidance") { inverse = true }; - perception.SendPositions(this.avoidance); +// this.avoidance = new(brain, "Avoidance") { inverse = true }; +// perception.SendPositions(this.avoidance); - this.boundary = new(brain, "Boundary"); - perception.SendPositions(this.boundary, Boid.BoundaryType); +// this.boundary = new(brain, "Boundary"); +// perception.SendPositions(this.boundary, Boid.BoundaryType); - this.output = new(brain, "Swarming"); - this.output.GetInputFrom(alignment, sc.alignmentForce); - this.output.GetInputFrom(cohesion, sc.cohesionForce); - this.output.GetInputFrom(avoidance, -sc.avoidanceForce); - this.output.GetInputFrom(boundary, -sc.avoidanceForce); - } +// this.output = new(brain, "Swarming"); +// this.output.GetInputFrom(alignment, sc.alignmentForce); +// this.output.GetInputFrom(cohesion, sc.cohesionForce); +// this.output.GetInputFrom(avoidance, -sc.avoidanceForce); +// this.output.GetInputFrom(boundary, -sc.avoidanceForce); +// } - public override void AddReceiver(Nucleus receiver) { - this.output.AddReceiver(receiver); - } -} \ No newline at end of file +// public override void AddReceiver(Nucleus receiver) { +// this.output.AddReceiver(receiver); +// } +// } \ No newline at end of file diff --git a/Assets/Scenes/Boids/SwarmingBrain.asset b/Assets/Scenes/Boids/SwarmingBrain.asset index d47131b..08a62b5 100644 --- a/Assets/Scenes/Boids/SwarmingBrain.asset +++ b/Assets/Scenes/Boids/SwarmingBrain.asset @@ -1250,7 +1250,6 @@ MonoBehaviour: curveMax: 1 receivers: [] nucleusType: - isSleeping: 0 _curvePreset: 0 curve: serializedVersion: 2 @@ -1296,7 +1295,6 @@ MonoBehaviour: receivers: - nucleusId: -1707533328 nucleusType: - isSleeping: 0 _curvePreset: 0 curve: serializedVersion: 2 @@ -1329,7 +1327,7 @@ MonoBehaviour: - id: 1938577052 _name: Cohesion synapses: - - nucleusId: 1302452224 + - nucleusId: -1659429232 weight: 1 curvePreset: 0 curve: @@ -1339,7 +1337,7 @@ MonoBehaviour: m_PostInfinity: 2 m_RotationOrder: 4 curveMax: 1 - - nucleusId: 10881140 + - nucleusId: 839544896 weight: 1 curvePreset: 0 curve: @@ -1349,7 +1347,7 @@ MonoBehaviour: m_PostInfinity: 2 m_RotationOrder: 4 curveMax: 1 - - nucleusId: 2020437392 + - nucleusId: -348340288 weight: 1 curvePreset: 0 curve: @@ -1359,7 +1357,7 @@ MonoBehaviour: m_PostInfinity: 2 m_RotationOrder: 4 curveMax: 1 - - nucleusId: -1530763258 + - nucleusId: -1095934288 weight: 1 curvePreset: 0 curve: @@ -1369,7 +1367,7 @@ MonoBehaviour: m_PostInfinity: 2 m_RotationOrder: 4 curveMax: 1 - - nucleusId: 1790226608 + - nucleusId: -1413006832 weight: 1 curvePreset: 0 curve: @@ -1379,7 +1377,7 @@ MonoBehaviour: m_PostInfinity: 2 m_RotationOrder: 4 curveMax: 1 - - nucleusId: 626548796 + - nucleusId: -61245040 weight: 1 curvePreset: 0 curve: @@ -1392,7 +1390,6 @@ MonoBehaviour: receivers: - nucleusId: -1707533328 nucleusType: - isSleeping: 0 _curvePreset: 0 curve: serializedVersion: 2 @@ -1425,7 +1422,7 @@ MonoBehaviour: - id: 1641120128 _name: Separation synapses: - - nucleusId: 1302452224 + - nucleusId: -1659429232 weight: 1 curvePreset: 0 curve: @@ -1435,7 +1432,7 @@ MonoBehaviour: m_PostInfinity: 2 m_RotationOrder: 4 curveMax: 1 - - nucleusId: 10881140 + - nucleusId: 839544896 weight: 1 curvePreset: 0 curve: @@ -1445,7 +1442,7 @@ MonoBehaviour: m_PostInfinity: 2 m_RotationOrder: 4 curveMax: 1 - - nucleusId: 2020437392 + - nucleusId: -348340288 weight: 1 curvePreset: 0 curve: @@ -1455,7 +1452,7 @@ MonoBehaviour: m_PostInfinity: 2 m_RotationOrder: 4 curveMax: 1 - - nucleusId: -1530763258 + - nucleusId: -1095934288 weight: 1 curvePreset: 0 curve: @@ -1465,7 +1462,7 @@ MonoBehaviour: m_PostInfinity: 2 m_RotationOrder: 4 curveMax: 1 - - nucleusId: 1790226608 + - nucleusId: -1413006832 weight: 1 curvePreset: 0 curve: @@ -1475,7 +1472,7 @@ MonoBehaviour: m_PostInfinity: 2 m_RotationOrder: 4 curveMax: 1 - - nucleusId: 626548796 + - nucleusId: -61245040 weight: 1 curvePreset: 0 curve: @@ -1488,7 +1485,6 @@ MonoBehaviour: receivers: - nucleusId: -1707533328 nucleusType: - isSleeping: 0 _curvePreset: 2 curve: serializedVersion: 2 @@ -1791,7 +1787,7 @@ MonoBehaviour: - id: -1857835930 _name: Alignment synapses: - - nucleusId: 1921239042 + - nucleusId: -1659687600 weight: 1 curvePreset: 0 curve: @@ -1801,7 +1797,7 @@ MonoBehaviour: m_PostInfinity: 2 m_RotationOrder: 4 curveMax: 1 - - nucleusId: 1686464114 + - nucleusId: 1322333072 weight: 1 curvePreset: 0 curve: @@ -1811,7 +1807,7 @@ MonoBehaviour: m_PostInfinity: 2 m_RotationOrder: 4 curveMax: 1 - - nucleusId: -1926972526 + - nucleusId: -1563920864 weight: 1 curvePreset: 0 curve: @@ -1821,7 +1817,7 @@ MonoBehaviour: m_PostInfinity: 2 m_RotationOrder: 4 curveMax: 1 - - nucleusId: 483038322 + - nucleusId: 182328688 weight: 1 curvePreset: 0 curve: @@ -1831,7 +1827,7 @@ MonoBehaviour: m_PostInfinity: 2 m_RotationOrder: 4 curveMax: 1 - - nucleusId: 890767934 + - nucleusId: -1666561744 weight: 1 curvePreset: 0 curve: @@ -1841,7 +1837,7 @@ MonoBehaviour: m_PostInfinity: 2 m_RotationOrder: 4 curveMax: 1 - - nucleusId: -324208238 + - nucleusId: -1884196224 weight: 1 curvePreset: 0 curve: @@ -1854,7 +1850,6 @@ MonoBehaviour: receivers: - nucleusId: -1707533328 nucleusType: - isSleeping: 0 _curvePreset: 0 curve: serializedVersion: 2 @@ -1884,438 +1879,6 @@ MonoBehaviour: average: 0 inverse: 0 exponent: 1 - - id: 1164040656 - _name: Boid3 Velocity - synapses: - - nucleusId: 2020437392 - weight: 1 - curvePreset: 0 - curve: - serializedVersion: 2 - m_Curve: [] - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - curveMax: 1 - receivers: [] - nucleusType: - isSleeping: 0 - _curvePreset: 0 - curve: - serializedVersion: 2 - m_Curve: - - serializedVersion: 3 - time: 0 - value: 0 - inSlope: 0 - outSlope: 1 - tangentMode: 0 - weightedMode: 0 - inWeight: 0 - outWeight: 0 - - serializedVersion: 3 - time: 1 - value: 1 - inSlope: 1 - outSlope: 0 - tangentMode: 0 - weightedMode: 0 - inWeight: 0 - outWeight: 0 - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - curveMax: 1 - average: 0 - inverse: 0 - exponent: 1 - - id: -176251552 - _name: Boid2 Velocity - synapses: - - nucleusId: 10881140 - weight: 1 - curvePreset: 0 - curve: - serializedVersion: 2 - m_Curve: [] - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - curveMax: 1 - receivers: [] - nucleusType: - isSleeping: 0 - _curvePreset: 0 - curve: - serializedVersion: 2 - m_Curve: - - serializedVersion: 3 - time: 0 - value: 0 - inSlope: 0 - outSlope: 1 - tangentMode: 0 - weightedMode: 0 - inWeight: 0 - outWeight: 0 - - serializedVersion: 3 - time: 1 - value: 1 - inSlope: 1 - outSlope: 0 - tangentMode: 0 - weightedMode: 0 - inWeight: 0 - outWeight: 0 - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - curveMax: 1 - average: 0 - inverse: 0 - exponent: 1 - - id: -1679360144 - _name: Boid1 Velocity - synapses: - - nucleusId: 1302452224 - weight: 1 - curvePreset: 0 - curve: - serializedVersion: 2 - m_Curve: [] - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - curveMax: 1 - receivers: [] - nucleusType: - isSleeping: 0 - _curvePreset: 0 - curve: - serializedVersion: 2 - m_Curve: - - serializedVersion: 3 - time: 0 - value: 0 - inSlope: 0 - outSlope: 1 - tangentMode: 0 - weightedMode: 0 - inWeight: 0 - outWeight: 0 - - serializedVersion: 3 - time: 1 - value: 1 - inSlope: 1 - outSlope: 0 - tangentMode: 0 - weightedMode: 0 - inWeight: 0 - outWeight: 0 - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - curveMax: 1 - average: 0 - inverse: 0 - exponent: 1 - - id: -1513426512 - _name: Boid4 Velocity - synapses: - - nucleusId: -1530763258 - weight: 1 - curvePreset: 0 - curve: - serializedVersion: 2 - m_Curve: [] - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - curveMax: 1 - receivers: [] - nucleusType: - isSleeping: 0 - _curvePreset: 0 - curve: - serializedVersion: 2 - m_Curve: - - serializedVersion: 3 - time: 0 - value: 0 - inSlope: 0 - outSlope: 1 - tangentMode: 0 - weightedMode: 0 - inWeight: 0 - outWeight: 0 - - serializedVersion: 3 - time: 1 - value: 1 - inSlope: 1 - outSlope: 0 - tangentMode: 0 - weightedMode: 0 - inWeight: 0 - outWeight: 0 - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - curveMax: 1 - average: 0 - inverse: 0 - exponent: 1 - - id: 1708725840 - _name: Boid5 Velocity - synapses: - - nucleusId: 1790226608 - weight: 1 - curvePreset: 0 - curve: - serializedVersion: 2 - m_Curve: [] - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - curveMax: 1 - receivers: [] - nucleusType: - isSleeping: 0 - _curvePreset: 0 - curve: - serializedVersion: 2 - m_Curve: - - serializedVersion: 3 - time: 0 - value: 0 - inSlope: 0 - outSlope: 1 - tangentMode: 0 - weightedMode: 0 - inWeight: 0 - outWeight: 0 - - serializedVersion: 3 - time: 1 - value: 1 - inSlope: 1 - outSlope: 0 - tangentMode: 0 - weightedMode: 0 - inWeight: 0 - outWeight: 0 - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - curveMax: 1 - average: 0 - inverse: 0 - exponent: 1 - - id: -1645785904 - _name: Boid6 Velocity - synapses: - - nucleusId: 626548796 - weight: 1 - curvePreset: 0 - curve: - serializedVersion: 2 - m_Curve: [] - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - curveMax: 1 - receivers: [] - nucleusType: - isSleeping: 0 - _curvePreset: 0 - curve: - serializedVersion: 2 - m_Curve: - - serializedVersion: 3 - time: 0 - value: 0 - inSlope: 0 - outSlope: 1 - tangentMode: 0 - weightedMode: 0 - inWeight: 0 - outWeight: 0 - - serializedVersion: 3 - time: 1 - value: 1 - inSlope: 1 - outSlope: 0 - tangentMode: 0 - weightedMode: 0 - inWeight: 0 - outWeight: 0 - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - curveMax: 1 - average: 0 - inverse: 0 - exponent: 1 - - id: -1621097280 - _name: 'New Perceptoid: velocity' - synapses: - - nucleusId: 1921239042 - weight: 1 - curvePreset: 0 - curve: - serializedVersion: 2 - m_Curve: [] - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - curveMax: 1 - receivers: [] - nucleusType: - isSleeping: 0 - _curvePreset: 0 - curve: - serializedVersion: 2 - m_Curve: [] - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - curveMax: 1 - average: 0 - inverse: 0 - exponent: 1 - - id: -966090960 - _name: 'New Perceptoid: velocity' - synapses: - - nucleusId: 1686464114 - weight: 1 - curvePreset: 0 - curve: - serializedVersion: 2 - m_Curve: [] - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - curveMax: 1 - receivers: [] - nucleusType: - isSleeping: 0 - _curvePreset: 0 - curve: - serializedVersion: 2 - m_Curve: [] - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - curveMax: 1 - average: 0 - inverse: 0 - exponent: 1 - - id: 1426014432 - _name: 'New Perceptoid: velocity' - synapses: - - nucleusId: -1926972526 - weight: 1 - curvePreset: 0 - curve: - serializedVersion: 2 - m_Curve: [] - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - curveMax: 1 - receivers: [] - nucleusType: - isSleeping: 0 - _curvePreset: 0 - curve: - serializedVersion: 2 - m_Curve: [] - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - curveMax: 1 - average: 0 - inverse: 0 - exponent: 1 - - id: -610217840 - _name: 'New Perceptoid: velocity' - synapses: - - nucleusId: 483038322 - weight: 1 - curvePreset: 0 - curve: - serializedVersion: 2 - m_Curve: [] - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - curveMax: 1 - receivers: [] - nucleusType: - isSleeping: 0 - _curvePreset: 0 - curve: - serializedVersion: 2 - m_Curve: [] - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - curveMax: 1 - average: 0 - inverse: 0 - exponent: 1 - - id: -481628544 - _name: 'New Perceptoid: velocity' - synapses: - - nucleusId: 890767934 - weight: 1 - curvePreset: 0 - curve: - serializedVersion: 2 - m_Curve: [] - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - curveMax: 1 - receivers: [] - nucleusType: - isSleeping: 0 - _curvePreset: 0 - curve: - serializedVersion: 2 - m_Curve: [] - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - curveMax: 1 - average: 0 - inverse: 0 - exponent: 1 - - id: 1464656048 - _name: 'New Perceptoid: velocity' - synapses: - - nucleusId: -324208238 - weight: 1 - curvePreset: 0 - curve: - serializedVersion: 2 - m_Curve: [] - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - curveMax: 1 - receivers: [] - nucleusType: - isSleeping: 0 - _curvePreset: 0 - curve: - serializedVersion: 2 - m_Curve: [] - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - curveMax: 1 - average: 0 - inverse: 0 - exponent: 1 perceptei: - id: 407735232 _name: Boundary @@ -2323,7 +1886,6 @@ MonoBehaviour: receivers: - nucleusId: -112538112 nucleusType: Perceptoid - isSleeping: 0 _curvePreset: 0 curve: serializedVersion: 2 @@ -2337,146 +1899,11 @@ MonoBehaviour: exponent: 1 thingType: 1 thingId: 0 - - id: 2020437392 - _name: Boid3 - synapses: [] - receivers: - - nucleusId: 1164040656 - - nucleusId: 1938577052 - - nucleusId: 1641120128 - nucleusType: Perceptoid - isSleeping: 0 - _curvePreset: 0 - curve: - serializedVersion: 2 - m_Curve: [] - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - curveMax: 1 - average: 0 - inverse: 0 - exponent: 1 - thingType: 2 - thingId: 0 - - id: 10881140 - _name: Boid2 - synapses: [] - receivers: - - nucleusId: -176251552 - - nucleusId: 1938577052 - - nucleusId: 1641120128 - nucleusType: Perceptoid - isSleeping: 0 - _curvePreset: 0 - curve: - serializedVersion: 2 - m_Curve: [] - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - curveMax: 1 - average: 0 - inverse: 0 - exponent: 1 - thingType: 2 - thingId: 0 - - id: 1302452224 - _name: Boid1 - synapses: [] - receivers: - - nucleusId: -1679360144 - - nucleusId: 1938577052 - - nucleusId: 1641120128 - nucleusType: Perceptoid - isSleeping: 0 - _curvePreset: 0 - curve: - serializedVersion: 2 - m_Curve: [] - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - curveMax: 1 - average: 0 - inverse: 0 - exponent: 1 - thingType: 2 - thingId: 0 - - id: -1530763258 - _name: Boid4 - synapses: [] - receivers: - - nucleusId: -1513426512 - - nucleusId: 1938577052 - - nucleusId: 1641120128 - nucleusType: Perceptoid - isSleeping: 0 - _curvePreset: 0 - curve: - serializedVersion: 2 - m_Curve: [] - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - curveMax: 1 - average: 0 - inverse: 0 - exponent: 1 - thingType: 2 - thingId: 0 - - id: 1790226608 - _name: Boid5 - synapses: [] - receivers: - - nucleusId: 1708725840 - - nucleusId: 1938577052 - - nucleusId: 1641120128 - nucleusType: Perceptoid - isSleeping: 0 - _curvePreset: 0 - curve: - serializedVersion: 2 - m_Curve: [] - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - curveMax: 1 - average: 0 - inverse: 0 - exponent: 1 - thingType: 2 - thingId: 0 - - id: 626548796 - _name: Boid6 - synapses: [] - receivers: - - nucleusId: -1645785904 - - nucleusId: 1938577052 - - nucleusId: 1641120128 - nucleusType: Perceptoid - isSleeping: 0 - _curvePreset: 0 - curve: - serializedVersion: 2 - m_Curve: [] - m_PreInfinity: 2 - m_PostInfinity: 2 - m_RotationOrder: 4 - curveMax: 1 - average: 0 - inverse: 0 - exponent: 1 - thingType: 2 - thingId: 0 - id: 1921239042 _name: Boid1Velocity synapses: [] - receivers: - - nucleusId: -1621097280 - - nucleusId: -1857835930 + receivers: [] nucleusType: Perceptoid - isSleeping: 0 _curvePreset: 0 curve: serializedVersion: 2 @@ -2493,11 +1920,8 @@ MonoBehaviour: - id: 1686464114 _name: Boid2Velocity synapses: [] - receivers: - - nucleusId: -966090960 - - nucleusId: -1857835930 + receivers: [] nucleusType: Perceptoid - isSleeping: 0 _curvePreset: 0 curve: serializedVersion: 2 @@ -2514,11 +1938,8 @@ MonoBehaviour: - id: -1926972526 _name: Boid3Velocity synapses: [] - receivers: - - nucleusId: 1426014432 - - nucleusId: -1857835930 + receivers: [] nucleusType: Perceptoid - isSleeping: 0 _curvePreset: 0 curve: serializedVersion: 2 @@ -2535,11 +1956,8 @@ MonoBehaviour: - id: 483038322 _name: Boid4Velocity synapses: [] - receivers: - - nucleusId: -610217840 - - nucleusId: -1857835930 + receivers: [] nucleusType: Perceptoid - isSleeping: 0 _curvePreset: 0 curve: serializedVersion: 2 @@ -2556,11 +1974,8 @@ MonoBehaviour: - id: 890767934 _name: Boid5Velocity synapses: [] - receivers: - - nucleusId: -481628544 - - nucleusId: -1857835930 + receivers: [] nucleusType: Perceptoid - isSleeping: 0 _curvePreset: 0 curve: serializedVersion: 2 @@ -2577,11 +1992,8 @@ MonoBehaviour: - id: -324208238 _name: Boid6Velocity synapses: [] - receivers: - - nucleusId: 1464656048 - - nucleusId: -1857835930 + receivers: [] nucleusType: Perceptoid - isSleeping: 0 _curvePreset: 0 curve: serializedVersion: 2 @@ -2595,4 +2007,238 @@ MonoBehaviour: exponent: 1 thingType: 3 thingId: 0 + - id: -1659429232 + _name: BoidA + synapses: [] + receivers: + - nucleusId: 1938577052 + - nucleusId: 1641120128 + nucleusType: Perceptoid + _curvePreset: 0 + curve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + curveMax: 1 + average: 0 + inverse: 0 + exponent: 1 + thingType: 0 + thingId: 0 + - id: 839544896 + _name: BoidB + synapses: [] + receivers: + - nucleusId: 1938577052 + - nucleusId: 1641120128 + nucleusType: Perceptoid + _curvePreset: 0 + curve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + curveMax: 1 + average: 0 + inverse: 0 + exponent: 1 + thingType: 0 + thingId: 0 + - id: -348340288 + _name: BoidC + synapses: [] + receivers: + - nucleusId: 1641120128 + - nucleusId: 1938577052 + nucleusType: Perceptoid + _curvePreset: 0 + curve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + curveMax: 1 + average: 0 + inverse: 0 + exponent: 1 + thingType: 0 + thingId: 0 + - id: -1095934288 + _name: BoidD + synapses: [] + receivers: + - nucleusId: 1938577052 + - nucleusId: 1641120128 + nucleusType: Perceptoid + _curvePreset: 0 + curve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + curveMax: 1 + average: 0 + inverse: 0 + exponent: 1 + thingType: 0 + thingId: 0 + - id: -1413006832 + _name: BoidE + synapses: [] + receivers: + - nucleusId: 1641120128 + - nucleusId: 1938577052 + nucleusType: Perceptoid + _curvePreset: 0 + curve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + curveMax: 1 + average: 0 + inverse: 0 + exponent: 1 + thingType: 0 + thingId: 0 + - id: -61245040 + _name: BoidF + synapses: [] + receivers: + - nucleusId: 1938577052 + - nucleusId: 1641120128 + nucleusType: Perceptoid + _curvePreset: 0 + curve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + curveMax: 1 + average: 0 + inverse: 0 + exponent: 1 + thingType: 0 + thingId: 0 + - id: -1659687600 + _name: BoidA Velocity + synapses: [] + receivers: + - nucleusId: -1857835930 + nucleusType: Perceptoid + _curvePreset: 0 + curve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + curveMax: 1 + average: 0 + inverse: 0 + exponent: 1 + thingType: 0 + thingId: 0 + - id: 1322333072 + _name: BoidB Velocity + synapses: [] + receivers: + - nucleusId: -1857835930 + nucleusType: Perceptoid + _curvePreset: 0 + curve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + curveMax: 1 + average: 0 + inverse: 0 + exponent: 1 + thingType: 0 + thingId: 0 + - id: -1563920864 + _name: BoidC Velocity + synapses: [] + receivers: + - nucleusId: -1857835930 + nucleusType: Perceptoid + _curvePreset: 0 + curve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + curveMax: 1 + average: 0 + inverse: 0 + exponent: 1 + thingType: 0 + thingId: 0 + - id: 182328688 + _name: BoidD Velocity + synapses: [] + receivers: + - nucleusId: -1857835930 + nucleusType: Perceptoid + _curvePreset: 0 + curve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + curveMax: 1 + average: 0 + inverse: 0 + exponent: 1 + thingType: 0 + thingId: 0 + - id: -1666561744 + _name: BoidE Velocity + synapses: [] + receivers: + - nucleusId: -1857835930 + nucleusType: Perceptoid + _curvePreset: 0 + curve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + curveMax: 1 + average: 0 + inverse: 0 + exponent: 1 + thingType: 0 + thingId: 0 + - id: -1884196224 + _name: BoidF Velocity + synapses: [] + receivers: + - nucleusId: -1857835930 + nucleusType: Perceptoid + _curvePreset: 0 + curve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + curveMax: 1 + average: 0 + inverse: 0 + exponent: 1 + thingType: 0 + thingId: 0 rootId: -1707533328