Deeds not being reported.

Announcements, support questions, and discussion for Love/Hate.
Post Reply
cranda11
Posts: 3
Joined: Fri Dec 04, 2015 10:58 pm

Deeds not being reported.

Post by cranda11 »

the system seems to work ok if there are only around 5-10 characters however when getting into the higher numbers of faction members the system seems to not register the deed being committed, or at least the deed being done is not registering in the relationship section. help would be greatly appreciated.

Example code:

cooldownTimer += Time.deltaTime;
RaycastHit hit;
Ray myRay = new Ray (origin.position,origin.TransformDirection(Vector3.forward));
Debug.DrawRay(origin.position, origin.TransformDirection(Vector3.forward) * deploymentHeight1);
if (Physics.Raycast (myRay, out hit, deploymentHeight1))
{
if (hit.collider.tag == "Enemy") {
FactionMember targetFactionMember = hit.collider.gameObject.GetComponent<FactionMember>();
if (currentBaseState.nameHash == fightJabState)
{
if(cooldownTimer > 0.65f)
{

EnemyHealth eh = (PrisonerHealth)hit.collider.GetComponent("EnemyHealth ");
ph.health -= 5;
cooldownTimer = 0f;
if(targetFactionMember != null)
{
Debug.Log("ReportHit");//this is calling
GetComponent<DeedReporter>().ReportDeed("Hit", targetFactionMember); //this is not calling or at least not registering in the faction members relationship section
if(eh.health <= 0)
{
fm.SetPersonalAffinity(targetFactionMember.name, -10);
targetFactionMember.SetPersonalAffinity(fm.name, -25);
}
}
}
}
}
}
User avatar
Tony Li
Posts: 22110
Joined: Thu Jul 18, 2013 1:27 pm

Re: Deeds not being reported.

Post by Tony Li »

Hi,

There are a few reasons why deeds might not register:

1. When a deed occurs, Love/Hate adds potential witnesses to a queue. It then processes one witness each Update. If you're running at 60 frames per second, this means it will process 60 witnesses each second. If 120 witnesses are in range, it could take 2 seconds for them all to witness the deed. The next version of Love/Hate (coming out in a few days) will let you increase the number of witnesses processed each frame.

2. Witnesses evaluate the deed based on the formula described at the end of the manual. If the deed isn't important enough to the witness, it won't register. The deed's evaluated impact will be in the range [0,100]. It must be greater than the witness's Deed Impact Threshold to register. The default value is 2. The Acclimatization Curve specifies how repeated occurrences of the deed affect the impact. For example, the first time the player hits a prisoner, witnesses might be like dayum! and judge the deed at its full impact. But after the 100th hit, witnesses might just shrug and ignore it. To get insight into how a character evaluates deeds, tick the Faction Member's Debug Eval Func checkbox. This will log the formula's values to the console; you can follow along with the formula as described in the manual.

3. Check your deed definition. If you've ticked Requires Sight, each potential witness will do a physics-based line of sight check. (You can change the check by assigning the faction member's CanSee delegate.) If you've set Radius to something higher than 0, only characters within the radius of the deed (centered on the character committing the deed) will be able to witness it.

Here's an example scene that you can use to test more than 5-10 characters:

LH_TestMany_2015-12-05.unitypackage

It's a variation on the basic example scene, which was only designed for 5 characters. The scene's 2D physics components weren't designed for really huge numbers. (Each character has 3 physics components and isn't particularly efficient about using them.) You can bump it up to 100-200 characters on a desktop machine by setting the Test Many GameObject's Count field. It'll look something like this:

Image

If you want to test more than that, delete the physics components from the source characters. For example, I removed Princess from Test Many's Sources list so there'd be one Princess that I could bump into to get the deed menu. Then I removed the physics components from Cat Girl, Horn Girl, and Pink Girl, and set Count to 2000.

If that doesn't help, please feel free to send an example project to tony (at) pixelcrushers.com. I'll be happy to take a look!
Post Reply