box2d世界步骤永不回归(游戏冻结)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了box2d世界步骤永不回归(游戏冻结)相关的知识,希望对你有一定的参考价值。

我正在使用box2d和android Studio开发一个使用libgdx版本1.9.8的游戏。

https://github.com/agmCorp/GameThree

我的游戏是关于一个人物在屏幕上向上移动,射击敌人(典型的“全部射击”游戏)。相机总是向上移动(我的游戏是一个自上而下的游戏),我正在使用Box2d来管理碰撞检测。几个星期我陷入了错误,我甚至无法开始猜测如何解决它。

我的游戏完全冻结(音乐一直在运行,但图形在屏幕上冻结),当然也没有响应用户事件。

这个错误总是随机的,我无法确定其原因(我必须玩我的游戏一段时间来重现它)。我没有得到任何有用的错误,它只是冻结!

在我的代码中使用调试消息,当我执行一个世界步骤(PlayScreen.java)时,游戏会卡住:

private static final float WORLD_TIME_STEP = 1/300.0f;
private static final int WORLD_VELOCITY_ITERATIONS = 6;
private static final int WORLD_POSITION_ITERATIONS = 2;

...

world.step(WORLD_TIME_STEP, WORLD_VELOCITY_ITERATIONS, WORLD_POSITION_ITERATIONS);

程序执行该行,从libgdx调用此方法,但从不返回:

/** Take a time step. This performs collision detection, integration, and constraint solution.
 * @param timeStep the amount of time to simulate, this should not vary.
 * @param velocityIterations for the velocity constraint solver.
 * @param positionIterations for the position constraint solver. */
public void step (float timeStep, int velocityIterations, int positionIterations) {
    jniStep(addr, timeStep, velocityIterations, positionIterations);
}

我完全迷失了。问题可能是什么?这是完全冻结,而不是口吃,并且线程转储显示它在jniStep方法中(uy.com.agm.gamethree是我的游戏):

03-30 17:45:19.801 8699-8718/uy.com.agm.gamethree I/art: Starting a blocking GC Explicit
03-30 17:45:19.872 8699-8710/uy.com.agm.gamethree W/art: Suspending all threads took: 48.360ms
03-30 17:45:19.876 8699-8718/uy.com.agm.gamethree I/art: Explicit concurrent mark sweep GC freed 153337(6MB) AllocSpace objects, 1(20KB) LOS objects, 39% free, 9MB/16MB, paused 323us total 70.540ms
03-30 17:45:35.308 8699-8793/uy.com.agm.gamethree E/OpenGLRenderer:   saveGfxinfoFileDisabled enabled


Crash report:

                                               --------- beginning of crash
03-30 05:20:41.782 15643-16929/? A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x2600000002 in tid 16929 (GLThread 7573)

                                         [ 03-30 05:20:41.788  3103: 3103 W/         ]
                                         debuggerd: handling request: pid=15643 uid=10413 gid=10413 tid=16929
