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

feat: better debugging for pathfinding tasks #8

Merged
merged 19 commits into from
Nov 20, 2022

Conversation

kaen
Copy link
Contributor

@kaen kaen commented Jul 6, 2020

Adds some first-class debugging UI stuff. The initial metrics I've exposed are not super useful outside of tuning the JPSConfig parameters, but that is an important task when using the library.

More importantly this serves as a foundation for exposing more useful debugging information as the algorithm and interface becomes more complex.

Here's an example looking at a GooeyQuest path finding thread exhaustion scenario:

Screenshot from 2020-07-05 21-25-09

image

@skaldarnar
Copy link
Contributor

So, I tried to resolve all merge conflicts and updated the imports.

Good news: the game starts, and even running Josharias Survival with this module does not crash immediately. :party:

Bad news: trying to use the metrics recorder unfortunately crashes 😕

I'll leave this stacktrace here for whoever wants to continue. I suspect this is about @In for dependencies not in the context when the classes are initialized, or some mismatch between UI files and source code (looking for UI elements that are not present or registered under a different name).

23:39:29.187 [main] ERROR o.t.engine.core.TerasologyEngine - Uncaught exception, attempting clean game shutdown
java.lang.NullPointerException: null
	at org.terasology.engine.rendering.nui.internal.NUIManagerInternal.bindEvent(NUIManagerInternal.java:778)
	at org.terasology.engine.rendering.nui.internal.NUIManagerInternalMethodAccess.invoke(Unknown Source)
	at org.terasology.engine.entitySystem.event.internal.EventSystemImpl$ByteCodeEventHandlerInfo.invoke(EventSystemImpl.java:399)
	at org.terasology.engine.entitySystem.event.internal.EventSystemImpl.sendConsumableEvent(EventSystemImpl.java:274)
	at org.terasology.engine.entitySystem.event.internal.EventSystemImpl.send(EventSystemImpl.java:253)
	at org.terasology.engine.core.bootstrap.eventSystem.AbstractEventSystemDecorator.send(AbstractEventSystemDecorator.java:67)
	at org.terasology.engine.network.NetworkEventSystemDecorator.send(NetworkEventSystemDecorator.java:54)
	at org.terasology.engine.core.bootstrap.eventSystem.AbstractEventSystemDecorator.send(AbstractEventSystemDecorator.java:67)
	at org.terasology.engine.recording.RecordingEventSystemDecorator.send(RecordingEventSystemDecorator.java:34)
	at org.terasology.engine.entitySystem.entity.internal.BaseEntityRef.send(BaseEntityRef.java:190)
	at org.terasology.flexiblepathfinding.debug.ui.DebugScreen.lambda$initialise$0(DebugScreen.java:33)
	at org.terasology.nui.ActivatableWidget.activateWidget(ActivatableWidget.java:46)
	at org.terasology.nui.widgets.UIButton.activateWidget(UIButton.java:203)
	at org.terasology.nui.widgets.UIButton$1.onMouseRelease(UIButton.java:94)
	at org.terasology.nui.canvas.CanvasImpl.processMouseRelease(CanvasImpl.java:266)
	at org.terasology.engine.rendering.nui.internal.NUIManagerInternal.mouseButtonEvent(NUIManagerInternal.java:683)
	at org.terasology.engine.rendering.nui.internal.NUIManagerInternalMethodAccess.invoke(Unknown Source)
	at org.terasology.engine.entitySystem.event.internal.EventSystemImpl$ByteCodeEventHandlerInfo.invoke(EventSystemImpl.java:399)
	at org.terasology.engine.entitySystem.event.internal.EventSystemImpl.sendConsumableEvent(EventSystemImpl.java:274)
	at org.terasology.engine.entitySystem.event.internal.EventSystemImpl.send(EventSystemImpl.java:253)
	at org.terasology.engine.core.bootstrap.eventSystem.AbstractEventSystemDecorator.send(AbstractEventSystemDecorator.java:67)
	at org.terasology.engine.network.NetworkEventSystemDecorator.send(NetworkEventSystemDecorator.java:54)
	at org.terasology.engine.core.bootstrap.eventSystem.AbstractEventSystemDecorator.send(AbstractEventSystemDecorator.java:67)
	at org.terasology.engine.recording.RecordingEventSystemDecorator.send(RecordingEventSystemDecorator.java:34)
	at org.terasology.engine.entitySystem.entity.internal.BaseEntityRef.send(BaseEntityRef.java:190)
	at org.terasology.engine.input.InputSystem.send(InputSystem.java:525)
	at org.terasology.engine.input.InputSystem.sendMouseEvent(InputSystem.java:497)
	at org.terasology.engine.input.InputSystem.processMouseButtonInput(InputSystem.java:217)
	at org.terasology.engine.input.InputSystem.processMouseInput(InputSystem.java:196)
	at org.terasology.engine.input.InputSystem.update(InputSystem.java:131)
	at org.terasology.engine.core.modes.StateIngame.handleInput(StateIngame.java:209)
	at org.terasology.engine.core.subsystem.lwjgl.LwjglInput.postUpdate(LwjglInput.java:39)
	at org.terasology.engine.core.TerasologyEngine.tick(TerasologyEngine.java:521)
	at org.terasology.engine.core.TerasologyEngine.mainLoop(TerasologyEngine.java:472)
	at org.terasology.engine.core.TerasologyEngine.runMain(TerasologyEngine.java:448)
	at org.terasology.engine.core.TerasologyEngine.run(TerasologyEngine.java:414)
	at org.terasology.engine.Terasology.call(Terasology.java:190)
	at org.terasology.engine.Terasology.call(Terasology.java:70)
	at picocli.CommandLine.executeUserObject(CommandLine.java:1933)
	at picocli.CommandLine.access$1200(CommandLine.java:145)
	at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2332)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2326)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2291)
	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2159)
	at picocli.CommandLine.execute(CommandLine.java:2058)
	at org.terasology.engine.Terasology.main(Terasology.java:139)

