diff --git a/Assets/Scenes/Gameplay.unity b/Assets/Scenes/Gameplay.unity index c59b096..02130be 100644 --- a/Assets/Scenes/Gameplay.unity +++ b/Assets/Scenes/Gameplay.unity @@ -1340,79 +1340,79 @@ Prefab: objectReference: {fileID: 1197925315} - target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} propertyPath: strategy.awarenessChange.friendRatio.x - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} - propertyPath: strategy.awarenessChange.friendRatio.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} - propertyPath: strategy.awarenessChange.friendRatio.z value: .200000003 objectReference: {fileID: 0} + - target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} + propertyPath: strategy.awarenessChange.friendRatio.y + value: .800000012 + objectReference: {fileID: 0} + - target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} + propertyPath: strategy.awarenessChange.friendRatio.z + value: 1.5 + objectReference: {fileID: 0} - target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} propertyPath: strategy.awarenessChange.lastDeath.x - value: 1 + value: .600000024 objectReference: {fileID: 0} - target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} propertyPath: strategy.deathNoticing.popularity.x - value: .100000001 + value: .75 objectReference: {fileID: 0} - target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} propertyPath: strategy.deathNoticing.importance.x - value: .100000001 + value: .75 objectReference: {fileID: 0} - target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} propertyPath: strategy.deathNoticing.numFriends.x - value: .100000001 + value: .75 objectReference: {fileID: 0} - target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} propertyPath: strategy.deathNoticing.awareness.x - value: .100000001 + value: .75 objectReference: {fileID: 0} - target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} propertyPath: strategy.chanceToPost.popularity.x - value: .100000001 + value: .699999988 objectReference: {fileID: 0} - target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} propertyPath: strategy.chanceToPost.importance.x - value: .100000001 + value: .699999988 objectReference: {fileID: 0} - target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} propertyPath: strategy.chanceToPost.frequency.x - value: .100000001 + value: .699999988 objectReference: {fileID: 0} - target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} propertyPath: strategy.awarenessChange.lastDeath.y - value: 0 + value: .400000006 objectReference: {fileID: 0} - target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} propertyPath: strategy.deathNoticing.popularity.y - value: .899999976 + value: .25 objectReference: {fileID: 0} - target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} propertyPath: strategy.deathNoticing.importance.y - value: .899999976 + value: .25 objectReference: {fileID: 0} - target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} propertyPath: strategy.deathNoticing.numFriends.y - value: .899999976 + value: .25 objectReference: {fileID: 0} - target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} propertyPath: strategy.deathNoticing.awareness.y - value: .899999976 + value: .25 objectReference: {fileID: 0} - target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} propertyPath: strategy.chanceToPost.popularity.y - value: .899999976 + value: .300000012 objectReference: {fileID: 0} - target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} propertyPath: strategy.chanceToPost.importance.y - value: .899999976 + value: .300000012 objectReference: {fileID: 0} - target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} propertyPath: strategy.chanceToPost.frequency.y - value: .899999976 + value: .300000012 objectReference: {fileID: 0} - target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} propertyPath: strategy.awarenessChange.lastDeath.z @@ -1458,6 +1458,14 @@ Prefab: propertyPath: levelOptions.FriendshipLikeliness value: .600000024 objectReference: {fileID: 0} + - target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} + propertyPath: strategy.awarenessChange.modifier + value: .300000012 + objectReference: {fileID: 0} + - target: {fileID: 11432906, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} + propertyPath: strategy.awarenessChange.maxDeathDuration + value: 20160 + objectReference: {fileID: 0} m_RemovedComponents: [] m_ParentPrefab: {fileID: 100100000, guid: 136ea38d5deb4c9418beb879167d9b03, type: 2} m_IsPrefabParent: 0 diff --git a/Assets/Scripts/Models/GameStrategy.cs b/Assets/Scripts/Models/GameStrategy.cs index ae89cf2..642579c 100644 --- a/Assets/Scripts/Models/GameStrategy.cs +++ b/Assets/Scripts/Models/GameStrategy.cs @@ -14,6 +14,7 @@ namespace DeathBook.Model public Vector3 friendRatio = new Vector3(); public Vector3 lastDeath = new Vector3(); public float maxDeathDuration = 24 * 60 * 7; + public float modifier = 0.1f; } [System.Serializable] @@ -23,6 +24,7 @@ namespace DeathBook.Model public Vector3 importance = new Vector3(); public Vector3 numFriends = new Vector3(); public Vector3 awareness = new Vector3(); + public float modifier = 0.1f; } [System.Serializable] @@ -31,6 +33,7 @@ namespace DeathBook.Model public Vector3 popularity = new Vector3(); public Vector3 importance = new Vector3(); public Vector3 frequency = new Vector3(); + public float modifier = 0.1f; } @@ -40,14 +43,14 @@ namespace DeathBook.Model public float GetAwarenessChange(int numDeadFriends, int numAliveFriends, int sinceLastDeath) { - float friendsRatioInd = numAliveFriends == 0 ? 1 : GetValue(Mathf.Min(numDeadFriends / numAliveFriends, 1), awarenessChange.friendRatio); + float friendsRatioInd = numAliveFriends == 0 ? 1 : GetValue(Mathf.Min(numDeadFriends * 1f / numAliveFriends, 1f), awarenessChange.friendRatio); float max = awarenessChange.maxDeathDuration; float lastDeathInd = GetValue(1 - Mathf.Min(sinceLastDeath, max) / max, awarenessChange.lastDeath); - //Debug.Log(lastDeathInd + " " + friendsRatioInd); + Debug.Log(friendsRatioInd + " -- " + lastDeathInd); - return Mathf.Clamp(friendsRatioInd * lastDeathInd, 0, 1); + return Mathf.Clamp(friendsRatioInd * lastDeathInd, 0, 1) * awarenessChange.modifier; } public float GetDeathNoticing(float friendPopularity, float friendshipImportance, int numAliveFriends, float awareness) @@ -56,12 +59,11 @@ namespace DeathBook.Model float importanceInd = GetValue(friendshipImportance, deathNoticing.importance); - //TODO Should be inverse and there should be an expected number of friends - float aliveFriendsInd = GetValue(numAliveFriends, deathNoticing.numFriends); + float aliveFriendsInd = GetValue(Mathf.Min(numAliveFriends * 0.1f, 1), deathNoticing.numFriends); float awarenessInd = GetValue(awareness, deathNoticing.awareness); - return Mathf.Clamp(popularityInd * importanceInd * aliveFriendsInd * awarenessInd, 0, 1); + return Mathf.Clamp(popularityInd * importanceInd * aliveFriendsInd * awarenessInd, 0, 1) * deathNoticing.modifier; } public float GetChanceToPost(float friendPopularity, float friendshipImportance) @@ -70,7 +72,7 @@ namespace DeathBook.Model float importanceInd = GetValue(1 - friendshipImportance, deathNoticing.importance); - return Mathf.Clamp(popularityInd * importanceInd, 0, 1); + return Mathf.Clamp(popularityInd * importanceInd, 0, 1) * chanceToPost.modifier; } public float GetChanceToRead() diff --git a/Assets/Tests/RulesTest.cs b/Assets/Tests/RulesTest.cs new file mode 100644 index 0000000..bb321a7 --- /dev/null +++ b/Assets/Tests/RulesTest.cs @@ -0,0 +1,65 @@ +using UnityEngine; +using System.Collections; +using DeathBook.Model; + +public class RulesTest : MonoBehaviour { + + public GameStrategy strategy = new GameStrategy(); + public ChangeAwarenessTest awareness = new ChangeAwarenessTest(); + public NoticeDeathTest noticeDeath = new NoticeDeathTest(); + + public static GameStrategy str = null; + + [System.Serializable] + public class ChangeAwarenessTest + { + public int numDeadFriends; + public int numAliveFriends; + public int sinceLastDeath; + public bool test = false; + public float result = 0f; + + public void Update() + { + if (!test) + return; + + test = false; + + result = RulesTest.str.GetAwarenessChange(numDeadFriends, numAliveFriends, sinceLastDeath); + } + } + + [System.Serializable] + public class NoticeDeathTest + { + public float popularity; + public float importance; + public int numAliveFriends; + public float awareness; + + public bool test = false; + public float result = 0f; + + public void Update() + { + if (!test) + return; + + test = false; + + result = RulesTest.str.GetDeathNoticing(popularity, importance, numAliveFriends, awareness); + } + } + + + // Use this for initialization + void Start () { + str = strategy; + } + + // Update is called once per frame + void Update () { + awareness.Update(); + } +} diff --git a/Assets/Tests/RulesTest.cs.meta b/Assets/Tests/RulesTest.cs.meta new file mode 100644 index 0000000..fc20f74 --- /dev/null +++ b/Assets/Tests/RulesTest.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: debe9fb44675c3e49ba7e4c511a91076 +timeCreated: 1439754262 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: