|
DI-Guy Lua AI SDK
|
A complex middle eastern pedestrian that can implement a number of behaviors. More...
Public Member Functions | |
| init_package () | |
| Framework function, this function is automatically called on the package at t = 0. More... | |
| populate_panel (panel, style_sheet) | |
| set_hunger_rate (value) | |
| Sets the global shared hunger value, usually between 0-2. More... | |
| set_socialize_rate (value) | |
| Sets the global shared socialize value, usually between 0-2. More... | |
| set_prayer_rate (value) | |
| Sets the global shared prayer increase rate, usually between 0-2. More... | |
| set_unrest_rate (value) | |
| Sets the global shared unrest amount, usually between 0-100. value of 50 is neutral. More... | |
| on_impact_callback () | |
| callbacks hooked up in init script More... | |
Per character overloads | |
| die_now (kill_the_character) | |
| one_time_init () | |
| called the first time characters are created More... | |
| init () | |
| reset () | |
| this function resets the characters various state bits, it's automatically called on scenario reset More... | |
Support Functions | |
| choose_max (...) | |
| A function that chooses the most intense reaction given a table of reactions. More... | |
| choose_reaction () | |
| Used by the background ambient states to decide if any desire is currently high enough to act on. More... | |
| show_emotion_balloon (intensity, text, color) | |
| Sets up a thought bubble above the pedestrians head. More... | |
| heartbeat () | |
| default heartbeat function runs every 2 seconds. More... | |
States | |
| entry_point () | |
| the default entry point of the character's mind More... | |
| process_signal (message_object) | |
| Default process signal message processing function, shared by most of the higher processing functions. More... | |
| process_messages (message_object) | |
| The default message processing function. More... | |
| flee_state (impact) | |
| A simple flee state, the character will not flee if they are too angry. More... | |
| angry_state (intensity) | |
| cheering_state () | |
| A simple cheering state (assumes the focus object is already set) More... | |
| attention_state (monitor) | |
| A temporay state that has the character reacting to a nearby net freindly or net opposing character. More... | |
Public Member Functions inherited from luaMiddleEastBaseClass | |
| show_speech_balloon (text) | |
| shows a solid white speech ballon over the characters head. More... | |
| show_thought_balloon (text) | |
| shows a white semi transparent thought ballon over the characters head. More... | |
| hide_thought_balloon () | |
| hides the thought/speech ballon More... | |
| die_now () | |
| cleans up the label on death More... | |
| set_desired_orientation_to_target (character_target) | |
| turns the character towards a target. Character should be in idle behavior More... | |
| set_desired_orientation_to_impact (impact) | |
| turns the character towards a impact. Character should be in idle behavior More... | |
| convert_to_ragdoll (vx, vy, vz) | |
| On a high velocity impact this turns the character into a simple ragdoll. More... | |
Public Member Functions inherited from luaCharacter | |
| get_ui_signals () | |
| This function returns a comma separated list of signals that the agent is currently willing to accept. More... | |
| get_ui_state_label () | |
| This function returns a string that the DI-Guy Scenario UI will add onto the end of the state name label. More... | |
| one_time_init () | |
| This function is called when a mind is first created, currently no ops. More... | |
| init (arg0, arg1, arg2) | |
| This function is called at t=0 or when a mind is created, currently no ops. More... | |
| reset () | |
| This function resets the luaCharacter representation, called by c++ on scenario reset. More... | |
| destroy () | |
| This function is called by C++ when the character is destroyed. Overload it to trigger any world cleanup on destruction. More... | |
| die_now () | |
| This function is called when the character is killed. Overload it to trigger any final events or agent clean up on death. More... | |
| draw () | |
| This function is called by diguy scenario to draw a lua object Overload it to create your own Drawing behavior. More... | |
| entry_point () | |
| This function is called by the state manager as the entry point into the lua state machine. Overload it to create your own HFSM. More... | |
| send_message_to_character (to, from, msg_type, message, params) | |
| Send a message from a character to a character, will automatically send message over network. More... | |
| state_manager (sender, message_type, message, params) | |
| This is the main entry point from C++ into the lua framework. More... | |
| sleep (duration) | |
| sleep_until (wake_time) | |
| sleep_ignore_messages (duration) | |
| This is a simple sleep function, it will put the character to sleep for the duration specified. Messages will not be processed. More... | |
| sleep_process_messages (duration, message_handler) | |
| This is a sleep function that can take a message_handler function. More... | |
| wait_for_message (message_to_wait_for, message_handler, bg_check_func, bg_freq) | |
| This is a sleep function that will wait a long time and only wake up when a specific message is recieved. More... | |
| wait_for_multichoice (...) | |
| This is a sleep function that will wait a long time and only wake up when one of a few specific messages are recieved. More... | |
| internal_get_user_selected (options) | |
| Internal support function used by other picking functions. More... | |
| get_user_selected_point (_options) | |
| Function returns a point in the world, picked via the UI. More... | |
| get_user_selected_character (_options) | |
| Function returns a character in the world, picked via the ui. More... | |
| simple_move_to_state (x, y, z, message_handler, bg_check_func, bg_check_freq, force_a_star) | |
| This function implements a simple move to state. More... | |
| simple_move_to_path_state (path, message_handler, bg_check_func, bg_check_freq, force_a_star) | |
| get_state_name (state_function, object) | |
| Convenience function for printing the name of a state, given a function_pointer. More... | |
| begin_state (_name) | |
| Convenience function for storing the current state in the luaCharacter. More... | |
| get_current_and_previous_states () | |
| Convenience function for debugging. Returns comma-separated list of recent states. More... | |
| is_new_state (ret) | |
| Convenience function for checking if the argument is a new state table. More... | |
| invoke_state (new_state, cleanup_function, extra_info) | |
| Convenience function for doing a tail call function invokation. More... | |
| draw_path () | |
| Function that draws the character's current path object. More... | |
| draw_line_from_self () | |
| Function draws a line from self to the point under the mouse, plus it either a circle under the mouse point. More... | |
| get_user_selected_path (message, use_default_ui_draw_function) | |
| Function returns a string and a path clicked in the world, picked via the UI. More... | |
| scheduler_heartbeat () | |
| Experimental - heartbeat function for the post event sceduler. More... | |
| add_scheduled_event (callback_data) | |
| Experimental - adds a function to happen in the future. More... | |
| update_scheduler () | |
| process_messages_enroute (message_obj) | |
Public Attributes | |
| s_HUNGER_RATE = .15 | |
| s_SOCIALIZE_RATE = .1 | |
| s_PRAYER_RATE = 0 | |
| string | impact_callback = |
Base states | |
these states can spawn off other reactions if desire gets high enough | |
| travel_state () | |
| Simple ambient travel state. More... | |
| instigator_state () | |
| A new base state where the character will attempt to influence the people around them. More... | |
| go_to_prayer_state () | |
| the prayer plan, characters will go to the mosque and carry out it's prayer plan More... | |
| find_company_state () | |
| the socialize plan, character will look up a gender appropriate socialize object and go socialize More... | |
| find_food_state () | |
| the eating plan, character will look up the nearest food location and go eat More... | |
| get_schedule_signals () | |
| Returns a list of supported signals that can be converted into schedule events. More... | |
| export_schedule_events () | |
| Returns the custom schedule events that this class supports. More... | |
| fill_go_to_args (event_table_entry, arg_name, role_name) | |
| Populates schedule event arguments. More... | |
| do_go_to_event (action, role, group, location, percent, time_window) | |
| Handles a "go to" event for a simple pedestrian. More... | |
| static | do_schedule_action (lua_class_name, group, message_string, location, percent, time_window) |
| Handles a schedule event action. More... | |
A complex middle eastern pedestrian that can implement a number of behaviors.
This AI shows off a number of different concepts:
| luaMiddleEasternPedestrian::angry_state | ( | intensity | ) |
A simple angry state, depending on how angry the character is, the character will
| luaMiddleEasternPedestrian::attention_state | ( | monitor | ) |
A temporay state that has the character reacting to a nearby net freindly or net opposing character.
This state has the pedestrian reacting to either the net_friendly's or the net_opposing groups. It uses one of the attention monitors as an argument. Effectively if a character is happy they react positively towards a friendly and hostile to a net_opposing character. If they are angry the response is reversed.
| luaMiddleEasternPedestrian::cheering_state | ( | ) |
A simple cheering state (assumes the focus object is already set)
| luaMiddleEasternPedestrian::choose_max | ( | ... | ) |
A function that chooses the most intense reaction given a table of reactions.
This function expects a table with n elements, each element should have an amount field. When it finds the element with the largest amount it returns that structure.
| luaMiddleEasternPedestrian::choose_reaction | ( | ) |
Used by the background ambient states to decide if any desire is currently high enough to act on.
This function is used by the background ambient states to decide if any desire is currently high enough to act on. It returns a tail call which enters and executes the new state or just ends if no desire is high enough
| luaMiddleEasternPedestrian::die_now | ( | kill_the_character | ) |
| luaMiddleEasternPedestrian::do_go_to_event | ( | action | , |
| role | , | ||
| group | , | ||
| location | , | ||
| percent | , | ||
| time_window | |||
| ) |
Handles a "go to" event for a simple pedestrian.
This is an experimental function. It probably should be developed into something more useful. See export_schedule_events()
Arguments
| action | |
| role | |
| group | |
| location | |
| percent | |
| time_window |
|
static |
Handles a schedule event action.
This is an experimental function. It probably should be developed into something more useful. See do_go_to_event()
Arguments
| lua_class_name | |
| group | |
| group | |
| location | |
| percent | |
| time_window |
| luaMiddleEasternPedestrian::entry_point | ( | ) |
the default entry point of the character's mind
| luaMiddleEasternPedestrian::export_schedule_events | ( | ) |
Returns the custom schedule events that this class supports.
COMMENTED OUT FOR NOW
Used by schedule event framework. The complementary function is get_schedule_signals(), which is an easier way to make character actions available to event scheduling system.
| luaMiddleEasternPedestrian::fill_go_to_args | ( | event_table_entry | , |
| arg_name | , | ||
| role_name | |||
| ) |
Populates schedule event arguments.
Arguments
| event_table_entry | entry from the schedule event table |
| arg_name | name of parameter to populate |
| role_name | the role that will handle the action |
| luaMiddleEasternPedestrian::find_company_state | ( | ) |
the socialize plan, character will look up a gender appropriate socialize object and go socialize
| luaMiddleEasternPedestrian::find_food_state | ( | ) |
the eating plan, character will look up the nearest food location and go eat
| luaMiddleEasternPedestrian::flee_state | ( | impact | ) |
A simple flee state, the character will not flee if they are too angry.
Also they are less likely to respond to new flee events when they are already fleeing
| impact | a diguyImpact object |
| luaMiddleEasternPedestrian::get_schedule_signals | ( | ) |
Returns a list of supported signals that can be converted into schedule events.
Used by schedule event framework. The complementary function is export_schedule_events(), which allows more customization of what a particular event does.
| luaMiddleEasternPedestrian::go_to_prayer_state | ( | ) |
the prayer plan, characters will go to the mosque and carry out it's prayer plan
| luaMiddleEasternPedestrian::heartbeat | ( | ) |
default heartbeat function runs every 2 seconds.
Responsible for updating the thought bubble if the intensity is high enough, this function also gradually increases hunger, socialize need. May increase or decrease anger over time as well.
| luaMiddleEasternPedestrian::init | ( | ) |
| luaMiddleEasternPedestrian::init_package | ( | ) |
Framework function, this function is automatically called on the package at t = 0.
Establishes shared defaults for all the characters. This can be changed at other times of day changing luaMiddleEasternPedestrian.s_HUNGER_RATE ... etc in a script event.
| luaMiddleEasternPedestrian::instigator_state | ( | ) |
A new base state where the character will attempt to influence the people around them.
This is a new base state that the character will stay in till ordered out of. Instead of wandering their path, the character will stay in the place that they were when the instigation began and will try to influance nearby characters to make them angry.
| luaMiddleEasternPedestrian::on_impact_callback | ( | ) |
callbacks hooked up in init script
| luaMiddleEasternPedestrian::one_time_init | ( | ) |
called the first time characters are created
| luaMiddleEasternPedestrian::populate_panel | ( | panel | , |
| style_sheet | |||
| ) |
| luaMiddleEasternPedestrian::process_messages | ( | message_object | ) |
The default message processing function.
The default message processing function takes a message object and translates into an action
The init code copies this function into process_messages_enroute, which most of the plans expect the character to have.
| message_object | a luaMessageObject |
| luaMiddleEasternPedestrian::process_signal | ( | message_object | ) |
Default process signal message processing function, shared by most of the higher processing functions.
| message_object | a luaMessageObject |
| luaMiddleEasternPedestrian::reset | ( | ) |
this function resets the characters various state bits, it's automatically called on scenario reset
| luaMiddleEasternPedestrian::set_hunger_rate | ( | value | ) |
Sets the global shared hunger value, usually between 0-2.
| luaMiddleEasternPedestrian::set_prayer_rate | ( | value | ) |
Sets the global shared prayer increase rate, usually between 0-2.
| luaMiddleEasternPedestrian::set_socialize_rate | ( | value | ) |
Sets the global shared socialize value, usually between 0-2.
| luaMiddleEasternPedestrian::set_unrest_rate | ( | value | ) |
Sets the global shared unrest amount, usually between 0-100. value of 50 is neutral.
| luaMiddleEasternPedestrian::show_emotion_balloon | ( | intensity | , |
| text | , | ||
| color | |||
| ) |
Sets up a thought bubble above the pedestrians head.
This bubble has the color specified combined with the intensity of the emotion
| luaMiddleEasternPedestrian::travel_state | ( | ) |
Simple ambient travel state.
The character's will travel back and forth till a desire is great enough to react to or untill they get a message.
| string luaMiddleEasternPedestrian::impact_callback = |
| luaMiddleEasternPedestrian::s_HUNGER_RATE = .15 |
| luaMiddleEasternPedestrian::s_PRAYER_RATE = 0 |
| luaMiddleEasternPedestrian::s_SOCIALIZE_RATE = .1 |