Skip to content
Snippets Groups Projects
  1. Jan 14, 2018
  2. Dec 25, 2017
  3. Dec 22, 2017
  4. Nov 29, 2017
  5. Nov 19, 2017
  6. Nov 17, 2017
  7. Nov 13, 2017
  8. Nov 09, 2017
  9. Nov 05, 2017
  10. Nov 04, 2017
  11. Nov 03, 2017
  12. Oct 06, 2017
  13. Oct 05, 2017
  14. Sep 29, 2017
  15. Jul 28, 2017
  16. Jul 25, 2017
  17. Jul 17, 2017
  18. Jul 16, 2017
    • Hachem_Muche's avatar
      ActorAI:aiTalentTactics: simplified cache management · b10d3678
      Hachem_Muche authored
      ActorAI:aiCheckSustainedTalent:  will not allow activating talents with active sustain_slots unless the ._advanced_ai flag is set.
      
      NPCs will not continuously toggle vile poisons.
      
      improved_tactical AI documentation: "TACTICAL VALUE" renamed "TACTICAL SCORE" for clarity
      b10d3678
  19. Jul 01, 2017
    • Hachem_Muche's avatar
      Updated resting: · 14b95a1c
      Hachem_Muche authored
      Added a new callback "callbackOnWait" to trigger various effects when an Actor takes no action in a turn.  Added to Actor:waitTurn in place of "callbackOnRest."   New function Player:restCheck (an overload of engine/interface/PlayerRest:restCheck) triggers "callbackOnWait" when successfully resting.
      
      The recovery effects of Spacetime Tuning and Throwing Knives use the "callbackOnWait" callback.
      
      NPCs that know Spacetime Tuning will automatically set an appropriate preferred paradox value periodically (at 100 below the anomaly threshold).
      
      Added the game.turn to the output of a number of AI debugging statements.
      
      Fixed a bug where Chants and Hymns could be learned without also gaining the appropriate resource pool.
      14b95a1c
  20. Jun 29, 2017
  21. Jun 28, 2017
  22. Jun 26, 2017
    • Hachem_Muche's avatar
      Adjusted log_detail_ai setting for some messages. Combat log debugging... · 83bafd4a
      Hachem_Muche authored
      Adjusted log_detail_ai setting for some messages.  Combat log debugging messages require log_detail_ai > 1.4.
      83bafd4a
    • Hachem_Muche's avatar
      This update has 3 main parts: · bdc16947
      Hachem_Muche authored
      A)	Upgrading AI primitives (“infrastructure”) in the engine to make designing new and more capable AIs easier.
      B)	Rewriting the Talented and Tactical AIs, plus adding some supporting AIs, so that NPCs in ToME using them behave more intelligently.
      C)	Correcting and updating tactical tables and associated code for a number of (but not all) talents that are currently not being used effectively by NPCs.
      
      HIGHLIGHTS:
      Major rewrite of many AI definitions and functions, including new functions to make writing new AIs simpler.
      Completely new talented and tactical AIs (for ToME) that allow NPCs to act without contact with the player, actively manage all standard resources, and more consistently comply with their AI specifications.  This includes provisions for all NPCs to avoid drowning/grid damage, better coordinate movement and talent use, and invoke other AIs.
      NPCs can both activate and deactivate all sustain talents intelligently (particularly for the tactical AI) with or without player contact, according to the tactical situation.
      The new AIs are designed to work concurrently with their existing counterparts to allow for them to be phased in.
      
      Main Game Play Effects (for NPCs using the new AIs):
      NPCs do not require contact with the player to act.
      NPCs will actively manage all standard resources, including their health.
      NPCs can both activate and deactivate sustained talents as appropriate.
      NPCs will move away from harmful (damaging, suffocating) terrain, and will do a better job at maintaining appropriate distance from the player while in combat (new tactical AI).
      If using a talent fails, the NPC will immediately attempt to use another (next best for the tactical AI) talent.
      
      GAME LOG DETAIL CONTROL:
      The amount of detail printed in the game log by most engine/ToME ai functions can be controlled by setting the variable:
      
      	config.settings.log_level_ai = X
      
      Where X is a number from 0 (no extra output) to 4 (very verbose output) specifiying how much detail to output to the game log.
      
      NEW/UPDATED AI’s included:
      “dumb_talented” (engine) – updated to add support for t.onAIGetTarget.
      “improved_talented” (engine) - Simplified version of “dumb_talented” using the new talent filter system. Designed as a drop-in replacement for the dumb_talented AI using the new AI functions.
      “improved_talented_simple” (ToME) – designed as an overload for the dumb_talented_simple AI
      “improved_tactical” (ToME) – designed as a drop-in replacement for the tactical AI (details below)
      “maintenance” (ToME) – manages health and resources, triggering other appropriate talents and AIs, (mostly for simple AIs out of combat)
      “move_safe_grid” (ToME) – moves from harmful to safe terrain
      “flee_dmap_keep_los” (ToME) – migrated from ai.tactical.lua, flees from current target while maintaining LOS to it
      “target_simple” (engine) – will only maintain targeting on hostiles
      "target_simple" (ToME) – has an increased chance to clear friendly targets, always clears self
      “tactical” --The existing tactical AI has been partially updated to be compatible with most of the new tactical table functionality, with minimal changes.  (It lacks most of the additional features of the new tactical AI in order to work as before as much as possible.)  Better log file output.
      
      NEW TACTICAL AI:
      This is an almost complete rewrite of the current tactical AI that is compatible with existing NPC specifications and data.
      Interprets existing tactical tables as before, but supports additional information allowed in the new tactical table format.
      The tactical AI weighs all tactical table parameters (not just the best one) when evaluating talents, making it much better at picking the correct talent at the correct time.
      Full support for both positive and negative tactical values – this allows the AI to intelligently turn on and off sustained talents, including those with sustain_slots or that drain resources.  (For example, an NPC can switch between hymns or vile poison enhancements as the tactical situation develops.)
      Automatically manages all standard resources, with support for resource-specific wants.
      Does a better job at maintaining an advantageous distance to the target.
      
      (Un-tested) The tactical AI should run significantly faster than before for most NPCs.  The new AI is more efficient when evaluating and performing actions, but does more.
      
      Extensive documentation for the changes, including detailed instructions/tutorial for how to construct tactical tables.
      Defined key parameters for supported TACTICs in mod.class.interface.ActorAI.  This allows new TACTICs to be added easily, including by addons.
      
      EXTENDED TACTICAL TABLE functionality:
      Added detailed documentation on how to construct tactical tables and how they are interpreted by the (new) tactical AI.
      No changes are required to current tactical tables for them to be interpreted by the new AI functions the same way they were interpreted before.  Note, however, that many of the existing tactical tables have significant errors that prevent NPCs from using talents appropriately.  (A number of these have been corrected as part of this development.)
      
      Changes:
      Tactical functions take the actor affected rather than the NPC's ai target as an argument in order to be consistent with the way DamageType and status resistances are interpreted.
      
      There is an additional (lowest) level of table parsing for status immunities to allow both DamageType resistance and status effects to be accounted for.
      
      For example, Apply Poison’s NATURE-based damage is added to the tactical table as:
      
      tactical = { ATTACK = {NATURE = {poison = 2}}}
      
      which takes both the target’s poison immunity and NATURE resistance into account.
      
      A sub-table  SELF = {…} can be specified for tactics that apply only to the talent user.  This helps specify tactics for talents that have different effects on the user and on their target(s).
      
      For example, the updated tactical table for lightning runes is now:
      
      tactical = { ATTACK = { LIGHTNING = 1 }, SELF = {defend = 1} }
      
      reflecting the fact that it provides defense to the user (but not the target).
      
      When applying DamageTypes, source damage bonuses and target affinity are accounted for in addition to resistances and penetration.
      
      Alternate tactical tables (t.tactical_imp) are included for some talents during the transitional period.)
      
      AI talent use changes:
      Completed support (This was only partially supported before.) for the talent field t.onAIGetTarget for all engine AIs and support functions.  ActorAI:getTarget(typ).
      
      Separated ai pre-use talent checks from actor:preUseTalent into new function (ActorAI:aiPreUseTalent) at the engine level.   This is needed to allow sustains to be turned on and off properly (to allow ActorTalents:forceUseTalent to turn off sustains (with buff removal effects, for example), when the AI would otherwise NOT turn them off.
      For ToME, this permits the function talent.on_pre_use_ai to control both activating and deactivating sustained talents.
      
      SUMMARY of FUNCTIONS:
      New Engine Functions:
      ActorTalents:filterTalent(t, filter) - checks a talent against a filter
      ActorAI:aiTalentTargets(t, aitarget, tg, all_targets, ax, ay) - Generate a list of target entities (Actors) a talent MAY affect if used (This provides engine support for the dummy projection performed in the current tactical AI.)
      ActorAI:aiGetAvailableTalents(aitarget, t_filter, t_list) – generates a list of talents available for use
      aiPreUseTalent(t, silent, fake) – (stub) determines if the AI should use a talent (separated from preUseTalent to allow sustains to be correctly turned on and off)
      ActorAI:getTarget(typ) – supports talent.onAIGetTarget, talents automatically self-targeted, and supports the grid_params argument to locate grids if the targeting table requires it.
      ActorAI:getTargetGrid(tg, params) – acquires grids via projection, choosing one to move to based on parameters in the targeting table -making targeting of movement talents for NPCs much simpler.
      
      Updated Engine Functions:
      ActorAI:setTarget will automatically check on_acquire_target and on_targeted functions when a new target is set.
      ActorAI:runAI will return nil, generating a log message, rather than crashing with an undefined ai
      
      New ToME functions:
      ActorAI.aiParseTalent(t) – parses a talent definition, setting some variables for AI use – making talent analysis faster for the AI
      ActorAI.AI_InitializeData() – parses all talent definitions, initializes resource tactics, and logs a summary of all tactics detected in talent definitions
      ActorAI:aiPreUseTalent(t, silent, fake) – Determines if the AI should use the talent.  Checks t.on_pre_use_ai (applies to both activation and deactivation of sustained talents) and caches its results in the self.turn_procs table.
      ActorAI:aiCheckSustainedTalent(t) – determines if a sustained talent should be toggled (Allows simple AIs to turn on and off sustained talents correctly.  This is primarily concerned with resource drains.)
      ActorAI:aiGetResourceTalent(res_def, t_filter,  t_list) – finds a talent to replenish a resource
      ActorAI:aiResourceAction(res_def, t_filter, t_list) – finds an action (talent or AI) to replenish a resource
      ActorAI:aiHealingAction(aitarget, filter, t_list) – finds an action (talent or AI) to heal self
      ActorAI:aiGetGridDamage(gx, gy) – computes expected grid damage and air loss for the actor.  Updated some grid definitions to allow this function to detect the damage.
      ActorAI:aiGridHazard(gx, gy, dam_wt, air_wt) – rates the overall hazard level for grid.  May be overloaded for some Actors to allow for special map navigation.
      ActorAI:aiFindSafeGrid(radius, want, dist_weight, ignore_los, grid_val) – finds the a nearby grid to escape grid damage and suffocation.
      ActorAI:aiCanFleeDmapKeepLos() – moved from tactical ai for general use
      ActorAI:aiTacticEffectValues(targets, effect_type, effect_wt, talent, selffire, friendlyfire) – computes the tactical value of specific tactic weight argument vs a list of actors – for concurrent compatibility with the existing tactical AI
      ActorAI:aiTalentTactics(t, aitarget, targets, tactic, tg, wt_mod) – fully resolves the tactical table for a talent (including finding targets as needed) – used by the new tactical AI to evaluate talents and by some simple AIs to use tactical tables when choosing talents
      Combat:combatGetAffinity(type) – returns damage affinity
      Talents.aiLowerTacticals(tactical) – function to convert TACTIC labels to lower case in tactical tables
      
      Updated ToME Functions:
      NPC:act() – NPCs will perform resting activity if they take no other action during a turn
      NPC:getTarget(typ) – simplified to reflect the changes to ActorAI:getTarget
      NPC:seen_by(who) – NPCs will not pass friendly targets to each other unless ai_state._pass_friendly_target is set
      NPC:aiCanPass(x, y) – removed (uses engine version), shove pressure folded into ActorAI:moveDirection
      
      MISC RELATED CHANGES:
      The level of log file detail output by various AI functions can be specified by setting config.settings.log_detail_ai to a value from 0 (minimal output) to 4 (very verbose output).
      
      Engine:
      ActorAI:aiSeeTargetPos(target) – added extra checks to the estimated location to exclude it if another actor is seen there and that the target can actually move there – this significantly reduces the chance to target friends or self
      ActorLife:takeHit(value, src, death_note) – death message is not displayed if src is undefined
      utils: table.to_strings = function(src, fmt) – converts a table to table of formatted strings, very useful for various debugging outputs
      utils: table.equivalence(t1, t2, recurse) – checks if two tables are equivalent, i.e. they are identical or contain the same values assigned to the same keys, can recursively track all of the keys to the first difference found
      
      ToME:
      ActorAI:moveDirection(x, y, force) – moved from NPC.lua, incorporates shove algorithm code, fixing a bug that causes shove pressure to almost always fail
      Actor:preUseTalent(ab, silent, fake) – updates any missed AI parsing of talents as needed when tested
      Resource definitions updated with new AI parameters (equilibrium, paradox, psi, air)
      Actor:regenLife(fake) --- returns the life, psi regenerated, updated to take a fake parameter to calculate the amount of life and psi that will be regenerated without applying the values.  Eliminated the resting hack for Solipsism: life regeneration is only reduced by the amount of psi regeneration that can be used, none is diverted once psi is replenished.
      Updated Actor status immunity functions:
      Actor:canBe(what, eid) -- Rewritten to reference a table of status type labels that makes defining new status types (addons) much simpler.  Can take an argument for the effect id being applied, which forces checking of general status immunities (negative_status_immune is always checked), and can be used to force checking of status types contained in the effect subtype table. (i. e. self:canBe(nil, “EFF_DAZED”) will check stun_immune.)
      Now returns the random result, percent chance to be affected.  AIs have been updated to use the chance rather than an individual result, so that tactical weights are consistent across multiple calls.
      Actor.newStatusType(what, method) – used to define a new status type. e.g. Actor.newStatusType(“annoy”, true) causes self:canBe(“annoy”) to check the self.annoy_immune field.
      Actor:canSeeNoCache(actor, def, def_pct) – updated to always return the correct chance to see the target (regardless of success).
      Actor:getTalentSpeed(t) – looks for a t.getEnergy function that returns the amount of game energy needed to use the talent (on the basis of 1 = 100% of normal, stacks with talent type speed).
      Combat:combatGetResist(type) -- results are properly bounded between -100% and + 100%.
      resolvers.talented_ai_tactic updated to better balance ai_tactic for more tactical flexibility.  Fixed an upvalue(!) bug that could cause failure when placing randbosses generated from an earlier save file.
      
      Some ToME TALENT CHANGES:
      Note many talent defintions have incorrect tactical tables.  A number of the most complex (for the AI) talents have been updates with new tactical information so that NPCs can use them.
      
      Talents can have .ai_level field to specify the (raw) talent level to use for AI purposes (For prodigies and other 1 point talents).
      
      Summoning Talents – Defined new functions in talents.lua (available to all talent definitions) supporting significant tactical changes which allow NPCs to better pick appropriate summoning talents and place summons.
      Poisons – use the updated AI changes to allow NPCs to switch between poison effects in combat.
      Psionic Projection talents – tactical tables for discharging the talent now take into account the loss of the aura effect
      Meditation – enabled for NPCs who will actively toggle this talent to manage their equilibrium.
      Spacetime Tuning – NPCs can learn the talent, but only benefit from the passive effects.
      Suncloak – enabled for NPCs (requires LOS to target)
      True Grit – enabled for NPCs (since they can now manage their resources)
      Nature Touch – NPCs will search for a target (favoring self) that needs healing
      
      Some ToDo Items:
      Update the way the Actor.ai_tactics table is used to allow for sustains/status effects to modify tactical priorities in the tactical AI.  So wild speed could reduce but not eliminate talent use, Unstoppable would prevent running away while active, etc...
      Finish enabling summoning talents for NPCs : Detonate, Rage, Phase Summon
      Wards: NPCs must match wards to target attack types
      Add a method in data.damage_types.lua to translate compound DamageTypes into the base types (that have resistances)
      bdc16947
  23. Jun 18, 2017
  24. Jun 09, 2017
  25. May 29, 2017
    • Hachem_Muche's avatar
      Streamlined base_list handling in game.zone:makeEntity (and... · 466573d3
      Hachem_Muche authored
      Streamlined base_list handling in game.zone:makeEntity (and resolvers.resolveObject) to prevent excessive reloading and processing entity lists.
      Priority is type (if a base_list) then filter.base_list
      
      Actor:addedToLevel: escorts will get an appropriate faction (hard_faction, game.zone.special_level_faction, summoner.faction)
      
      game.state:applyRandomClass: converted equipment resolvers will allow power_source.nature (for Psyshots)
      
      The I.D. sets special_level_faction = "enemies" for NPCs created after level generation
      
      dialogs/debug/DebugMain.lua: fixed a bug that could cause no exp to be awarded when killing NPCs
      466573d3
  26. May 25, 2017
  27. May 23, 2017
  28. May 22, 2017
    • Hachem_Muche's avatar
      ActorInventory:initBody: inventory short_name is copied from the inventory definition · 7645124f
      Hachem_Muche authored
      New function: Object:wornLocations(use_actor, weight_fn, filter_field, no_type_check)
      	Replaces Actor:getFilteredInventories
      	Returns a table if locations (inventory and slot) where an object can be worn, filtered and sorted
      	The locations are sorted ("best" first), permitting Actors to automatically optimize their equipment.
      	The default weight_fn is a simple formula (based on object "power" from material level and getPowerRank), but can be updated to be more sophisticated.
      	no_type_check can be specified to allow different type replacement equipment for unfiltered inventories
      
      game.state:applyRandomClass:
      	data.update_body can be a list of inventory slots specifying which inventories to define/update when applying a class
      
      game.state:createRandomBoss:
      	Base actor equipment resolvers are updated to "boss" level drops.
      
      resolvers.generateObject renamed resolvers.resolveObject:
      	new filter fields supported:
      	replace_unique: specifies a filter to replace a unique that could not be created (similar to randart_replace, but the replacement object is equipped rather than the existing unique)
      	check_antimagic: force an antimagic check even if the object will not be worn
      
      resolvers.auto_equip_filters(t, readonly):
      	set readonly to specify an inventory filter that cannot be overwritten (to ensure specific equipment is not removed, i.e. Elandar will not replace the Staff of Absorption if he gets extra classes from higher game difficulties)
      
      Object resolvers add the field _resolver_type to the objects they create.
      
      dialogs.debug.RandomObject:
      	fixed a bug causing resolvers.equip to preview ineligible equipment (antimagic check)
      
      dialogs.debug.SummonCreature:
      	fixed a bug causing summoned actors to try to wear equipment before being fully resolved
      
      Added/updated auto_equip_filters for a number of NPCs
      7645124f
  29. May 16, 2017
    • Hachem_Muche's avatar
      engine.Zone:checkFilter: Added documentation, can set filter.allow_uniques to... · 2e731c01
      Hachem_Muche authored
      engine.Zone:checkFilter: Added documentation, can set filter.allow_uniques to allow unique items to pass the filter, special function takes the filter as its 2nd argument
      
      engine.Zone:filterToString: updated -- handles subtables, functions, and other complex values
      
      engine.Zone:makeEntity: the type parameter can be a list of entities
      
      engine.Zone:makeEntityByName: Added documentation, type can be a string descriptor used to load a base list (follows makeEntity filter.base_list)
      
      engine.Entity:resolve: Added documentation
      
      engine.Birther: Bugfix: the order of resolvers is preserved when applying birth descriptors (causes resolver.attachtinker to fail with no equipment to attach to)
      2e731c01
    • Hachem_Muche's avatar
      engine.interface.ActorInventory:initBody may be reapplied to an actor without... · ea5ab16c
      Hachem_Muche authored
      engine.interface.ActorInventory:initBody may be reapplied to an actor without overwriting existing inventories (merges properties)
      ea5ab16c
    • Hachem_Muche's avatar
      New utility functions (useful for debugging): · 237d606b
      Hachem_Muche authored
      string.fromFunction(fct, fmt) returns a string abbreviation for a function, including filepath, line numbers
      
      string.fromValue(v, recurse, offset, prefix, suffix) -- enhancement of tostring function with more thorough handling of tables and functions
      
      string.fromTable(src, recurse, offset, prefix, suffix, key_recurse): returns a single-line string representation of a table, including string representations of subtables and functions.  The recursion level for both keys and values can be set.  The converted string is lua source code compatible, depending on arguments.
      237d606b
  30. Apr 22, 2017
  31. Apr 20, 2017
  32. Apr 17, 2017
    • Hachem_Muche's avatar
      Updated Textbox.lua and DebugConsole.lua to handle ctrl-BACKSPACE (delete to... · 2462a662
      Hachem_Muche authored
      Updated Textbox.lua and DebugConsole.lua to handle ctrl-BACKSPACE (delete to beginning of line) and ctrl-DELETE (delete to end of line) keybindings.
      
      Updated the RandomActor and RandomObject dialogs.
      
      The RandomActor.lua:
      
      autofocuses on the random actor placement button when opened.
      
      Placed actors are full clones for the currently generated actor, with special handling for escorts.
      2462a662
  33. Apr 15, 2017
    • Hachem_Muche's avatar
      engine.zone:addEntity will not apply actor_adjust_level more than once · f110d8b3
      Hachem_Muche authored
      Updated resolvers.talented_ai_tactic to work correctly after multiple calls (solves an upvalue issue)
      
      Added a new Dialog: RandomActor accessible from the SummonCreature dialog (" Random Actor"):
      Randomly generates actors based on an input filter or Randombosses based on generation data and the current random actor (if available).
      
      Added a new Dialog: RandomObject accessible from the CreateItem dialog (" Random Object"):
      Randomly generates objects based on an input filter, randomly generates base objects ready for conversion to Randarts, and creates Randarts based on the base object (if available or random) plus generation data.
      
      The new dialogs include context sensitive help and allow generated actors and objects to be previewed via tooltip, character sheet, and lua inspect.  Keybinds ctrl-c and ctrl-v allow Filters and Data (text) to be copied and pasted to/from the appropriate dialog inputs, facilitating development and testing of source code.
      
      Entity generation uses the current zone's npc and object lists and runs in the Lua Console environment.
      
      The destination of objects in the debugging dialogs can be selected:  either Player Inventory (default), Drop at player position, or NPC inventory for a target actor.
      
      The debug dialogs are not cancelled when placing creatures or objects, allowing multiple entities to be created without reopening them.
      f110d8b3
  34. Apr 14, 2017
  35. Apr 12, 2017
Loading