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

feature: GOAI Urist port v2 #1414

Open
wants to merge 31 commits into
base: baymerge-testing
Choose a base branch
from
Open

feature: GOAI Urist port v2 #1414

wants to merge 31 commits into from

Conversation

scrdest
Copy link
Contributor

@scrdest scrdest commented Mar 13, 2024

Yep. This again. And a cool 10k+ SLOCs to go through!

Featuring an entirely re-done architecture - the heart of the AI is now a Utility AI, blatantly lifting the core design from Infinite Axis Utility System by Dave Mark & Co., with improved and optimized GOAP Planner AI as an optional sidecar for dealing with complex environmental problem-solving (e.g. GODDAMN DOORS REEE).

Fast and smart

A major consequence of that is that this iteration of GOAI is at least as smart as the previous (with a strong argument that it's much more so), but also very, very fast. And that's before AI LODs or any other future optimizations.

Data-driven

The redesign also showcases my progressing conversion to the church of Data-Driven Design. As a result, the AI system is really two things: an AI Engine in DM code (because I am a masochist) and an AI Specification Language in the form of a bunch of JSON schemas.

The AI Engine provides a pile of abstractions and building blocks (curves, Considerations, ContextFetchers...) that can be used in the JSONs to build actual AIs and SmartObjects.

Thanks to that, the AI Specs can be edited without an in-depth knowledge of DM's weird quirks. You don't have to be a full-on coder to make GOAI AIs.

They can also be hot-swapped at runtime without recompiling the whole game as long as you're not extending the AI Engine itself. Should make iteration speed muuuuuuuch faster.

Modular and extentable

Unlike Certain Other SS13 AI Implementations, GOAI provides only a cheap, bare minimum shared framework for any gameobject that opts into having GOAI enabled at all.

Everything else - all behaviors and checks - only runs if an AI Agent uses them for something and they run in whatever sequences they are acquired. The only hardcoded state-machines are either the AI Brain's core decision/execution loop or the scripts powering the actions (if you choose to write them that way). The AI will transition fluidly between combat, idling, chores, and everything in between based on whatever's the next logical priority.

Actions can be added or removed on the fly - in fact, they already are.

To avoid duplicating logic across 20 different mob types, GOAI now includes Sims-style SmartObjects, which are AI Specs attached to gameobjects. Agents can harvest new abilities from those objects - for example, a held gun may provide a Shoot Action, and a nearby Door may provide an OpenDoor Action.

Even the GOAP integration is more flexible than traditional implementations - GOAI plan execution is smart enough to handle third-party interference cancelling out the effects of actions earlier in the plan or short-circuiting the requirements to make the ultimate goal available.

jmalek added 13 commits March 14, 2024 00:41
… now be GOAI-enabled

(the AI similar to human/testmob, but with Shoot being intrinsic rather than sourced from a Gun SO)
…ide for SS13 AI, door and table actions for SS13, tons of log cleanup.

Direct port of:
SHA-1: 1a7bffad75bb4be52633ad4101a89bf10e1c0943
from GOAI repo
…c using it, allowed groupby-like mean aggregations, fixed raytrace ignores and other stuff.

Sync to GOAI commit:
SHA-1: 22948c7db2ed5cf98e7ae966f1bae11608c080ac
…sonality (from a dict object) for simplicity.

feature: Templated Personality generation, faked melee for dev purposes, added style affinities to appropriate attacks.

Port of the following GOAI commits (respectively):
SHA-1: e609609c07d9f85011326dc167a697b5c28d6047
SHA-1: a4dbe5178d6fd88085cd71aa48cfd6f3ab68e7a9
…more organic and causes less CPU load spikes. Melee hit-by events. Steadfast personality trait (less Composure loss per hit); basic loss raised to compensate. Fixed Consideration values. Filtering dense turfs in bbox (optionally). Reverse raytraces for enemy-safety checks.

fix: Updating/fixing SS13 AIspecs. Ranged SAs can now use their guns correctly!

sync to GOAI SHA-1: 8057d06ec0397e9367d01c9854f3db31b62471cc
…xed cover data gen, moved out-in-the-open checks to Vision, tuned cover/fight better, added gentler fuzz Considerations
…es all handled. Weird paths may pop up on occasion. Ignoring dead mobs. Split neutrality threshold into enemy/friend thresholds. Wrapper to call an arbitrary method. Macro-ized smartobject declarations for less boilerplate. Gated off some more dev objects behind Dev-only defines.
Mostly shouldn't affect SS13 code, but nice to keep 'em synced.
maps/using.dm Outdated Show resolved Hide resolved
@scrdest scrdest marked this pull request as ready for review April 7, 2024 15:17
jmalek added 2 commits April 7, 2024 16:27
…ix indents. Actually 'fixes' the problem.

(this is a dumb context-free AWK check seemingly designed for indents on typepaths; nobody seems to have thought anyone will need to pass in a typepath IN CODE)
return user.Move(T)
var/result = user.Move(T)
to_world_log("[user] has climbed [target_ladder] to [T] (Result: [result])")
return result
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, dev changes, will revert

@@ -206,10 +206,15 @@
return TRUE

/obj/structure/ladder/proc/climbLadder(mob/user, target_ladder, obj/item/I = null)
to_world_log("[user] is climbing [target_ladder]")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, dev changes, will revert

genmap.json Outdated
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should not have been committed, will nuke

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Stale diagram, will remove

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Stale diagram, will remove

Copy link
Contributor Author

Choose a reason for hiding this comment

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

DEVJUNK: Feel free to ignore this. This is a port of SS13 code to the Dev repo. It's only here to make syncing between repos easier (can do copy/paste without unpicking individual files).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

DEVJUNK: Feel free to ignore this. This is a port of SS13 code to the Dev repo. It's only here to make syncing between repos easier (can do copy/paste without unpicking individual files).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

DEVJUNK: Feel free to ignore this. This is a port of SS13 code to the Dev repo. It's only here to make syncing between repos easier (can do copy/paste without unpicking individual files).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

DEVJUNK: Feel free to ignore this. This is a port of SS13 code to the Dev repo. It's only here to make syncing between repos easier (can do copy/paste without unpicking individual files).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

DEVJUNK: Feel free to ignore this. This is a port of SS13 code to the Dev repo. It's only here to make syncing between repos easier (can do copy/paste without unpicking individual files).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

DEVJUNK: Feel free to ignore this. This is a port of SS13 code to the Dev repo. It's only here to make syncing between repos easier (can do copy/paste without unpicking individual files).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

DEVJUNK: Feel free to ignore this. This is a port of SS13 code to the Dev repo. It's only here to make syncing between repos easier (can do copy/paste without unpicking individual files).

@CPU-Blanc CPU-Blanc added Enhancement Feature Playtest Required This PR needs playtesting before merging Stale-b-gone labels Apr 7, 2024
jmalek added 3 commits April 7, 2024 19:12
…pile-flag-conditional locations.

Updating is now a fully 'drag-n-drop GOAI to GOAI dir' flow.
@github-actions github-actions bot added the Repo label Apr 7, 2024
Comment on lines +38 to +39
exactly 1 "world<< uses" 'world<<|world[[:space:]]<<'
exactly 1 "world.log<< uses" 'world.log<<|world.log[[:space:]]<<'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These both had to be bumped to account for a dev-only copy of the macros file.

Comment on lines +40 to +41
exactly 14 "<< uses" '(?<!<)<<(?!<)' -P
exactly 3 ">> uses" '(?<!>)>>(?!>)' -P
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Similar story here: all of the extra uses are just a copy of the macros for use in the library version. Theoretically these could just be yeeted, but that would slow development down quite a bunch.

exactly 0 "incorrect indentations" '^( {4,})' -P
exactly 26 "text2path uses" 'text2path'
exactly 37 "text2path uses" 'text2path'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indispensable, because it's used by the SerDe to lookup procs from the references embedded in the file data, and there's no real alternative to text2path available (at least as of BYOND 514).

exactly 3 "update_icon() override" '/update_icon\((.*)\)' -P
exactly 5 "goto use" 'goto '
exactly 1 "NOOP match" 'NOOP'
exactly 444 "spawn uses" '^\s*spawn\s*\(\s*(-\s*)?\d*\s*\)' -P
exactly 461 "spawn uses" '^\s*spawn\s*\(\s*(-\s*)?\d*\s*\)' -P
Copy link
Contributor Author

Choose a reason for hiding this comment

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

All of these are internal 'ticker-esque' code which cannot use any of the weird Bay timers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can remove this. Might have been added by accident.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, definitely should remove this; snuck in from a previous branch lol

@CPU-Blanc CPU-Blanc mentioned this pull request Apr 8, 2024
12 tasks
jmalek added 4 commits April 13, 2024 17:19
feature: Added macro's Chebyshev distance (since get_dist is weird and procs are slow).
feature: Added a new SO macro - grants Action if object is in direct inventory contents (no recursion).
feature: Macro-gated drawing beams
docs: Added a Utility AI Readme
tweak: Reenabled path-following mode
tweak: Added source logging to Utility brain
fix: Fixed bad SO paths for Dev repo
fix: Corrected proc used for movement
chore: Fixed some lints/dupes
chore: Big ole cleanup of debug verbs. Gated all I could find behind proc-granting procs/verbs or removed.
The concept of a Pawn is now generic; a mob AI drives a mob/atom Pawn, a faction AI drives a faction datum Pawn, a director AI would drive an Event Pawn or sth.
Reorganized Actions - split into subdirs where the Action only makes sense for a subtype.
Fixed a ton of nullchecks to be typechecks instead.

feature: Simplified the AI ecosystem.

- Rolled CombatMob AI into normal mob AI.
- Moved generic logic into the base class
- Removed Abstract AI as a separate entity - the main determinant of a subtype will be the driven Pawn type (e.g. Event data for Director AIs, Faction for Faction AIs, Mobs for Mob AIs)

Sync to SHA-1: 40c196d23bf03d071dc4e8190de6f74777f1deb8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants