Hello, I am developing an enemy AI system for my RPG game, Aetherbound. I’ve done research online and have not come to a conclusion yet on how to handle behaviors, and how I should structure the system as well as handle the creation of new enemies and initialization. Should I handle everything from a central “brain”? Should I use a state machine? Should I create templates for each enemy type I want (humanoids,monsters, bosses)
, and use functions to set actions and settings? I’ve thought of an OOP approach where I can create a custom “enemy” type to store settings data as well, but there’s so many options and so many points to jump off of, it’s a bit overwhelming. I would like to hear any experiences or advice anyone may have regarding their own implementation, I would love to hear it! This is one of the more complicated things I’ve made for Aetherbound, and the lack of good PvE is really holding me back right now in terms of creative flow. Any help is much appreciated.
#Developing an efficient, modular enemy AI system.. not sure where to start.
1 messages · Page 1 of 1 (latest)
Roblox pathfinding is shit
make a simple AI that makes decisions based on one or more numeric values (and make it observe its opponent or something, and modify the value based on its success or lack thereof)
do shit with that, make it complex or something, ikd
alternatively just make it less dynamic and hard code absolutely everything
oop is still a simple, scalable, and referential paradigm that is highly useful
utilize actors (parallel threads)
would suggest making an entity class and building NPCs/bosses/etc. off of it, including whatever you need for special attacks and shit
objects are inherently states so do with that what you will
I would just make a single entity class with highly composable behavior
It would also help if you can share it with the player
And then make an additional entity AI class that controls the entity object
Store all your entities in one place and then have multiple different systems that interact with them
You’re going to need 1 system to update them each frame, another to replicate any changes, etc
For behavior, I’d recommend state machines or behavior trees
If you have a large number of entities, you shouldn’t have any models on the server (replication cost too expensive), instead just hold some position data on server, and then replicate to client X amount of times per second
Back to enemy templates, each type of entity should contain data in its own config file
And have identifiers to different components, etc
This approach lets you share components between entities (behavior components, combat state components etc)
While minimizing the boilerplate of making a class for each different entity
Thank you both for your assistance. I think I will begin with planning and preparing the code for the entity objects and along with that, the template for my test enemy.
Should I hold my templates in a single module? Also, should I create the templates in the form of a newly made entity object that I can reference later from the module in other code, or just a table of values that I can read from and copy over? I think i could have a function for creating a new entity from a pre existing template (it would just clone the data and then initialize the enemy ingame) or from an inputted table to manually enter the data (could use for like randomized character appearances for generic bandits n shit)
each in their own module only if you have a large number of templates
the templates should just be data only
I would actually have no references to functions or classes inside the template, all you need is an identifier for them
** You are now Level 4! **
all the templates should be loaded into a database where you can quickly retrieve them and use it to construct an entity object