December 01, 2020, 03:14:24 PM

Author Topic: Need help before I go insane.  (Read 2640 times)

Offline jvdw007

  • Jr. Member
  • **
  • Posts: 30
    • Blackjet Games
Need help before I go insane.
« on: December 31, 2017, 09:26:00 PM »
So, my game is ready for the world to burn and complain about. I compiled it for Windows, Linux, Mac, Ouya, and now Android. Desktop version (on another thread gave some compile issue on my Win10 laptop - never mind, got around that). Suffice to say it runs fine on all these OSes.
On the Ouya for some unknown reason, the game crashes the first time, but only sometimes and at random. However I may have fixed that problem (can't remember at this time and it's not important really).

Get to the Android version. Game works fine on my Android 5.1.1 Nexus 10 tablet. However on Android 8.1.1 Nexus 6P phone and on my wife's Nexus 5X and a mate's Nexus 5 (all running Android 8.x.x) my game crashes. It doesn't crash right away. On the menu it runs perfectly fine and everything is hunky dory. As soon as you select start, you go to a next phase which is to choose your ship. Once in there you hit start and it shows a get ready section before throwing you in the actual game where you start shooting and moving around etc. It keeps crashing on the get ready screen just before the start of the game. ONLY on Android 8.x.x

It has to do with audio. I know because when you enable just the music in the game or no audio, it works perfectly fine. I created a simple audio class system which I'll post below. Simply put, each time the game wants to play back a sound, I pass a set of values into this class and it plays the sound according to an internal game timer. The timer is in place for various reasons, namely for when to make enemies/bosses appear and also when to spout out some audio vocals (your ship robot assistant). So here's the audio class, then an example of usage:


Code: [Select]
Import mojo.audio

#Rem
This class plays sounds, pretty much immediately.
Uses start and end channels to cycle through so if many sounds occur, less clipping occurs.
Also has volume controls set during update or creation time.
#End

Class Audio
Global audioList := New List<Audio>
Field theSound:Sound, theChannel:Int = 1, startChannel:Int = 1, endChannel:Int = 30, timer:Int, volume:Float

Method New(theSound:Sound, timer:Float, volume:Float)
Self.theSound = theSound
Self.timer = timer
Self.volume = volume
End

Method Create:Void(theSound:Sound, timer:Int = 0, volume:Float = 1)
Local tmp:Audio
tmp = New Audio(theSound, timer, volume)
audioList.AddFirst tmp
End

Method Update:Void(timer:Int = 0, volume:Float = 1)
For Local i := Eachin audioList
If i.timer = 0 Or timer >= i.timer - 2 Or i.timer < timer
If theChannel > endChannel
theChannel = startChannel
End
Print "timer: " + i.timer + " volume: " + volume + " channel: " + theChannel
PlaySound(i.theSound, theChannel, 0)
audioList.Remove i
theChannel += 1
End
Next
End

Method Clear:Void()
For Local i := Eachin audioList
audioList.Remove i
Next
End

End

Example of use would be for a sound to play immediately:
Code: [Select]
audioList.Create(snd_explode[3],, sfxVolume)
Example to play in the future would be:
Code: [Select]
audioList.Create(vocalSounds[UPGRADESHIPUSINGDROPS], 250, vocalsVolume)
To quell confusion about the above, let me explain the parameters. snd_explode would be initialised at the top of the game as Field snd_explode:Sound[] then populated as such: snd_explode = [LoadSound("explode01.wav"), LoadSound("explode02.wav"), LoadSound("gameOver.wav")] etc etc.

So in the OnUpdate section of the game, I simply call:
Code: [Select]
audioList.Update(showCaseTimer, theVolume)
That's all there is to it. As can be seen in the audio class, all it does is build a list of sounds to play. When the game timer is about the same as the listed sound's timer, it plays it, removes it from the list, then cycles up to the next audio channel. Simple.

I proceeded to connect my phone via USB debugging to my devbox and I watch the debug trace and this is what happens when it crashes:
Code: [Select]
TRANS monkey compiler V1.87
Parsing...
Semanting...
Translating...
Building...
Buildfile: Z:\GameDev\PC\SpaceWhale\spacewhale.buildv86e\android_new\build.xml
-check-env:
 [checkenv] Android SDK Tools Revision 25.2.5
 [checkenv] Installed at C:\DevTools\AndroidSDK
