Git Product home page Git Product logo

Comments (3)

davebaol avatar davebaol commented on May 20, 2024

TBH I don't think it's a good idea to make changes to avoid this kind of programming errors.
It would be like changing the while loop in Java by adding a timeout to remedy any condition always true.
Closing this for now. Feel free to reopen if I missed something.

from gdx-ai.

MeFisto94 avatar MeFisto94 commented on May 20, 2024

Well, yes and no.
My proposal wouldn't only apply to endless loops but anything that takes reasonably long.
I would think like having tick() only execute one leaf task (not guard) ever per tick.

I haven't thought this reasonably through but there don't have to be hard programming errors, but things that "take a while", think:

untilSuccess
   sequence
      TryUnlockDoor
      BlahBlah

I can imagine two things here:

  1. Unlocking the Door takes a few tries or it is blocking (Status.RUNNING) for 5 seconds until the door is open.

Call this one mis-design, but when executing from the update loop, the whole game is frozen and thus the animation doesn't show a door opening. But there it gets worse:
2. When TryUnlockDoor requires update() to do something, say it starts a process and then update() is doing something every frame to open the door, until TryUnlockDoor succeeds.

Do you have another idea on how to completely bypass all these problems? Because I want my users to be able to add in behavior trees as well as I wouldn't know how to properly avoid these issues. Especially it seems like this kind of behavior depends on the "iterator" or decorator, because I am certain I already have some tasks which "block" for a few frames.

from gdx-ai.

davebaol avatar davebaol commented on May 20, 2024

Non sure what's your exact use case.
But it's very likely that one of the several BT constructs supported by gdx-ai might cover it.
For instanse, have you considered using parallel?
With its policies and orchestrators is likely the most powerful and versatile construct.

from gdx-ai.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.