ThePat02 / BehaviourToolkit

A collection of tools for AI Behaviour in the Godot 4 Game Engine!
MIT License
303 stars 12 forks source link

`FiniteStateMachine` only processes one event per frame. #84

Open nickswebsite opened 2 months ago

nickswebsite commented 2 months ago

FiniteStateMachine only processes one event per frame.

I'm not sure if this is a bug or if it is intentional, but it was certainly a surprise to me. I was expecting the event stream to complete its processing within a given _process_*() callback. Ultimately this assumption led to some really wonky behaviour and/or delayed transitions as the queue backed up.

I can hack in a solution locally, but if this is intentional I'd rather not build on a hacked solution that breaks fundamental assumptions of the library.

I'm not sure what the intent is here. Could I get some clarity?

ThePat02 commented 2 months ago

Currently it only parses one event per tick.

    # Check if there are events
    if current_events.size() > 0:
        # Get the first event
        event = current_events[0]
        # Remove the event from the list
        current_events.remove_at(0)

This is by design. However it is a valid discussion if it should support handling more than that.