-setup:
     [echo] Project Name: MonkeyGame
  [gettype] Project Type: Application
-pre-clean:
clean:
   [delete] Deleting directory Z:\GameDev\PC\SpaceWhale\spacewhale.buildv86e\android_new\bin
   [delete] Deleting directory Z:\GameDev\PC\SpaceWhale\spacewhale.buildv86e\android_new\gen
[getlibpath] Library dependencies:
[getlibpath] No Libraries
   [subant] No sub-builds to iterate on
BUILD SUCCESSFUL
Total time: 30 seconds
Buildfile: Z:\GameDev\PC\SpaceWhale\spacewhale.buildv86e\android_new\build.xml
-set-mode-check:
-set-debug-files:
-check-env:
 [checkenv] Android SDK Tools Revision 25.2.5
 [checkenv] Installed at C:\DevTools\AndroidSDK
-setup:
     [echo] Project Name: MonkeyGame
  [gettype] Project Type: Application
-set-debug-mode:
-debug-obfuscation-check:
-pre-build:
-build-setup:
[getbuildtools] Using latest Build Tools: 23.0.3
     [echo] Resolving Build Target for MonkeyGame...
[gettarget] Project Target:   Android 4.4.2
[gettarget] API level:        19
     [echo] ----------
     [echo] Creating output directories if needed...
    [mkdir] Created dir: Z:\GameDev\PC\SpaceWhale\spacewhale.buildv86e\android_new\bin
    [mkdir] Created dir: Z:\GameDev\PC\SpaceWhale\spacewhale.buildv86e\android_new\bin\res
    [mkdir] Created dir: Z:\GameDev\PC\SpaceWhale\spacewhale.buildv86e\android_new\bin\rsObj
    [mkdir] Created dir: Z:\GameDev\PC\SpaceWhale\spacewhale.buildv86e\android_new\bin\rsLibs
    [mkdir] Created dir: Z:\GameDev\PC\SpaceWhale\spacewhale.buildv86e\android_new\gen
    [mkdir] Created dir: Z:\GameDev\PC\SpaceWhale\spacewhale.buildv86e\android_new\bin\classes
    [mkdir] Created dir: Z:\GameDev\PC\SpaceWhale\spacewhale.buildv86e\android_new\bin\dexedLibs
     [echo] ----------
     [echo] Resolving Dependencies for MonkeyGame...
[dependency] Library dependencies:
[dependency] No Libraries
[dependency]
[dependency] ------------------
     [echo] ----------
     [echo] Building Libraries with 'debug'...
   [subant] No sub-builds to iterate on
-code-gen:
[mergemanifest] Merging AndroidManifest files into one.
[mergemanifest] Manifest merger disabled. Using project manifest only.
     [echo] Handling aidl files...
     [aidl] No AIDL files to compile.
     [echo] ----------
     [echo] Handling RenderScript files...
     [echo] ----------
     [echo] Handling Resources...
     [aapt] Generating resource IDs...
     [echo] ----------
     [echo] Handling BuildConfig class...
[buildconfig] Generating BuildConfig class.
-pre-compile:
-compile:
    [javac] Compiling 5 source files to Z:\GameDev\PC\SpaceWhale\spacewhale.buildv86e\android_new\bin\classes
    [javac] Note: Z:\GameDev\PC\SpaceWhale\spacewhale.buildv86e\android_new\src\com\blackjet\Spacewhale\MonkeyGame.java uses or overrides a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] Note: Z:\GameDev\PC\SpaceWhale\spacewhale.buildv86e\android_new\src\com\blackjet\Spacewhale\MonkeyGame.java uses unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
-post-compile:
-obfuscate:
-dex:
      [dex] input: Z:\GameDev\PC\SpaceWhale\spacewhale.buildv86e\android_new\bin\classes
      [dex] Converting compiled files and external libraries into Z:\GameDev\PC\SpaceWhale\spacewhale.buildv86e\android_new\bin\classes.dex...
