A Python game interface, animation, and AI library designed to allow players to act out a character using physicality rather than dialogue
Please note that this repository is currently being used to maintain a copy of Puppitor separate from its game development branch and as such will not be updated frequently. The system is still in development and will not have documentation or examples created for public use for some time.
src:
-
corecontains the modules needed for basic functionality in Puppitor:affecter.py(contains state tracking and rules application code housed in theAffecterclass as well asmake_affect_vector()which is used to format a python dictionary for use withAffecterfeatures)action_key_map.py(contains input mapping and state tracking in theAction_Key_Mapclass for use either with keyboard, and mouse button, input or AI behavior algorithms, can be used to drive changes in state to be applied toaffect_vectorsusing rules stored in anAffecter)
-
secondarycontains potentially useful modules in either driving or reacting to state changes in Puppitor's core modules:animation_structure.py(contains theAnimation_Structureclass designed for reactive sprite animation based on the states tracked by anAffecterandAction_Key_Map)npc_greedy.py(contains thethinkfunction that performs a greedy search over a given affect_vector, thecurrent_emotional_stateargument, using a givenaction_key_mapandaffecteras the basis for actions to try and effects to evaluate)npc_uct.py(contains theuct_thinkfunction that performs Monte Carlo Tree Search based on given Puppitor inputs as well as the Node class for building trees)npc_a_star.py(contains thenpc_a_star_thinkfunction that performs A* search from a givenaffect_vectortowards agoal_emotion)
tools:
-
prfeu.py(tests a given rule file and affect vector to see if a particular affect is expressable using a selected search algorithm)- usage:
$ py prfeu.py ./affect_rules/test_passions_rules.json ./key_map.json ./affect_vector.json fear resting neutral 180 0
- usage:
-
a_star_unit_test.py(tests a given rule file over each of its possible affects by starting an A* search from the least ideal state possible, thegoal_emotionvalue at 0 and every other value in an affect vector at 1. Prints the results of each trial)- usage:
$ py a_star_unit_test.py ./affect_rules/test_passions_rules.json ./key_map.json resting neutral 180 F
- usage:
To use Puppitor simply put affecter.py and action_key_map.py files in the desired directory and have import affecter and import action_key_map lines your project. Note that to use the components of affecter.py you will need to have JSON files formatted as Puppitor rules, examples can be found in affect_rules. Detailed API descriptions to come.
To run the CLI utilities found in tools you will need to move them into a directory containing affecter.py, action_key_map.py, npc_a_star.py, npc_uct.py, and npc_greedy.py as well as a json rule file, json key map file and for prfeu.py a json file with an affect vector in it. Example files can be found in the tools directory.
for prfeu.py:
$ py prfeu.py ./affect_rules/test_passions_rules.json ./key_map.json ./affect_vector.json fear resting neutral 180 0 -q 2000
for a_star_unit_test.py:
$ py a_star_unit_test.py ./affect_rules/test_passions_rules.json ./key_map.json resting neutral 180 F <optional queue size limit argument>