Replies: 3 comments
-
Having the option for NPCs to react to their health/mana pool and stats (increased/decreased), what Map they are on, and maybe how far from their spawn point would give a ton of options - if its not part of the idea already. |
Beta Was this translation helpful? Give feedback.
-
Just going to dump my approach here. I was going to pay for this system, but happy to chip in to bring it to the base engine NPC’s now suck, they just rush you and facetank every attack, even if they have ranged attacks available. They also randomly select spells, which is not always ideal. The idea is to create behaviours through a spell sequence editor with some added movement behaviour. There will be a new editor where you can create spell sequences with some extra conditional branches such as NPC HP and status effect. In the NPC editor you pick the spell sequence instead of the current spell window. It’s possible to add multiple sequences to an NPC. You can also select if the NPC goes down the list of spell sequences or if they pick a random sequence. Sequence Editor: In the sequence editor you have a list of sequences and if you double click on them you are able to edit the sequence. Condition: Set a condition for the sequence to be available: Cooldown: Cooldown before the sequence can start again -> Let’s say you make a sequence: Cast Self Heal when HP is <50%. You can add a lengthy cooldown so the NPC won’t be able to heal himself every time he goes below 50% HP. If the condition is met and the cooldown is over, the sequence will start: Conditional branches on cast success -> It’s possible that spells are on a cooldown or NPC does not meet requirements to cast the spell NPC Editor: Instead of the spell window, you add sequences. It’s possible to add multiple sequences. Triggers in order of priority: NPC Status Movement options: Speed of movement: Type of movement: Sequence: 2 options: NPC editor: Trigger -> Will only start this behaviour when the trigger is met. HP is between X% / above X% / below X% -> Priority is for lower HP%. So a behaviour with a 10%HP trigger will take priority over a behaviour with 20%HP trigger Movement -> Pick the movement that fits with this behaviour. Choose the speed and type of movement as well Spells -> Pick the spells that can be casted in this behaviour. Choose if the spells are cast randomly or in order as well One time only? -> Click this option when you want an NPC to only use this behaviour once. For example, a self healing spell that will only trigger once. A check to see if the behaviour has been used since the last time HP was 100% is ideal. |
Beta Was this translation helpful? Give feedback.
-
Love the idea of a sequence editor as put forward by @da-rulez! You could program boss fights that does movement and different spells/attacks/whatever as the fight progresses. I get feelings of games like Hyper Light Drifter, Crawl, and other roguelikes and dungeon crawlers. Then being able to have template behaviors we can make/share would go a long way too. |
Beta Was this translation helpful? Give feedback.
-
I personally think that in the future, specially with the upcoming editor port, we should have an NPC behaviour editor:
From which the user should be allowed to create their own templates with different ways to make an NPC react/attack/suicide/move/send chat bubbling messages whenever they do certain actions/spells under specific conditions and timings/etc.
Currently, despite the fact that we can add certain conditions to allow or disallow NPCs to attack, we basically have a single loop where they all behave statically the same, having some conditions to basically chase and attack isn't very attractive, specially when every NPC struggles to walk more than a single tile by their own under normal circumstances.
Having the ability to create templates with behaviors which can then, be linked over to different NPCs, will surely increase the range of possibilities and dynamism around any intersect based game world. We could re-use some templates for certain generic NPCs (i.e a wolf, a dire wolf, a black wolf, they all behave similar, just with different stats and sprites) and create unique ones for unique NPCs too (ie: a boss with unique ways to behave, move, talk, react, attack, etc).
Something like this would require a big rewrite on how NPCs work, in a way that the templates with the scripted behaviors should be stored and loaded somewhere in the gamedb.
12-03-23 (Update / brainstorm)
To make the NPC logic more modular, we can store the NPC behavior in separate JSON files. This way, we can modify the NPC behavior without needing to recompile the code. We can create a class that loads the NPC behavior from JSON files and creates Npc objects using the specified behavior.
A new class called
NpcBehaviorLoader
will contain a method calledLoadBehaviorFromFile
which takes a file path to a JSON file that describes the NPC behavior. The JSON file will contain information such as the NPC's spells, drops, and movement patterns. Here is an example of what the JSON could look like:(this idea is not user friendly unless we create an editor for these)
Reusable components:
To make the NPC logic more modular, we have to break down the NPC behavior into smaller, reusable components that can be combined in various ways to create different NPC types. One way to do this is by using the decorator pattern, where each behavior is encapsulated in a separate class that can be stacked on top of each other to create a final behavior. Example: we can create a set of classes for different types of movements, such as random movement, follow player movement, and patrol movement. Each movement type can be implemented as a separate class that implements a common movement interface. Similarly, we can create classes for different types of attacks, such as ranged attack, melee attack, and area-of-effect attack. Each attack type can be implemented as a separate class that implements a common attack interface. We can also create classes for different types of behaviors, such as aggressive behavior, defensive behavior, and passive behavior. Each behavior type can be implemented as a separate class that combines different movements and attacks to create a specific behavior.
16 votes ·
Beta Was this translation helpful? Give feedback.
All reactions