-crunch:
   [crunch] Crunching PNG Files in source dir: Z:\GameDev\PC\SpaceWhale\spacewhale.buildv86e\android_new\res
   [crunch] To destination dir: Z:\GameDev\PC\SpaceWhale\spacewhale.buildv86e\android_new\bin\res
   [crunch] Processing image to cache: Z:\GameDev\PC\SpaceWhale\spacewhale.buildv86e\android_new\res\drawable-hdpi\icon.png => Z:\GameDev\PC\SpaceWhale\spacewhale.buildv86e\android_new\bin\res\drawable-hdpi\icon.png
   [crunch]   (processed image to cache entry Z:\GameDev\PC\SpaceWhale\spacewhale.buildv86e\android_new\bin\res\drawable-hdpi\icon.png: 0% size of source)
   [crunch] Processing image to cache: Z:\GameDev\PC\SpaceWhale\spacewhale.buildv86e\android_new\res\drawable-ldpi\icon.png => Z:\GameDev\PC\SpaceWhale\spacewhale.buildv86e\android_new\bin\res\drawable-ldpi\icon.png
   [crunch]   (processed image to cache entry Z:\GameDev\PC\SpaceWhale\spacewhale.buildv86e\android_new\bin\res\drawable-ldpi\icon.png: 0% size of source)
   [crunch] Processing image to cache: Z:\GameDev\PC\SpaceWhale\spacewhale.buildv86e\android_new\res\drawable-mdpi\icon.png => Z:\GameDev\PC\SpaceWhale\spacewhale.buildv86e\android_new\bin\res\drawable-mdpi\icon.png
   [crunch]   (processed image to cache entry Z:\GameDev\PC\SpaceWhale\spacewhale.buildv86e\android_new\bin\res\drawable-mdpi\icon.png: 0% size of source)
   [crunch] Crunched 3 PNG files to update cache
-package-resources:
     [aapt] Creating full resource package...
-package:
[apkbuilder] Current build type is different than previous build: forced apkbuilder run.
[apkbuilder] Creating MonkeyGame-debug-unaligned.apk and signing it with a debug key...
-post-package:
-do-debug:
 [zipalign] Running zip align on final apk...
     [echo] Debug Package: Z:\GameDev\PC\SpaceWhale\spacewhale.buildv86e\android_new\bin\MonkeyGame-debug.apk
[propertyfile] Creating new property file: Z:\GameDev\PC\SpaceWhale\spacewhale.buildv86e\android_new\bin\build.prop
[propertyfile] Updating property file: Z:\GameDev\PC\SpaceWhale\spacewhale.buildv86e\android_new\bin\build.prop
[propertyfile] Updating property file: Z:\GameDev\PC\SpaceWhale\spacewhale.buildv86e\android_new\bin\build.prop
[propertyfile] Updating property file: Z:\GameDev\PC\SpaceWhale\spacewhale.buildv86e\android_new\bin\build.prop
-post-build:
debug:
install:
     [echo] Installing Z:\GameDev\PC\SpaceWhale\spacewhale.buildv86e\android_new\bin\MonkeyGame-debug.apk onto default emulator or device...
     [exec] Success
BUILD SUCCESSFUL
Total time: 1 minute 10 seconds
Starting: Intent { cmp=com.blackjet.Spacewhale/.MonkeyGame }