@skaldarnar
Copy link
Contributor

skaldarnar commented Nov 14, 2022

Hm, looks like the issue above is about sending events from a UIButton subscription... 🤔 Do we need to pay attention to which thread this is running on? Do we have examples where we trigger ECS events from NUI UI controls? Although my added debug logs suggest that it's running on the [main] thread 🤷

skaldarnar
skaldarnar previously approved these changes Nov 14, 2022
Copy link
Contributor

@skaldarnar skaldarnar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@skaldarnar skaldarnar changed the title Feature/better debugging feat: better debugging for pathfinding tasks Nov 14, 2022
@skaldarnar skaldarnar added Type: Improvement Request for or addition/enhancement of a feature Category: Test/QA Requests, Issues and Changes targeting tests and quality assurance Category: Performance Requests, Issues and Changes targeting performance labels Nov 14, 2022
@skaldarnar skaldarnar added Topic: Stabilization Requests, Issues and Changes related to improving stablity and reducing flakyness Topic: UI/UX Requests, Issues and Changes related to screens, artwork, sound and overall user experience Size: M Medium-sized effort likely requiring some research and work in multiple areas labels Nov 14, 2022
@jdrueckert jdrueckert merged commit 8842aaa into Terasology:develop Nov 20, 2022
jdrueckert pushed a commit to MovingBlocks/Terasology that referenced this pull request Nov 26, 2022
While working on Terasology/FlexiblePathfinding#8 we noticed that there seem to be issues with sending events extending from BindButtonEvent programmatically (without the physical button press).

To avoid any future confusion (or at least find the issue sooner) I'm adding a brief docstring to the class stating it's intended use and that one should NOT use it directly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Performance Requests, Issues and Changes targeting performance Category: Test/QA Requests, Issues and Changes targeting tests and quality assurance Size: M Medium-sized effort likely requiring some research and work in multiple areas Topic: Stabilization Requests, Issues and Changes related to improving stablity and reducing flakyness Topic: UI/UX Requests, Issues and Changes related to screens, artwork, sound and overall user experience Type: Improvement Request for or addition/enhancement of a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants