Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No indication of Syntax Error in BehaviourTree #5099

Open
Jacob-Rueckert opened this issue Apr 17, 2023 · 2 comments
Open

No indication of Syntax Error in BehaviourTree #5099

Jacob-Rueckert opened this issue Apr 17, 2023 · 2 comments
Labels
Status: Needs Discussion Requires help discussing a reported issue or provided PR Type: Improvement Request for or addition/enhancement of a feature

Comments

@Jacob-Rueckert
Copy link

Jacob-Rueckert commented Apr 17, 2023

Motivation

I feel confused when there is no syntax error shown but the game crashes because of one.
Twice I had a comma after the last child of a selector which gave a NullPointerException.
But it crashed on two different spots in the engine code the first in org/terasology/engine/logic/behavior/DefaultBehaviorTreeRunner.java:37 and the other in org/terasology/engine/logic/behavior/core/SelectorNode.java:23

Proposal

It would be wounderful if there was a indicator to tell you the syntax error like a red mark in the IDE.

Alternatives

A message in the console or a hard crash on behaviour Tree load would be helpful.

@Jacob-Rueckert Jacob-Rueckert added Status: Needs Discussion Requires help discussing a reported issue or provided PR Type: Improvement Request for or addition/enhancement of a feature labels Apr 17, 2023
@Cervator
Copy link
Member

This is a very good topic that recurs fairly regularly and I too badly want this :-)

It was actually a GSOC idea for a few years - #1402 has more details and related ideas!

@jdrueckert
Copy link
Member

In this case it's not even logged and the behavior tree is actually parsed, so we even would have a point in the code to do some kind of syntax check. As behavior trees are (especially considering the in-game behavior tree editor is broken atm) nothing that would be expected to change except in development, I think we can even create a hard crash here.
In the particular example the child is even created as null by the behavior tree parser, so it deliberately "decides" not to complain about it although there's not reasonable use case for having a null child.

If we introduce a hard crash of course eventually it would be great if a hard crash like that on world start wouldn't actually crash all of Terasology but only abort and clean up (as in roll back) the world start and bring the player back to the main menu. Then they could fix the tree and just try starting new world again, which would highly accelerate the development feedback cycle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Discussion Requires help discussing a reported issue or provided PR Type: Improvement Request for or addition/enhancement of a feature
Projects
Status: 🚀 Next Up (5.4.0)
Development

No branches or pull requests

3 participants