--------- beginning of main
12-31 20:51:58.791  3503  3596 E QC-QMI  : linux_qmi_qmux_io_wake_lock: Err in writing wakelock=qmuxd_port_wl_0, error [1:Operation not permitted]
12-31 20:51:58.791  3503  3596 E QC-QMI  : linux_qmi_qmux_io_wake_unlock: Err in writing wakelock=qmuxd_port_wl_0, error [1:Operation not permitted]
--------- beginning of system
12-31 20:51:59.398 11289 11289 E WindowSearchConfig: package not found com.opera.browser
12-31 20:51:59.420 11289 11289 E WindowSearchConfig: package not found com.opera.mini.native
12-31 20:51:59.526 11289 11289 E WindowSearchConfig: package not found com.chrome.beta
12-31 20:51:59.547 11289 11289 E WindowSearchConfig: package not found com.amazon.cloud9
12-31 20:51:59.563 11289 11289 E WindowSearchConfig: package not found com.sec.android.app.sbrowser
12-31 20:51:59.580 11538 11608 E CarrierServices: [1595] d.getFile: File not found.: /data/user/0/com.google.android.apps.messaging/files/httpft_pending (No such file or directory)
12-31 20:51:59.580 11538 11608 E CarrierServices: java.io.FileInputStream.open0(Native Method)
12-31 20:51:59.580 11538 11608 E CarrierServices: java.io.FileInputStream.open(FileInputStream.java:200)
12-31 20:51:59.580 11538 11608 E CarrierServices: java.io.FileInputStream.<init>(FileInputStream.java:150)
12-31 20:51:59.580 11538 11608 E CarrierServices: android.app.ContextImpl.openFileInput(ContextImpl.java:527)
12-31 20:51:59.580 11538 11608 E CarrierServices: android.content.ContextWrapper.openFileInput(ContextWrapper.java:195)
12-31 20:51:59.580 11538 11608 E CarrierServices: com.google.android.ims.rcsmigration.d.getFile(SourceFile:20)
12-31 20:51:59.580 11538 11608 E CarrierServices: com.google.android.apps.messaging.rcsmigration.RcsStateProvider.buildRcsState(SourceFile:135)
12-31 20:51:59.580 11538 11608 E CarrierServices: com.google.android.apps.messaging.rcsmigration.RcsStateProvider.getRcsState(SourceFile:5)
12-31 20:51:59.580 11538 11608 E CarrierServices: com.google.android.ims.rcsmigration.IRcsStateProvider$Stub.onTransact(SourceFile:13)
12-31 20:51:59.580 11538 11608 E CarrierServices: android.os.Binder.execTransact(Binder.java:697)
12-31 20:51:59.614 11289 11289 E WindowSearchConfig: package not found com.android.browser
12-31 20:52:00.015 12245 12245 E 获取移动数据网络状态: 获取移动数据网络状态
12-31 20:52:00.050 11538 11550 E CarrierServices: [1563] d.getFile: File not found.: /data/user/0/com.google.android.apps.messaging/files/httpft_pending (No such file or directory)
12-31 20:52:00.050 11538 11550 E CarrierServices: java.io.FileInputStream.open0(Native Method)
12-31 20:52:00.050 11538 11550 E CarrierServices: java.io.FileInputStream.open(FileInputStream.java:200)
12-31 20:52:00.050 11538 11550 E CarrierServices: java.io.FileInputStream.<init>(FileInputStream.java:150)
12-31 20:52:00.050 11538 11550 E CarrierServices: android.app.ContextImpl.openFileInput(ContextImpl.java:527)
12-31 20:52:00.050 11538 11550 E CarrierServices: android.content.ContextWrapper.openFileInput(ContextWrapper.java:195)
12-31 20:52:00.050 11538 11550 E CarrierServices: com.google.android.ims.rcsmigration.d.getFile(SourceFile:20)
12-31 20:52:00.050 11538 11550 E CarrierServices: com.google.android.apps.messaging.rcsmigration.RcsStateProvider.buildRcsState(SourceFile:135)
12-31 20:52:00.050 11538 11550 E CarrierServices: com.google.android.apps.messaging.rcsmigration.RcsStateProvider.getRcsState(SourceFile:5)
12-31 20:52:00.050 11538 11550 E CarrierServices: com.google.android.ims.rcsmigration.IRcsStateProvider$Stub.onTransact(SourceFile:13)
12-31 20:52:00.050 11538 11550 E CarrierServices: android.os.Binder.execTransact(Binder.java:697)

12-31 20:52:00.299  4921  5653 E Avrcp   : play status change 2➡1 mPlayStatusChangedNT: 1
12-31 20:52:00.299  4921  5653 E bt_btif : register_notification_rsp: Avrcp device is not connected, handle: 0x0

12-31 20:52:20.924  4921  5653 E Avrcp   : play status change 1➡2 mPlayStatusChangedNT: 1
12-31 20:52:20.924  4921  5653 E bt_btif : register_notification_rsp: Avrcp device is not connected, handle: 0x0
12-31 20:52:20.984  4921  5653 E Avrcp   : play status change 2➡1 mPlayStatusChangedNT: 1
12-31 20:52:20.984  4921  5653 E bt_btif : register_notification_rsp: Avrcp device is not connected, handle: 0x0

12-31 20:52:22.569 15251 15284 I [Monkey]: timer: 0 volume: 0.7 channel: 1
12-31 20:52:22.570 15251 15284 I [Monkey]: timer: 0 volume: 0.7 channel: 2

12-31 20:52:24.762  4921  5653 E Avrcp   : play status change 1➡2 mPlayStatusChangedNT: 1
12-31 20:52:24.762  4921  5653 E bt_btif : register_notification_rsp: Avrcp device is not connected, handle: 0x0
12-31 20:52:24.822  4921  5653 E Avrcp   : play status change 2➡1 mPlayStatusChangedNT: 1
12-31 20:52:24.822  4921  5653 E bt_btif : register_notification_rsp: Avrcp device is not connected, handle: 0x0