03-30 05:20:41.789 3282-3453/? I/AudioMixer: create resampler src 44100, 2, dst 48000, 2, q 8
03-30 05:20:41.789 3282-3453/? I/AudioMixer: create resampler src 44100, 2, dst 48000, 2, q 8
03-30 05:20:41.790 3282-3453/? D/SoundAliveResampler: [SoundAliveResampler] Init+++
03-30 05:20:41.790 3282-3453/? D/SoundAliveResampler: [SoundAliveResampler] Init+++
03-30 05:20:41.796 3282-3450/? D/AudioFlinger: mixer(0xf111b280) throttle end: throttle time(8)
03-30 05:20:41.841 3704-3931/? D/InputReader: Input event(4): value=0 when=74370654276000
03-30 05:20:41.841 3704-3931/? D/InputReader: Input event(4): value=0 when=74370654276000
03-30 05:20:41.841 3704-3931/? I/InputReader: Touch event's action is 0x1 (deviceType=0) [pCnt=1, s=] when=74370654276000
03-30 05:20:41.842 3704-3930/? I/InputDispatcher: Delivering touch to (15643): action: 0x1, toolType: 1
03-30 05:20:41.876 3299-18031/? I/NuPlayerRenderer: kWhatPollingAudiostarted clock running played_out : 31599564 us, audio_out : 31594285 us, gap : 5279 us
03-30 05:20:41.876 3299-18031/? I/MediaClock: setPlaybackRate rate : 1.000000
03-30 05:20:42.005 19080-19080/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
03-30 05:20:42.006 19080-19080/? A/DEBUG: Build fingerprint: 'samsung/heroltexx/herolte:7.0/NRD90M/G930FXXU2DRB7:user/release-keys'
03-30 05:20:42.006 19080-19080/? A/DEBUG: Revision: '8'
03-30 05:20:42.006 19080-19080/? A/DEBUG: ABI: 'arm64'
03-30 05:20:42.007 19080-19080/? A/DEBUG: pid: 15643, tid: 16929, name: GLThread 7573  >>> uy.com.agm.gamethree <<<
03-30 05:20:42.007 19080-19080/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x2600000002
03-30 05:20:42.007 19080-19080/? A/DEBUG:     x0   0000002600000002  x1   00000000000000b8  x2   00000078464ff180  x3   0000000000000002
03-30 05:20:42.007 19080-19080/? A/DEBUG:     x4   0000000000000001  x5   0000000000000001  x6   0000000000000000  x7   0000000000000000
03-30 05:20:42.007 19080-19080/? A/DEBUG:     x8   0000007864aa1098  x9   0000000000000000  x10  0000000000000001  x11  0000000000000001
03-30 05:20:42.007 19080-19080/? A/DEBUG:     x12  000000786af11df8  x13  000000786af11e94  x14  000000788c2a5e50  x15  0000000000000000
03-30 05:20:42.007 19080-19080/? A/DEBUG:     x16  0000007864aa0a18  x17  0000007864a729d8  x18  000000000000002e  x19  00000078464ff180
03-30 05:20:42.007 19080-19080/? A/DEBUG:     x20  000000786a5ec5b0  x21  00000078464ff1c0  x22  0000000000000006  x23  000000788b2bcad0
03-30 05:20:42.007 19080-19080/? A/DEBUG:     x24  0000000000000008  x25  4572cf0aa562048b  x26  000000786b761498  x27  4572cf0aa562048b
03-30 05:20:42.007 19080-19080/? A/DEBUG:     x28  000000786af11e90  x29  000000786af11db0  x30  0000007864a76004
03-30 05:20:42.007 19080-19080/? A/DEBUG:     sp   000000786af11d80  pc   0000007864a72a34  pstate 0000000080000000
03-30 05:20:42.010 3299-18031/? I/MediaClock: updateClock correction (30000).  gapTimeUs(244394), nowMediaUs(31757243), oldMediaUs(31512849)
03-30 05:20:42.027 19080-19080/? A/DEBUG: backtrace:
03-30 05:20:42.027 19080-19080/? A/DEBUG:     #00 pc 000000000001ba34  /data/app/uy.com.agm.gamethree-1/lib/arm64/libgdx-box2d.so (_ZN16b2BlockAllocator8AllocateEi+92)
03-30 05:20:42.027 19080-19080/? A/DEBUG:     #01 pc 000000000001f000  /data/app/uy.com.agm.gamethree-1/lib/arm64/libgdx-box2d.so (_ZN7b2World10CreateBodyEPK9b2BodyDef+48)
03-30 05:20:42.028 19080-19080/? A/DEBUG:     #02 pc 000000000002f6d0  /data/app/uy.com.agm.gamethree-1/lib/arm64/libgdx-box2d.so (Java_com_badlogic_gdx_physics_box2d_World_jniCreateBody+160)
03-30 05:20:42.028 19080-19080/? A/DEBUG:     #03 pc 00000000000db490  /system/lib64/libart.so (art_quick_generic_jni_trampoline+144)
03-30 05:20:42.028 19080-19080/? A/DEBUG:     #04 pc 0000000000049fb0  /dev/ashmem/dalvik-jit-code-cache_15643_15643 (deleted)
03-30 05:20:42.034 3299-18031/? I/MediaClock: updateClock correction (30000).  gapTimeUs(214368), nowMediaUs(31781229), oldMediaUs(31566861)
03-30 05:20:42.210 3282-3376/? I/APM_AudioPolicyManager: stopOutput() output 21, stream 3, session 42505
03-30 05:20:42.289 3299-18031/? I/MediaClock: updateClock correction (30000).  gapTimeUs(184390), nowMediaUs(32035616), oldMediaUs(31851226)
03-30 05:20:42.314 3299-18031/? I/MediaClock: updateClock correction (30000).  gapTimeUs(154402), nowMediaUs(32060515), oldMediaUs(31906113)
03-30 05:20:42.375 3704-3975/? D/WifiStateMachine: Current network is: "Alvaro" , ID is: 89
03-30 05:20:42.375 3704-3975/? D/WifiStateMachine: 24GHz mQnsLowerRssiThreshold is recovered, currentRssi = -49
03-30 05:20:42.392 4964-4964/? D/io_stats: !@   8,0 r 2694264 91924500 w 736624 13096768 d 102506 5500444 f 203857 203776 iot 1184890 1039063 th 303772 0 0 pt 0 inp 0 0 74371.205
03-30 05:20:42.570 3299-18031/? I/MediaClock: updateClock correction (30000).  gapTimeUs(124404), nowMediaUs(32316867), oldMediaUs(32192463)
03-30 05:20:42.837 3299-18031/? I/MediaClock: updateClock correction (30000).  gapTimeUs(94401), nowMediaUs(32584178), oldMediaUs(32489777)
03-30 05:20:42.909 3282-3376/? I/APM_AudioPolicyManager: stopOutput() output 21, stream 3, session 42513
03-30 05:20:43.422 3704-4635/? E/Watchdog: !@Sync 2477 [2018-03-30 05:20:43.422]
03-30 05:20:43.560 3282-3376/? I/APM_AudioPolicyManager: stopOutput() output 21, stream 3, session 42521
03-30 05:20:43.561 3282-3376/? I/APM_AudioPolicyManager: stopOutput() output 21, stream 3, session 42529
03-30 05:20:43.619 3704-7729/? D/SSRM:f: SIOP:: AP = 410, PST = 415 (W:10), CP = 338, CUR = -416, LCD = 51

                                         [ 03-30 05:20:44.517 19080:19080 E/         ]
                                         ro.debug_level = 0x4f4c

                                         [ 03-30 05:20:44.517 19080:19080 E/         ]
                                         sys.mobilecare.preload = false
