#How do games like Medieval Dynasty or even GTA simulate NPC behaviour?

6 messages · Page 1 of 1 (latest)

wind ermine
#

I recently started wondering how games could accomplish this.I'm really interested in making a system for it but don't know if i have the right idea for it.

Any suggestions or advice?

hallow steeple
#

Depending on the game engine, there are different ways of approaching this. If you are interested in Unreal Engine 5, it has mass AI simulated crowds (but these are mostly for background NPCs and its not super complex behavior). Machine learning is an option but this option is a little more time consuming. There is also the standard behavioral trees programming. I also think there might be plugins for game engines to speed up this process. There are many ways to approach simulating NPC behavior and I hope these options provide a good starting point.

wind ermine
# hallow steeple Depending on the game engine, there are different ways of approaching this. If y...

I'm using Unity. I do have a system running although with a few problems im still trying to fix. Its a long piece of code so long story short What I've basically done is create and use a few different structs,classes and enums to hold data about each NPC and then use each NPCs data to decide which action it is going to perform.I also added more complexity like weight of a decision that changes depending on the area the NPC lives in(For Example:NPC living on Moon has different weight on decisions than NPC living on Jupiter) and the NPCs can interact with each other and affect each other. The decisions that NPC take are in a sort of tree like structure so I think I got that right but is the rest of my approach fine or am I missing something or did I just overcomplicate things?

wind ermine
#

I fixed the problems.

#

Still if there is anything wrong in my approach or if there is a simpler way please do tell

hallow steeple
#

Keeping as much data as possible in an enum or an array sounds like good coding practice. I think that as long as the NPCs behave in the way that would best suite your game and interact as expected then I think it would ultimately be a success. I'm sorry. I don't have a ton of experience working with dynamic NPC behavior, so I can't really give much more advice on how to improve it. I wish you good luck on your coding journey.