我目前正在使用 LibGDX 在 Android 上开发一款带有 AI 的多人游戏。但现在我遇到了一个问题,当我在桌面上运行它两次或三次时,分别通过不同端口的UDP和TCP相互连接。玩了几分钟后,其中一个变得没有反应。我在 android 上进行了一些测试,但我不确定是否会出现崩溃。点击“关闭程序”后,Android Studio 控制台日志中会显示一些详细信息。我不知道为什么会这样。
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
AL lib: (EE) alc_cleanup: 1 device not closed
Assertion failed!
Program: C:\Program Files\Android\Android Studio\jre\bin\java.exe
File: /var/jenkins/.jenkins/workspace/libgdx/extensions/gdx-box2d/gdx-box2d/jni/Box2D/Dynamics/Contacts/b2ContactSolver.cpp, Line 73
Expression: pointCount > 0
我使用了多线程、同步、对象数组列表以及同步的 com.badlogic.gdx.physicals.box2d.Body。
Three desktop apps are connected
One desktop app becomes unresponsive
更新:使用jstack调试后,我发现这条线随机导致故障。我认为我使用 box2d body 不当。
world.step(ScreenManager.deltaTime, 6, 2);
最佳答案
已解决。 FixtureDef 中的 isSensor 在物体接触期间不得更改, 因为存在断言失败的可能性。
关于java - Libgdx 断言失败 [表达式 : pointCount > 0],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59278346/