12-31 20:52:25.964 15251 15284 I [Monkey]: timer: 0 volume: 0.7 channel: 3
12-31 20:52:25.983 15251 15284 I [Monkey]: timer: 0 volume: 0.7 channel: 4
12-31 20:52:26.147 15251 15284 I [Monkey]: timer: 0 volume: 0.7 channel: 5
.. (snipped)
12-31 20:52:29.365 15251 15284 I [Monkey]: timer: 0 volume: 0.7 channel: 24
12-31 20:52:29.531 15251 15284 I [Monkey]: timer: 0 volume: 0.7 channel: 25
12-31 20:52:29.567 15251 15284 I [Monkey]: timer: 150 volume: 0.7 channel: 1

--------- beginning of crash
12-31 20:53:26.002 15991 16018 E AndroidRuntime: FATAL EXCEPTION: GLThread 747
12-31 20:53:26.002 15991 16018 E AndroidRuntime: Process: com.blackjet.Spacewhale, PID: 15991
12-31 20:53:26.002 15991 16018 E AndroidRuntime: java.lang.Error: PlaySample failed to play sound
12-31 20:53:26.002 15991 16018 E AndroidRuntime: at com.blackjet.Spacewhale.gxtkAudio.PlaySample(MonkeyGame.java:2551)
12-31 20:53:26.002 15991 16018 E AndroidRuntime: at com.blackjet.Spacewhale.bb_audio.g_PlaySound(MonkeyGame.java:20772)
12-31 20:53:26.002 15991 16018 E AndroidRuntime: at com.blackjet.Spacewhale.c_Audio.p_Update3(MonkeyGame.java:13075)
12-31 20:53:26.002 15991 16018 E AndroidRuntime: at com.blackjet.Spacewhale.c_Boss.p_Update14(MonkeyGame.java:19553)
12-31 20:53:26.002 15991 16018 E AndroidRuntime: at com.blackjet.Spacewhale.c_SpaceWhale.p_OnUpdate(MonkeyGame.java:8643)
12-31 20:53:26.002 15991 16018 E AndroidRuntime: at com.blackjet.Spacewhale.c_GameDelegate.UpdateGame(MonkeyGame.java:10402)
12-31 20:53:26.002 15991 16018 E AndroidRuntime: at com.blackjet.Spacewhale.BBGame.UpdateGame(MonkeyGame.java:595)
12-31 20:53:26.002 15991 16018 E AndroidRuntime: at com.blackjet.Spacewhale.BBAndroidGame.UpdateGame(MonkeyGame.java:1266)
12-31 20:53:26.002 15991 16018 E AndroidRuntime: at com.blackjet.Spacewhale.BBAndroidGame.onDrawFrame(MonkeyGame.java:1333)
12-31 20:53:26.002 15991 16018 E AndroidRuntime: at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1571)
12-31 20:53:26.002 15991 16018 E AndroidRuntime: at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1270)
12-31 20:53:26.288  4921  5653 E Avrcp   : play status change 1➡2 mPlayStatusChangedNT: 1
12-31 20:53:26.288  4921  5653 E bt_btif : register_notification_rsp: Avrcp device is not connected, handle: 0x0
12-31 20:53:26.354 11289 11289 E WindowSearchConfig: package not found com.opera.browser
12-31 20:53:26.361 11289 11289 E WindowSearchConfig: package not found com.opera.mini.native
12-31 20:53:26.391 11289 11289 E WindowSearchConfig: package not found com.chrome.beta
12-31 20:53:26.403 11289 11289 E WindowSearchConfig: package not found com.amazon.cloud9
12-31 20:53:26.415 11289 11289 E WindowSearchConfig: package not found com.sec.android.app.sbrowser
12-31 20:53:26.424 11289 11289 E WindowSearchConfig: package not found com.android.browser


Towards the bottom of that debug, you will see monkey spit out the print dialog I said it should, ie the timer, volume and channel (this is simply so I could test when it is meant to play the sound and what channel to ensure channel cycling. But then at the bottom you see if crash with the "AndroidRuntime: java.lang.Error: PlaySample failed to play sound".

As said before this ONLY happens on Android 8.x.x.

After spending 9 hours today trying to get this working and still being nowhere closer, I had the idea of of using the version number of Android to maybe stop it from playing audio and music together or something, but I'm not sure yet simply because I have no idea what is causing it! It happens randomly., Sometimes the game just works fine. Sometimes it crashes after being in the game state for a few seconds. Sometimes it crashes on the menu. (see vid below)
Soon as you disable audio sfx in the game though, it plays perfectly fine.

Could someone give me a gun so I can shoot myself :)

PS. Long story short: Some of the debug stuff you may see above is possibly caused because I'm using remote adb to connect to my phone via adb connect ip:port and the phone seems to spit out a lot of red text which doesn't appear to be related to anything about my game; just the phone being on!

I'll add some dropbox links of it running on my tablet and on my phone shortly:
Link for it playing perfectly on my Lollipop Android tablet: https://www.dropbox.com/s/npr35pdhimogci4/VID_20171231_214441.mp4?dl=0
Link for it playing haphazardly on Nexus 6P Android Oreo: https://www.dropbox.com/s/o0njpvmvupuoekb/VID_20171231_215159.mp4?dl=0
Retro gaming fan and maker sometimes...

Offline therevills

  • Hero Member
  • *****
  • Posts: 613
Re: Need help before I go insane.
« Reply #1 on: December 31, 2017, 10:30:51 PM »
Could you try using ogg instead of wav files?

Offline jvdw007

  • Jr. Member
  • **
  • Posts: 30
    • Blackjet Games
Re: Need help before I go insane.
« Reply #2 on: December 31, 2017, 10:37:05 PM »
Could you try using ogg instead of wav files?

I do actually. I have a section in the top of the game code as such:

Code: [Select]
#If TARGET = "html5" Or TARGET= "glfw" Or TARGET = "android" Or TARGET = "ouya" Or TARGET = "gamestick"
Import "sound/ogg/ambient01.ogg"
Import "sound/ogg/ambient01_slow.ogg"
Import "sound/ogg/ambient02.ogg"
Import "sound/ogg/ambient02_slow.ogg"
Import "sound/ogg/ambient03.ogg"
Import "sound/ogg/ambient03_slow.ogg"

etc..

As well as for the music:
Code: [Select]
#If TARGET = "html5" Or TARGET = "glfw" Or TARGET = "android" Or TARGET = "ouya" Or TARGET = "gamestick"
Import "music/ogg/boss.ogg"
Import "music/ogg/complete.ogg"
Import "music/ogg/game-over.ogg"
Import "music/ogg/level1.ogg"
Import "music/ogg/menu.ogg"
Import "music/ogg/ship-select.ogg"
#End

And then further still:
Code: [Select]
#If TARGET = "html5" Or TARGET = "glfw" Or TARGET = "android" Or TARGET = "ouya" Or TARGET = "gamestick"
menuSounds = [LoadSound("move.ogg"), LoadSound("select.ogg")]
      snd_shoot = [LoadSound("shoot01.ogg"), LoadSound("shoot01_slow.ogg"), LoadSound("shoot02.ogg"), LoadSound("shoot02_slow.ogg"), LoadSound("shoot03.ogg"), LoadSound("shoot03_slow.ogg"),
LoadSound("shoot04.ogg"), LoadSound("shoot04_slow.ogg"), LoadSound("shoot05.ogg"), LoadSound("shoot05_slow.ogg")]

etc...

Ps. Happy new year to everybody! I'm the only sad git working on my game on new year's eve hoho.

PPS. Steve, I like your "Get to da choppa" game you're working on! :)
Retro gaming fan and maker sometimes...

Offline jvdw007

  • Jr. Member
  • **
  • Posts: 30
    • Blackjet Games
Re: Need help before I go insane.
« Reply #3 on: December 31, 2017, 10:59:27 PM »
I looked at some stats here for Android version distribution https://en.wikipedia.org/wiki/Android_version_history

Seems Android 8.x is barely even registered so perhaps for this game I don't need to worry about the issue. Perhaps I'll just disable sound if you're running 8.x.
For my next game I guess I can approach the audio and the way I dev differently and hopefully not even have this problem.
Retro gaming fan and maker sometimes...

Offline therevills

  • Hero Member
  • *****
  • Posts: 613
Re: Need help before I go insane.
« Reply #4 on: December 31, 2017, 11:38:41 PM »
Hmmm... its strange is your video for v8 looks like it sometimes works. This error does ring a bell with me though...

Could you try wrapping your PlaySound command:

Code: [Select]
Method Update:Void(timer:Int = 0, volume:Float = 1)
For Local i := Eachin audioList
If i.timer = 0 Or timer >= i.timer - 2 Or i.timer < timer
If theChannel > endChannel
theChannel = startChannel
End
Print "timer: " + i.timer + " volume: " + volume + " channel: " + theChannel
If i.theSound
PlaySound(i.theSound, theChannel, 0)
Else
Print "Unable to play sound on channel " + theChannel
End
audioList.Remove i
theChannel += 1
End
Next
End

Even though Android v8 is barely used at them moment its best to get it not to crash as the users WILL leave 1 star reviews!

Your game looks very cool!

Offline jvdw007

  • Jr. Member
  • **
  • Posts: 30
    • Blackjet Games
Re: Need help before I go insane.
« Reply #5 on: December 31, 2017, 11:42:47 PM »
Thanks Steve!

I didn't know you could "wrap" the sound by doing if i.theSound.  Interesting, I'll try that now. Btw, it seems those red errors are indeed useful. I grabbed a bit and googled it, and it seems to be a v8 issue: https://forum.xda-developers.com/nexus-6p/help/lots-linuxqmiqmuxiowakelock-t3668744

I'll let you know how your tip goes..

Nope, didnt work :(

It loaded and worked great first time and I though you solved it, then I quit and reloaded the game again and it bombed :(
For now I'll just disable audio for V8 as I cannot see a way to solve this problem as it seems to be a V8 specific issue as mentioned in the above url.

===UPDATE===
Ok, so I'm not quite sure how/why this works, but I found a working solution. I think the reason it works is because it's checking both for v8 of android and the if i.theSound check, because it doesn't seem to play the robot voices, nor player bullets, but plays other sounds like enemy hits, drops, explosions etc etc. Though sometimes some of those don't play either, hence why I think the combo above seems to solve it on V8.
Better to have most audio fx working than none at all for now!

Code: [Select]
      Method Update:Void(AndroidVersion:String, timer:Int = 0, volume:Float = 1)
For Local i := Eachin audioList
If i.timer = 0 Or timer >= i.timer - 2 Or i.timer < timer
If theChannel > endChannel
theChannel = startChannel
End
'Print "timer: " + i.timer + " volume: " + volume + " channel: " + theChannel
If Not AndroidVersion.StartsWith("8")
If i.theSound
PlaySound(i.theSound, theChannel, 0)
Else
Print "Error playing on channel " + theChannel
End
End
audioList.Remove i
theChannel += 1
End
Next
End
Retro gaming fan and maker sometimes...

Offline therevills

  • Hero Member
  • *****
  • Posts: 613
Re: Need help before I go insane.
« Reply #6 on: January 01, 2018, 12:48:32 AM »
Something must be very off as your "If Not AndroidVersion.StartsWith("8")" statement should stop all sounds from playing on v8  :o

Offline jvdw007

  • Jr. Member
  • **
  • Posts: 30
    • Blackjet Games
Re: Need help before I go insane.
« Reply #7 on: January 01, 2018, 01:15:27 PM »
Something must be very off as your "If Not AndroidVersion.StartsWith("8")" statement should stop all sounds from playing on v8  :o

Yeah I have no friggin idea! I expected no audio either obviously. I suspect the generated java code from Monkey and the code running on V8 may be a little fiddly/hacky/wobbly hohoho.

I confirmed that the audio works as explained before on 3 seperate V8 devices, so I know it's not just on my phone! :)

Still weird though.

Thanks for your help/suggestions though!
Retro gaming fan and maker sometimes...

Offline Derron

  • Hero Member
  • *****
  • Posts: 3271
Re: Need help before I go insane.
« Reply #8 on: January 01, 2018, 06:43:30 PM »
Not working "from time to time" most often means you have a race condition for ressources.


Means: sometimes resource A is loaded when accessing it (threads!) and sometimes not. Your logcat entry tells that it fails to play sound ... so either the handle is invalid or the system is borked up -  I assume its the handle.
Therevills already tried to tackle it - but maybe you need to check for some more stuff - or wrap things in "try except"-blocks to catch errors (if something throws some bits).




bye
Ron

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal