Code Monkey home page Code Monkey logo

Comments (7)

beroso avatar beroso commented on August 18, 2024

Another approach is let the user define it. For example:

# btree.gd

export(int, '_physics_process', '_process') var run_on = 0

func _physics_process(delta):
	if run_on == 0:
		tree_process(delta)
	
func _process(delta):
	if run_on == 1:
		tree_process(delta)

from addons-btree.

fian46 avatar fian46 commented on August 18, 2024

Most of the time we use btree as decisions maker. the actual physics stuff is must decouple from ai stuff. Running ai at the same rate as physics is not necessary. If it a must to query from physics the query must perform in physics tick and saved as cached. Also Godot fixed step is not fixed at all. If you have heavy physics simulation the step maybe drop from actual step.

from addons-btree.

beroso avatar beroso commented on August 18, 2024

I was wondering of it because I found a bug in the https://github.com/fian46/demo-btree.
If you walk fast at same direction that you fire, the bullet will collide with the own player.
In this case, your tasks seems to be dependent of physics calculations.
When I tested with btree running on _physics_process () the bug doesn't happen.
But perhaps there is another way to solve this problem.

from addons-btree.

beroso avatar beroso commented on August 18, 2024

What do you think about the idea of letting the user choose? We could make the option run_on = '_process' by default

from addons-btree.

fian46 avatar fian46 commented on August 18, 2024

It is not a bug the implementations is not complete. But sure if you think it is necessary to give user options for choose the best setup.

from addons-btree.

beroso avatar beroso commented on August 18, 2024

Submitted a PR #9

from addons-btree.

fian46 avatar fian46 commented on August 18, 2024

Merged

from addons-btree.

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.