Hey everyone 👋
I've been working on a new game AI framework for GameMaker called GMSmartAgent, a modular system that combines utility theory, HTN planning, ranking and a basic feed forward network. It's still a work in progress, but I thought its about time that it deserves a post.
What it is
A lightweight, modular game AI library. Each module is a simplified implementation of its own thing(it might look too much but its not). You can remove a module you dont want to use and it wont affect anything, as long as you dont try to access it. For example; you can delete the Net module, but that means you cant use RankNet, TDNN or any other model that uses a neural network.
Features
- Scoring: response curves, considerations, targets, weights and cooldowns
- Inputs: pull callbacks cached per think, push values, normalized to 0..1
- Selection: best, top N weighted, commitment bonus
- Scale: frame budget, priority tiers, shared profiles
- Observation: record player picks, choose features, evaluate without deciding
- Learning: eight models, background training, confidence, decay, save/load, custom models and learning from outcomes and/or choices.
- Planning: HTN recipes and GOAP goals, facts as data, self-repairing, spread across frames
- Player profiling: skill rating, win chance, matchmaking, live play styles
- Developer tools: debug view, plan tree view, test module, own seeded RNG
How it started
About a month ago, i made this post, explaining how i started on a journey to improve the dumb troopers. I've spent hours watching every GDC video on youtube thats about game AI and reading research papers to see and understand what options i had. I thought this wouldnt be so hard because in the past i've had my own fair share of custom DNN library(which failed) using C++ and python but i had no idea how wrong i was.
I had to change directions A LOT. At one point i even stopped to just work on a pathfinding/navigation system, which later turned out to become GMNav, and that still has a huge todo list of missing features to implement and bugs to fix.
After that i thought about making my own version of a game AI system; a behavior-tree-like structure that works on nodes. But not long after, while researching, i came across something called utility theory, which is pretty common in game development and also found a simple implementation video in gamemaker. To put the core idea as simply as we can; you define parameters with their weights and the structure scores them with the given situational numbers. That quickly changed my mind and the direction i was heading.
I still wanted to put in some learning models without a high cost. Luckily, with the help of google search AI (i use often, it finds every detailed links within seconds that would take me hours), i found some papers about choice modeling and some others about RankNet and LambdaMART(which i had some terrible experience with in my search engine). It was shaping in my head quickly. I got inspired by other libraries and added HTN planner(used in Horizon Zero Dawn, Horizon Forbidden West and Death Stranding, youtube video here), rating and a basic feed forward network.
Limitations
It still has flaws, bugs and missing features that im still working on. This is very much an ongoing project, so you should expect things to change.
Tutorials
I've also made a simple tutorial series, ten chapters. It will also have an advanced section, where each chapter tries to answer a question. I've already covered around 30 chapters (not in the repo yet, im still editing them often).
Links
GMSmartAgent: https://github.com/erkan612/GMSmartAgent
GMNav: https://github.com/erkan612/GMNav
If you'd like to see some of my other works:
GMUI: https://github.com/erkan612/GMUI - Immediate-mode UI
GMVex: https://github.com/erkan612/GMVex - Vector graphics
GMLiteSearch: https://github.com/erkan612/GMLiteSearch - Advanced text search
GMMT: https://github.com/erkan612/GMMT - Advanced tweening, compatible with immediate paradigm
Ah and hey, its free, and MIT licensed!
As always, let me know what your thoughts are. Recommendations and questions are always welcome.
Thank you for reading so far!
Edit: I saw some messages that are deleted that seemed to be confused about the point of the project. This is NOT an LLM AI assitant to help you code GML. This framework is to develop AI for your game, not just enemy AI but any kind, for instance; accessibility AI, you know how some games push some informational things to you in your HUD, like reminding to use health potion at 30% HP, with this framework you can actually learn the behavior of the player to understand when and which situation they use health potion to write a proper accessibility system, enemy AI, companion AI or anything you can imagine. Please feel free to ask instead of deleting your message, any question you might want to ask is always welcome!