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

Need Based Behaviors #11

Merged
merged 16 commits into from
Aug 2, 2019
Merged

Conversation

AndyTechGuy
Copy link
Collaborator

@AndyTechGuy AndyTechGuy commented Jul 3, 2019

Contains

  • Need based behaviors, where characters perform certain actions based on the satisfaction of hunger/thirst/other needs.

How to Test

  1. Start a world with MetalRenegades enabled in a Dynamic City worldtype.
  2. Wait for characters to spawn inside of buildings

Food Need

  • After a certain period of time, usually about 6-7 minutes, the character will become hungry, and will travel towards the nearest marketplace to satisfy their hunger.

Thirst Need

  • After a certain period of time, usually about 3 minutes, the character will become thirsty, and will travel towards the nearest well to satisfy their hunger. Note: With StructureTemplate placement still off at times DynamicCities#35, these wells do not spawn properly on the parcel. The character will travel towards the parcel instead of the well (parcel size ranges from 5x5 to 7x7)

Rest Need

  • After a certain period of time, usually about 15 minutes, the character will become tired, and will travel towards the nearest house (not necessarily their own shelter) and rest on the spot for a minute.

Communication Need

  • After a certain period of time, usually about 7-8 minutes, the character will require a social interaction. This character will find another character with this need, and they will travel towards each other until they meet.

Shelter Need

  • At night, all characters will return back to their spawn home, all across the city.

TODO

  • Food needs
  • Thirst needs
  • Addition of wells/other water source
  • Rest need (fixed time based)
  • Shelter need (time cycle based)
  • Communication need (citizen-citizen)

@AndyTechGuy AndyTechGuy changed the title Need Based Behaviors and Implementation of Final Characters Need Based Behaviors Jul 15, 2019
@AndyTechGuy AndyTechGuy marked this pull request as ready for review July 16, 2019 22:54
Vector3f characterLocation = actor.getComponent(LocationComponent.class).getWorldPosition();
EntityRef otherCitizen = null;

for (EntityRef other : entityManager.getEntitiesWith(NeedsComponent.class)) {
Copy link
Member

Choose a reason for hiding this comment

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

This looks very similar to SimpleComponentTargetAction. Can't you move this into a new method? It could maybe even be a static one in a external class that takes the component class and a max. distance.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I made the social need use SimpleComponentTargetAction, however some functions are still needed outside of the normal component tracking that is needed to make the social need work, these have been moved to the actions AddSocialComponentAction and PrepareSocialAction

Copy link

@RatMoleRat RatMoleRat left a comment

Choose a reason for hiding this comment

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

All the behaviors appear to work. Although I did see a couple gooeys out at night, they seem to just be stuck on blocks, which I don't think is as a result of this PR. I did find one issue with a prefab, but once that's fixed I think this is good to go!

assets/prefabs/characters/neutralGooey.prefab Outdated Show resolved Hide resolved
@AndyTechGuy AndyTechGuy merged commit 8ca63a0 into Terasology:master Aug 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants