mirror of
https://github.com/ConjureETS/DeathBook.git
synced 2026-03-24 04:20:58 +00:00
Finished the friendship randomization.
Added a probability to spread out better the results. Signed-off-by: RosimInc <rosim_inc@hotmail.com>
This commit is contained in:
parent
f91fcd3eb4
commit
bbf3de222f
@ -260,10 +260,11 @@ MonoBehaviour:
|
||||
LinkObj: {fileID: 11495142, guid: fab430cecad80ad4391987a06b550cb7, type: 2}
|
||||
PersonObj: {fileID: 11406500, guid: 646dd6566f9e1374caa3af8ad37c43d3, type: 2}
|
||||
NumPeople: 100
|
||||
AvgNumFriends: 20
|
||||
AvgNumFriends: 10
|
||||
FriendshipLikeliness: .300000012
|
||||
SphereRadius: 7
|
||||
rotationSpeed: .699999988
|
||||
torqueForce: 35
|
||||
torqueForce: .100000001
|
||||
--- !u!54 &736567790
|
||||
Rigidbody:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@ -7,12 +7,14 @@ namespace DeathBook.Model
|
||||
{
|
||||
private int numPeople;
|
||||
private int avgConnections;
|
||||
private float probability;
|
||||
private float radius;
|
||||
|
||||
public Level GenerateLevel(int numPeople, int avgFriends, float radius)
|
||||
public Level GenerateLevel(int numPeople, int avgFriends, float probability, float radius)
|
||||
{
|
||||
this.numPeople = numPeople;
|
||||
this.avgConnections = avgFriends;
|
||||
this.probability = probability;
|
||||
this.radius = radius;
|
||||
|
||||
List<Person> people = CreatePeople();
|
||||
@ -55,7 +57,7 @@ namespace DeathBook.Model
|
||||
|
||||
private List<Friendship> CreateFriendships(List<Person> people)
|
||||
{
|
||||
Debug.Log("Creating friendships");
|
||||
Debug.Log("Creating friendships" + probability);
|
||||
|
||||
List<Friendship> friendships = new List<Friendship>();
|
||||
Person p1, p2;
|
||||
@ -67,7 +69,6 @@ namespace DeathBook.Model
|
||||
|
||||
for (int i = 0; i < totalCount; i++)
|
||||
{
|
||||
Debug.Log("Person " + (i+1));
|
||||
p1 = people[i];
|
||||
missing = avgConnections - p1.numFriends; // TODO Add randomness
|
||||
|
||||
@ -86,10 +87,13 @@ namespace DeathBook.Model
|
||||
while (list.Count > 0 && missing > 0)
|
||||
{
|
||||
DistanceNode smallest = list.First.Value;
|
||||
|
||||
//Lerp between probability and 1, depending on how many are left and how many are missing
|
||||
|
||||
float prob = Mathf.Lerp(probability, 1, missing / list.Count);
|
||||
foreach (DistanceNode node in list)
|
||||
{
|
||||
if (node.dist < smallest.dist)
|
||||
//TODO Add probabilities
|
||||
if (node.dist < smallest.dist && Random.value < prob)
|
||||
smallest = node;
|
||||
}
|
||||
//TODO Code/use a heap instead
|
||||
|
||||
@ -9,6 +9,7 @@ public class SphereSR : MonoBehaviour
|
||||
public PersonTest PersonObj;
|
||||
public int NumPeople = 50;
|
||||
public int AvgNumFriends = 20;
|
||||
public float FriendshipLikeliness = 0.4f;
|
||||
public float SphereRadius = 1f;
|
||||
public float rotationSpeed = 0.7f;
|
||||
|
||||
@ -24,7 +25,7 @@ public class SphereSR : MonoBehaviour
|
||||
void Awake()
|
||||
{
|
||||
LevelGenerator lGen = new LevelGenerator();
|
||||
Level lvl = lGen.GenerateLevel(NumPeople, AvgNumFriends, SphereRadius);
|
||||
Level lvl = lGen.GenerateLevel(NumPeople, AvgNumFriends, FriendshipLikeliness, SphereRadius);
|
||||
|
||||
InstantiateNodes(lvl);
|
||||
AssignLinks(lvl);
|
||||
|
||||
@ -3,14 +3,17 @@
|
||||
--- !u!129 &1
|
||||
PlayerSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 7
|
||||
serializedVersion: 6
|
||||
AndroidProfiler: 0
|
||||
defaultScreenOrientation: 4
|
||||
targetDevice: 2
|
||||
targetGlesGraphics: -1
|
||||
targetIOSGraphics: -1
|
||||
targetResolution: 0
|
||||
accelerometerFrequency: 60
|
||||
companyName: DefaultCompany
|
||||
productName: DeathBook
|
||||
cloudProjectId:
|
||||
defaultCursor: {fileID: 0}
|
||||
cursorHotspot: {x: 0, y: 0}
|
||||
m_ShowUnitySplashScreen: 1
|
||||
@ -23,6 +26,7 @@ PlayerSettings:
|
||||
m_ActiveColorSpace: 0
|
||||
m_MTRendering: 1
|
||||
m_MobileMTRendering: 0
|
||||
m_UseDX11: 1
|
||||
m_Stereoscopic3D: 0
|
||||
iosShowActivityIndicatorOnLoading: -1
|
||||
androidShowActivityIndicatorOnLoading: -1
|
||||
@ -77,7 +81,6 @@ PlayerSettings:
|
||||
metroEnableIndependentInputSource: 0
|
||||
metroEnableLowLatencyPresentationAPI: 0
|
||||
xboxOneDisableKinectGpuReservation: 0
|
||||
virtualRealitySupported: 0
|
||||
productGUID: 402278fad2098ce4eab29439139ae9ad
|
||||
AndroidBundleVersionCode: 1
|
||||
AndroidMinSdkVersion: 9
|
||||
@ -120,7 +123,6 @@ PlayerSettings:
|
||||
iOSLaunchScreenCustomXibPath:
|
||||
AndroidTargetDevice: 0
|
||||
AndroidSplashScreenScale: 0
|
||||
androidSplashScreen: {fileID: 0}
|
||||
AndroidKeystoreName:
|
||||
AndroidKeyaliasName:
|
||||
AndroidTVCompatibility: 1
|
||||
@ -134,7 +136,6 @@ PlayerSettings:
|
||||
resolutionDialogBanner: {fileID: 0}
|
||||
m_BuildTargetIcons: []
|
||||
m_BuildTargetBatching: []
|
||||
m_BuildTargetGraphicsAPIs: []
|
||||
webPlayerTemplate: APPLICATION:Default
|
||||
m_TemplateCustomTags: {}
|
||||
actionOnDotNetUnhandledException: 1
|
||||
@ -196,7 +197,6 @@ PlayerSettings:
|
||||
ps4ApplicationParam2: 0
|
||||
ps4ApplicationParam3: 0
|
||||
ps4ApplicationParam4: 0
|
||||
ps4GarlicHeapSize: 2048
|
||||
ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ
|
||||
ps4pnSessions: 1
|
||||
ps4pnPresence: 1
|
||||
@ -339,7 +339,8 @@ PlayerSettings:
|
||||
blackberrySquareSplashScreen: {fileID: 0}
|
||||
tizenProductDescription:
|
||||
tizenProductURL:
|
||||
tizenSigningProfileName:
|
||||
tizenCertificatePath:
|
||||
tizenCertificatePassword:
|
||||
tizenGPSPermissions: 0
|
||||
tizenMicrophonePermissions: 0
|
||||
stvDeviceAddress:
|
||||
@ -397,9 +398,4 @@ PlayerSettings:
|
||||
- WebGL::template
|
||||
WebGL::emscriptenArgs:
|
||||
WebGL::template: APPLICATION:Default
|
||||
firstStreamedSceneWithResources: 0
|
||||
cloudProjectId:
|
||||
projectId:
|
||||
projectName:
|
||||
organizationId:
|
||||
cloudEnabled: 0
|
||||
firstStreamedLevelWithResources: 0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user