Hey all. This is my first post on the Amethyst Forums, so let me know if I need to read the guidelines or re-categorize the post or something.
I’m curious what design patterns people are aware of for creating Non Player Characters (NPC) which have unique behavior sets. e.g, a combat game may have some NPC which are aggressive and others which are timid.
I think I want my system to iterate over all NPC and call methods like
npc.make_decision(some_information_about_the_world) and based on the different behavior defined for that NPC (entity?) that NPC makes different decisions.
This question was initially fueled by a card game I’m implementing with Specs. My pen-and-paper design to creating NPC with different behaviors is something like this:
let mut world = World::new(); world.register::<NPC>; world.register::<Strategy::Defensive>; world.register::<Strategy::Aggressive>; world.create_entity().with(NPC).with(Strategy::Defensive).build(); world.create_entity().with(NPC).with(Personality::Aggressive).build();
But that’s about as far as I get. What should the
System that interacts with these entities look like? What should the
Strategy::* components look like? Is this design pattern completely off course? I’m very new to game dev and ECS so I might be over-looking something completely obvious to a more seasoned designer.
I plan on going down this rabbit hole and seeing where it takes me. If I find a way to make it work I’ll update the thread, but I’m also ready for my design to change drastically based on what y’all say! Reading material, examples, and lectures about ECS design patterns welcome!