0 Favourites

How do I Make semi smart AI

  • So im making a management game, and i want to have People go to the toilet to cover their toilet needs and to vending machines to cover their food needs, and when they dont need food or toilet needs to just sit in their cubicles and work.

    The problems comes in where i have multiple people walking to the same toilet/food dispenser, and cubicle too, but ONLY if they need to go to the place AT the same time, the problem is probably that i have a variable for Used/Not Used, and when a path is found it gets set to Used, so nobody else can go to it, but again when they both have to go there at the same time it doesn't matter, any workarounds, other ways to do it?

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • If you have conflicts, try implementing a scheduling system for your People objects so that only one gets a path each tick. This method along with your flag/state system should eliminate all conflicts.

    You can use a counter, and IID. For your action event -

    System pick Nth instance - PersonObject, InstanceCounter

    After your actions are run for that instance, Add 1 to instance counter. If instance counter = PersonObect.count, set InstanceCouter to 0. One action way to do this is Set InstanceCounter to InstanceCounter=PersonObject.Count?0:InstanceCounter+1

  • If you have conflicts, try implementing a scheduling system for your People objects so that only one gets a path each tick. This method along with your flag/state system should eliminate all conflicts.

    You can use a counter, and IID. For your action event -

    System pick Nth instance - PersonObject, InstanceCounter

    After your actions are run for that instance, Add 1 to instance counter. If instance counter = PersonObect.count, set InstanceCouter to 0. One action way to do this is Set InstanceCounter to InstanceCounter=PersonObject.Count?0:InstanceCounter+1

    Seems advanced but ill try to mess around with it.

    Thank you for the advice!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)