03-30 05:20:44.533 3252-3252/? E/audit: type=1701 audit(1522398044.525:4506): auid=4294967295 uid=10413 gid=10413 ses=4294967295 subj=u:r:untrusted_app:s0:c512,c768 pid=16929 comm=474C5468726561642037353733 exe="/system/bin/app_process64" sig=11
03-30 05:20:44.546 3704-19082/? W/DropBoxManagerService: Dropping: data_app_native_crash (1930 > 0 bytes)
03-30 05:20:44.549 3704-19081/? W/ActivityManager:   Force finishing activity uy.com.agm.gamethree/.AndroidLauncher

                                                   [ 03-30 05:20:44.549  3103: 3103 W/         ]
                                                   debuggerd: resuming target 15643
03-30 05:20:44.549 3704-19081/? W/MultiScreenManagerService: moveTaskBackToDisplayIfNeeded(): root is not base activity
03-30 05:20:44.554 3704-19081/? D/ActivityManager: moveToFront() : reason=finishActivity adjustFocus setFocusedActivity isAttached=true TaskRecord{6649fe3d0 #2 A=com.sec.android.app.launcher U=0 StackId=0 sz=1}
03-30 05:20:44.554 3704-19081/? W/MultiScreenManagerService: moveTaskBackToDisplayIfNeeded(): root activity or app is null
03-30 05:20:44.555 3704-3827/? I/BootReceiver: Copying /data/tombstones/tombstone_05 to DropBox (SYSTEM_TOMBSTONE)
03-30 05:20:44.555 3704-19081/? D/ActivityManager: setFocusStackUnchecked: reason=finishActivity adjustFocus setFocusedActivity focusCandidate=ActivityStack{3331884d0 stackId=0, 2 tasks} caller=com.android.server.am.ActivityStack.moveToFront:875 com.android.server.am.ActivityStackSupervisor.moveActivityStackToFront:1995 
03-30 05:20:44.563 3704-3827/? W/DropBoxManagerService: Dropping: SYSTEM_TOMBSTONE (10 > 0 bytes)
03-30 05:20:44.569 3704-19081/? D/InputDispatcher: Focused application set to: xxxx
03-30 05:20:44.570 3704-19081/? D/InputDispatcher: Focus left window: 15643
03-30 05:20:44.572 3704-19081/? D/ActivityTrigger: ActivityTrigger activityPauseTrigger 
03-30 05:20:44.572 3704-19081/? D/GameManagerService: sem_perfomance_mode: 0
03-30 05:20:44.598 3190-3190/? E/lowmemorykiller: Error writing /proc/15643/oom_score_adj; errno=22
03-30 05:20:44.640 3299-3825/? V/MediaPlayerService: Client(72) destructor pid = 15643
03-30 05:20:44.640 3299-3825/? V/MediaPlayerService: disconnect(72) from pid 15643
03-30 05:20:44.640 3299-3825/? D/NuPlayerDriver: reset(0xdd570c00) at state 8
03-30 05:20:44.641 3299-16939/? V/NuPlayer: kWhatReset
03-30 05:20:44.641 3299-16939/? V/NuPlayer: setDecoderBooster enable = No
03-30 05:20:44.641 3299-16939/? V/NuPlayer: performDecoderFlush audio=2, video=2
03-30 05:20:44.641 3299-16939/? V/NuPlayer: [audio] flushDecoder needShutdown=1
03-30 05:20:44.641 3299-16939/? V/NuPlayer: postponing action mFlushingAudio=2, mFlushingVideo=0
03-30 05:20:44.641 3299-16939/? V/NuPlayer: mResetInProgress=1, mVideoEOS =0, mAudioEOS =0
03-30 05:20:44.641 3299-16939/? V/NuPlayer: (mAudioDecoder != NULL) = true, (mVideoDecoder != NULL) = false
03-30 05:20:44.641 3704-3987/? D/GraphicsStats: Buffer count: 7
03-30 05:20:44.641 3704-8833/? D/InputTransport: Input channel destroyed: fd=595
03-30 05:20:44.643 9906-9906/? D/InputTransport: Input channel destroyed: fd=71
03-30 05:20:44.643 3299-16993/? I/NuPlayerRenderer: flush audio, notifyComplete 1
03-30 05:20:44.643 3299-16993/? D/NuPlayerRenderer: signalTimeDiscontinuity() mHasAudio = 1 , mHasVideo = 0
03-30 05:20:44.643 3299-16992/? I/NuPlayerRenderer: flushing audio
03-30 05:20:44.644 3299-16992/? I/NuPlayerRenderer: onFlush mAudioDrainGeneration : 4
03-30 05:20:44.644 3299-16992/? V/AudioSink: flush
03-30 05:20:44.644 3299-16994/? I/ACodec: [OMX.google.vorbis.decoder] signalFlush
03-30 05:20:44.644 3299-16994/? I/ACodec: [OMX.google.vorbis.decoder] ExecutingState flushing now (codec owns 4/4 input, 0/4 output).
03-30 05:20:44.645 3299-16994/? I/ACodec: [OMX.google.vorbis.decoder] Now Flushing
03-30 05:20:44.645 3299-16994/? I/ACodec: [OMX.google.vorbis.decoder] FlushingState onOMXEvent(0,1,0)
03-30 05:20:44.645 3299-16994/? I/ACodec: [OMX.google.vorbis.decoder] FlushingState onOMXEvent(0,1,1)
03-30 05:20:44.645 3299-16994/? I/ACodec: [OMX.google.vorbis.decoder] Now Executing
03-30 05:20:44.646 3299-16939/? V/NuPlayer: decoder audio flush completed
03-30 05:20:44.646 3299-16992/? V/AudioSink: stop
03-30 05:20:44.647 3299-16939/? V/NuPlayer: renderer audio flush completed.
03-30 05:20:44.647 3299-16939/? V/NuPlayer: initiating audio decoder shutdown
03-30 05:20:44.648 3299-16994/? I/ACodec: [OMX.google.vorbis.decoder] Now Executing->Idle
03-30 05:20:44.649 3704-3792/? I/WindowManager: WIN DEATH: Window{da8728d0 u0 SurfaceView - uy.com.agm.gamethree/uy.com.agm.gamethree.AndroidLauncher}
03-30 05:20:44.650 3704-3792/? I/WindowManager_SurfaceController: Destroying surface Surface(name=SurfaceView - uy.com.agm.gamethree/uy.com.agm.gamethree.AndroidLauncher) called by com.android.server.wm.WindowStateAnimator.destroySurface:2840 com.android.server.wm.WindowStateAnimator.destroySurfaceLocked:1070 com.android.server.wm.WindowState.removeLocked:1783 com.android.server.wm.WindowManagerService.removeWindowInnerLocked:2893 com.android.server.wm.WindowManagerService.removeWindowInnerLocked:2854 com.android.server.wm.WindowManagerService.removeWindowLocked:2839 com.android.server.wm.WindowState$DeathRecipient.binderDied:2203 android.os.BinderProxy.sendDeathNotice:701 
03-30 05:20:44.651 3192-3939/? I/SurfaceFlinger: id=1149 Removed BndroidLaun (2/5)
03-30 05:20:44.654 3192-9227/? I/SurfaceFlinger: id=1149 Removed BndroidLaun (-2/5)
03-30 05:20:44.654 3192-3199/? I/SurfaceFlinger: id=1150 Removed BndroidLaun (1/4)
03-30 05:20:44.655 3299-16994/? I/ACodec: [OMX.google.vorbis.decoder] Now Idle->Loaded
03-30 05:20:44.655 3192-3197/? I/SurfaceFlinger: id=1150 Removed BndroidLaun (-2/4)
03-30 05:20:44.656 3299-16994/? I/ACodec: [OMX.google.vorbis.decoder] Now Loaded
03-30 05:20:44.659 3299-16994/? I/ACodec:  [OMX.google.vorbis.decoder] Now uninitialized
03-30 05:20:44.659 3299-16994/? I/ACodec:  [] Now kWhatShutdownCompleted event : 8362
03-30 05:20:44.659 3299-16994/? I/MediaCodec: Codec shutdown complete
03-30 05:20:44.660 3299-16993/? I/NuPlayerDecoder: onShutdown notifyComplete : Yes
03-30 05:20:44.660 3299-16939/? V/NuPlayer: audio shutdown completed
03-30 05:20:44.660 3299-16939/? W/AMessage: failed to post message as target looper for handler 0 is gone.
03-30 05:20:44.661 3299-16939/? V/NuPlayer: both audio and video are flushed now.
03-30 05:20:44.661 3299-16939/? V/NuPlayer: Reset was postponed execute processDeferredActions
03-30 05:20:44.662 3299-16939/? V/NuPlayer: performReset
03-30 05:20:44.662 3704-5446/? I/ActivityManager: Process uy.com.agm.gamethree (pid 15643) has died(78,1140)
03-30 05:20:44.662 3299-16939/? V/GenericSource: stop()
03-30 05:20:44.662 3299-16939/? V/GenericSource: PREPARE_CANCELLED set to true
03-30 05:20:44.662 3299-16939/? V/GenericSource: [Flag] set 0x40 -> mFlags = 0x48
03-30 05:20:44.662 3299-16939/? V/GenericSource: [Flag] clear 0x8 -> mFlags = 0x40
03-30 05:20:44.662 3299-16939/? V/GenericSource: stop() end
03-30 05:20:44.662 3299-16939/? V/GenericSource: ~GenericSource()
03-30 05:20:44.662 3704-5446/? D/ActivityManager: cleanUpApplicationRecord -- 15643
03-30 05:20:44.663 3299-16939/? D/NuPlayerDriver: notifyResetComplete(0xdd570c00)
03-30 05:20:44.664 3299-3825/? V/NuPlayerDriver: ~NuPlayerDriver(0xdd570c00)
03-30 05:20:44.664 3298-18728/? I/OggExtractor: OggSource::stop() mExtractor ref count = 2
03-30 05:20:44.664 3298-18728/? I/OggExtractor: ~OggSource --
03-30 05:20:44.667 3299-3825/? V/AudioSink: +++ close
03-30 05:20:44.667 3299-3825/? V/AudioSink: --- close
03-30 05:20:44.668 3298-10317/? I/OggExtractor: ~OggExtractor ++
03-30 05:20:44.668 3298-10317/? I/OggExtractor: ~MyOggExtractor ++ 
03-30 05:20:44.668 3298-10317/? I/OggExtractor: ~MyOggExtractor --
03-30 05:20:44.668 3298-10317/? I/OggExtractor: ~OggExtractor --
03-30 05:20:44.674 3704-3715/? I/art: Background sticky concurrent mark sweep GC freed 163943(7MB) AllocSpace objects, 16(1104KB) LOS objects, 8% free, 72MB/79MB, paused 3.415ms total 118.714ms
03-30 05:20:44.676 3299-3825/? V/MediaPlayerService: Client(73) destructor pid = 15643
03-30 05:20:44.676 3299-3825/? V/MediaPlayerService: disconnect(73) from pid 15643
03-30 05:20:44.676 3299-3825/? D/NuPlayerDriver: reset(0xdd570300) at state 8
03-30 05:20:44.676 3299-16954/? V/NuPlayer: kWhatReset
03-30 05:20:44.676 3299-16954/? V/NuPlayer: setDecoderBooster enable = No
03-30 05:20:44.676 3299-16954/? V/NuPlayer: performDecoderFlush audio=2, video=2
03-30 05:20:44.676 3299-16954/? V/NuPlayer: [audio] flushDecoder needShutdown=1
03-30 05:20:44.676 3299-16954/? V/NuPlayer: postponing action mFlushingAudio=2, mFlushingVideo=0
03-30 05:20:44.676 3299-16954/? V/NuPlayer: mResetInProgress=1, mVideoEOS =0, mAudioEOS =0
03-30 05:20:44.676 3299-17034/? I/NuPlayerRenderer: flush audio, notifyComplete 1
03-30 05:20:44.676 3299-16954/? V/NuPlayer: (mAudioDecoder != NULL) = true, (mVideoDecoder != NULL) = false
03-30 05:20:44.676 3299-17034/? D/NuPlayerRenderer: signalTimeDiscontinuity() mHasAudio = 1 , mHasVideo = 0
03-30 05:20:44.676 3299-17033/? I/NuPlayerRenderer: flushing audio
03-30 05:20:44.676 3299-17035/? I/ACodec: [OMX.google.vorbis.decoder] signalFlush
03-30 05:20:44.677 3299-17033/? I/NuPlayerRenderer: onFlush mAudioDrainGeneration : 6
03-30 05:20:44.677 3299-17033/? V/AudioSink: flush
03-30 05:20:44.677 3299-17035/? I/ACodec: [OMX.google.vorbis.decoder] ExecutingState flushing now (codec owns 4/4 input, 0/4 output).
03-30 05:20:44.677 3299-17033/? V/AudioSink: stop
03-30 05:20:44.677 3299-17035/? I/ACodec: [OMX.google.vorbis.decoder] Now Flushing
03-30 05:20:44.678 3299-16954/? V/NuPlayer: renderer audio flush completed.
03-30 05:20:44.678 3299-17035/? I/ACodec: [OMX.google.vorbis.decoder] FlushingState onOMXEvent(0,1,0)
03-30 05:20:44.678 3299-17035/? I/ACodec: [OMX.google.vorbis.decoder] FlushingState onOMXEvent(0,1,1)
03-30 05:20:44.678 3299-17035/? I/ACodec: [OMX.google.vorbis.decoder] Now Executing
03-30 05:20:44.679 3299-16954/? V/NuPlayer: decoder audio flush completed
03-30 05:20:44.679 3704-3992/? I/WindowManager: WIN DEATH: Window{20488c5d0 u0 uy.com.agm.gamethree/uy.com.agm.gamethree.AndroidLauncher}
03-30 05:20:44.679 3299-16954/? V/NuPlayer: initiating audio decoder shutdown
03-30 05:20:44.679 3704-3992/? I/WindowManager_SurfaceController: Destroying surface Surface(name=uy.com.agm.gamethree/uy.com.agm.gamethree.AndroidLauncher) called by com.android.server.wm.WindowStateAnimator.destroySurface:2840 com.android.server.wm.WindowStateAnimator.destroySurfaceLocked:1070 com.android.server.wm.WindowState.removeLocked:1783 com.android.server.wm.WindowManagerService.removeWindowInnerLocked:2893 com.android.server.wm.WindowManagerService.removeWindowInnerLocked:2854 com.android.server.wm.WindowManagerService.removeWindowLocked:2839 com.android.server.wm.WindowState$DeathRecipient.binderDied:2203 android.os.BinderProxy.sendDeathNotice:701 
03-30 05:20:44.680 3192-3199/? I/SurfaceFlinger: id=1148 Removed BndroidLaun (1/3)
03-30 05:20:44.680 3299-17035/? I/ACodec: [OMX.google.vorbis.decoder] Now Executing->Idle
03-30 05:20:44.681 3192-3197/? I/SurfaceFlinger: id=1148 Removed BndroidLaun (-2/3)
03-30 05:20:44.683 3704-3992/? D/InputTransport: Input channel destroyed: fd=474
03-30 05:20:44.684 3704-3992/? D/PowerManagerService: [api] release WakeLock SCREEN_BRIGHT_WAKE_LOCK        'WindowManager' ON_AFTER_RELEASE (uid=1000, pid=3704, ws=WorkSource{10413}) (uid=1000, pid=3704, ws=WorkSource{10413}, pkg=android, elapsedTime=629662) (0x0)
03-30 05:20:44.684 3704-3992/? D/PowerManagerService: [api] applyWakeLockFlagsOnReleaseLocked : userActivityNoUpdateLocked is called : SCREEN_BRIGHT_WAKE_LOCK        'WindowManager' ON_AFTER_RELEASE (uid=1000, pid=3704, ws=WorkSource{10413}) (uid=1000, pid=3704, ws=WorkSource{10413}, pkg=android, elapsedTime=629662)
03-30 05:20:44.690 3299-17035/? I/ACodec: [OMX.google.vorbis.decoder] Now Idle->Loaded
03-30 05:20:44.690 3299-17035/? I/ACodec: [OMX.google.vorbis.decoder] Now Loaded
03-30 05:20:44.693 3704-5446/? D/ActivityManager: resumeTopActivityInnerLocked() : #0 prevTask=null next=ActivityRecord{779e647d0 u0 com.sec.android.app.launcher/.activities.LauncherActivity t2} mFocusedStack=ActivityStack{3331884d0 stackId=0, 2 tasks}
03-30 05:20:44.694 3299-17035/? I/ACodec:  [OMX.google.vorbis.decoder] Now uninitialized
03-30 05:20:44.694 3299-17035/? I/ACodec:  [] Now kWhatShutdownCompleted event : 8362
03-30 05:20:44.694 3299-17035/? I/MediaCodec: Codec shutdown complete
03-30 05:20:44.695 3299-17034/? I/NuPlayerDecoder: onShutdown notifyComplete : Yes
03-30 05:20:44.695 3299-16954/? V/NuPlayer: audio shutdown completed
03-30 05:20:44.695 3299-16954/? W/AMessage: failed to post message as target looper for handler 0 is gone.
03-30 05:20:44.696 3299-16954/? V/NuPlayer: both audio and video are flushed now.
03-30 05:20:44.696 3299-16954/? V/NuPlayer: Reset was postponed execute processDeferredActions
03-30 05:20:44.696 3299-16954/? V/NuPlayer: performReset
03-30 05:20:44.696 3299-16954/? V/GenericSource: stop()
03-30 05:20:44.696 3299-16954/? V/GenericSource: PREPARE_CANCELLED set to true
03-30 05:20:44.696 3299-16954/? V/GenericSource: [Flag] set 0x40 -> mFlags = 0x48
03-30 05:20:44.696 3299-16954/? V/GenericSource: [Flag] clear 0x8 -> mFlags = 0x40
03-30 05:20:44.696 3299-16954/? V/GenericSource: stop() end
03-30 05:20:44.696 3299-16954/? V/GenericSource: ~GenericSource()
03-30 05:20:44.697 3704-5446/? D/CustomFrequencyManagerService: acquireDVFSLockLocked : type : DVFS_MIN_LIMIT  frequency : 1560000  uid : 1000  pid : 3704  pkgName : AMS_RESUME@CPU_MIN@7
03-30 05:20:44.697 3299-16954/? D/NuPlayerDriver: notifyResetComplete(0xdd570300)
03-30 05:20:44.697 3299-3825/? V/NuPlayerDriver: ~NuPlayerDriver(0xdd570300)
03-30 05:20:44.698 3298-10305/? I/OggExtractor: OggSource::stop() mExtractor ref count = 2
03-30 05:20:44.698 3298-10305/? I/OggExtractor: ~OggSource --
03-30 05:20:44.698 3299-3825/? V/AudioSink: +++ close
03-30 05:20:44.698 3299-3825/? V/AudioSink: --- close
03-30 05:20:44.699 3298-3357/? I/OggExtractor: ~OggExtractor ++
03-30 05:20:44.699 3298-3357/? I/OggExtractor: ~MyOggExtractor ++ 
03-30 05:20:44.699 3298-3357/? I/OggExtractor: ~MyOggExtractor --
03-30 05:20:44.699 3298-3357/? I/OggExtractor: ~OggExtractor --
03-30 05:20:44.699 3299-3825/? V/MediaPlayerService: Client(74) destructor pid = 15643
03-30 05:20:44.699 3299-3825/? V/MediaPlayerService: disconnect(74) from pid 15643
03-30 05:20:44.699 3299-3825/? D/NuPlayerDriver: reset(0xdd570480) at state 5
03-30 05:20:44.699 3299-3825/? D/NuPlayerDriver: notifyListener_l(0xdd570480), (8, 0, 0), loop setting(0, 1)
03-30 05:20:44.699 3299-16971/? V/NuPlayer: kWhatReset
03-30 05:20:44.699 3299-16971/? V/NuPlayer: setDecoderBooster enable = No
03-30 05:20:44.699 3299-16971/? V/NuPlayer: performDecoderFlush audio=2, video=2
03-30 05:20:44.699 3299-16971/? V/NuPlayer: [audio] flushDecoder needShutdown=1
03-30 05:20:44.699 3299-18032/? I/NuPlayerRenderer: flush audio, notifyComplete 1
03-30 05:20:44.699 3299-16971/? V/NuPlayer: postponing action mFlushingAudio=2, mFlushingVideo=0
03-30 05:20:44.699 3299-16971/? V/NuPlayer: mResetInProgress=1, mVideoEOS =0, mAudioEOS =0
03-30 05:20:44.699 3299-18032/? D/NuPlayerRenderer: signalTimeDiscontinuity() mHasAudio = 1 , mHasVideo = 0
03-30 05:20:44.699 3299-16971/? V/NuPlayer: (mAudioDecoder != NULL) = true, (mVideoDecoder != NULL) = false
03-30 05:20:44.699 3299-18031/? I/NuPlayerRenderer: flushing audio
03-30 05:20:44.700 3299-18031/? I/NuPlayerRenderer: onFlush mAudioDrainGeneration : 4
03-30 05:20:44.700 3299-18031/? V/AudioSink: pause
03-30 05:20:44.700 3299-18033/? I/ACodec: [OMX.google.vorbis.decoder] signalFlush
03-30 05:20:44.700 3299-18033/? I/ACodec: [OMX.google.vorbis.decoder] ExecutingState flushing now (codec owns 4/4 input, 0/4 output).
03-30 05:20:44.700 3299-18033/? I/ACodec: [OMX.google.vorbis.decoder] Now Flushing
03-30 05:20:44.701 3299-18033/? I/ACodec: [OMX.google.vorbis.decoder] FlushingState onOMXEvent(0,1,0)
03-30 05:20:44.701 3299-18033/? I/ACodec: [OMX.google.vorbis.decoder] FlushingState onOMXEvent(0,1,1)
03-30 05:20:44.701 3299-18033/? I/ACodec: [OMX.google.vorbis.decoder] Now Executing
03-30 05:20:44.701 3299-16971/? V/NuPlayer: decoder audio flush completed
03-30 05:20:44.704 3704-5446/? D/ActivityManager: mActivityResumeBooster.acquire()
03-30 05:20:44.712 3704-5446/? D/GameManagerService: sem_perfomance_mode: 0
03-30 05:20:44.712 3704-3704/? D/GameManagerService: NotifyRunnable. pkg: com.sec.android.app.launcher, type: 4, isMinimized: false, isTunableApp: false

你们有关于发生了什么的线索吗?我怎么能面对这个?

答案

我有类似的问题。令人沮丧的是它随机发生。

我不确定你的游戏是如何实现的,但在我的游戏中,问题是从物理模拟的时间步骤开始。

最初,它固定在1 / 60f。这种方法的问题是FPS的变化,尤其是在移动设备上。

我的解决方案是使用Glenn Fiedler http://gafferongames.com/game-physics/fix-your-timestep/提出的方法来确定时间步长

你可以在这里找到这些技术的LibGDX实现:http://saltares.com/blog/games/fixing-your-timestep-in-libgdx-and-box2d/

以上是关于box2d世界步骤永不回归(游戏冻结)的主要内容,如果未能解决你的问题,请参考以下文章

1.Libgdx扩展学习之Box2D_入门介绍

1.Libgdx扩展学习之Box2D_入门介绍

Box2d刚体轨迹预测

Box2d:如何施加力以保持从左到右的摆动?

6.Libgdx扩展学习之Box2D_鼠标关节

6.Libgdx扩展学习之Box2D_鼠标关节