Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Critter combined tree #113

Draft
wants to merge 18 commits into
base: develop
Choose a base branch
from
Draft

Critter combined tree #113

wants to merge 18 commits into from

Conversation

Jacob-Rueckert
Copy link
Contributor

I combined several critter behaviors into one.

Based on the student project in cooperation with @jdrueckert @skaldarnar

  • made a priority list of the current behaviors
  • added features from MetalRenegadesCitizen

Goal is to have an universal behavior which differs based on their configuration not their implementation.

// First Guard fo Selector for Territory End.
guard: { // Implementation of scared Critter
componentPresent: "Behaviors:FindNearbyPlayers",
values: ["N charactersWithinRange != null"], // Adjust for Nemesis / Scary Creatures
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We discussed this in the meeting today.

The N is a parsing directive that specifiies whether the condition has the form type fieldName operator or type fieldName operator valueOrReference.

Technically, we could use V charactersWithinRange != null to ensure that the list itself is defined and not null (checking agains the value null). However, this is not the semantics we are looking for.

Therefore, using the nonEmpty operator on the collection with no value to check against (N) is the solution:

Suggested change
values: ["N charactersWithinRange != null"], // Adjust for Nemesis / Scary Creatures
values: ["N charactersWithinRange nonEmpty"], // Adjust for Nemesis / Scary Creatures

// Territory would to be implemented as Component
// Implementation of territorial Critter
componentPresent: "Behaviours:Territory",
values: ["F Territory != null"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would try to make a lookup of a field (indicated by F) named null.

However, I believe you want to check against the value null, thus using V would be correct.

Suggested change
values: ["F Territory != null"],
values: ["V Territory != null"],

Alternatively, you can use the exists operator (basically ... != null) without an explicit value to check against:

Suggested change
values: ["F Territory != null"],
values: ["N Territory exists"],

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the comment above about the component, this should most likely be

Suggested change
values: ["F Territory != null"],
values: ["F location exists"],


// Territory would to be implemented as Component
// Implementation of territorial Critter
componentPresent: "Behaviours:Territory",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the TerritoryComponent exists in the Behaviors module.

The closest thing we have is TerritoryDistance, a component with two fields distance and location.

Therefore, the referenced component should probably be

Suggested change
componentPresent: "Behaviours:Territory",
componentPresent: "Behaviours:TerritoryDistance",

and the referenced field below cannot be Territory (as it does not exist) but either distance or location. I suspect that we can check whether the location is set.

change behaviour system from hard coded to configurable
Use for configuration of different entities to flee from
Implement Action in combinedCritter.behavior for new component
game crash on BehaviourTree initialisation because of NullPointerException
…nt to sheepBase

combinedCritter.behaviour crash on Territory stage cause of missing parameters
creature.saveComponent(territoryComponent);
}

/*
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this unnecessary when we look at the update Function above?

entity.getComponent(LocationComponent.class).getWorldPosition(new Vector3f()));
entity.saveComponent(territoryDistance);
for (EntityRef entity : entityManager.getEntitiesWith(TerritoryComponent.class, LocationComponent.class)) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So is this how it its supposed to work for DistanceSquared?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

3 participants