I almost finished my game and'm talking to the guy who's going to take care of the music (current music's copyrighted by Nintendo, so not usable). The game runs fine on my comp, and has been tested and works fine on a couple of friends' comps. Only issue I've noticed, is that it tends to crash when starting up if you're playing music.
The composer friend tried the game out, but all he gets, is a quick flash of a window, and it's gone again. It simply doesn't work for him. I have no idea what the problem may be.
Any help on figuring this out is well appreciated. I've attached the game with source and all relevant files.
Make your program log things and do more stringent error checking, and make your friend run a debug version through gdb.
Well, log and error checking... dunno how much that'd do. The moment the game starts up and initiazed Allegro, it checks if high.txt is made, and if not, it makes that. Even that's not the case for my friend, so it must be something there. My bet's at a missing DLL or so.
Edit: Made a build which pauzes after every initialization part, with command-shell output.
Okay, it stops after 'Timer installed' and this time I get the error message:
"Error initialising sound system"
"Failed to init digital sound driver"
Looking further into it... Might just be something with his comp, as he's not playing any music, but's said to have had a weird issue with his speakers earlier today.
Well, log and error checking... dunno how much that'd do.
It would let you find the error, instead of blathering nonsense about missing DLLs.
well its not a dll you seem to have every thing. I recommend getting the stats of the computer it crashed on. and test on a similar computer.
How friendly, Gnolam.
Anyways, looked further into the speaker issue.
Them: The thing is; I had this weird issue with my speakers earlier today, so it might as well be that
Me: What was that issue?
Them: They made this loud hissing sound which went away after some time
Me: That's the hardware. Shouldn't affect the software
Them: I have no clue what caused it. And I'm not sure it was (just) the hardware
Me: You can play the midi-file and hear it outside of the game, right?
Them: Yes
If he can play the midi-file and hear it outside the game, then it's not his comp, but something with the game. There's something wrong with the sound initialization there.
The code that does this, is this:
if (install_sound(DIGI_AUTODETECT, MIDI_AUTODETECT, NULL) != 0) { allegro_message("Error initialising sound system\n%s\n", allegro_error); return 1; }
i do not think log files will help in this case but they are good to have.
Edit:
If he can play the midi-file and hear it outside the game, then it's not his comp, but something with the game. There's something wrong with the sound initialization there.
nope nothing wrong with game itself you tested it on other computers. there is some thing wrong with his computers config.
Is there a way to catch the sound initialization error and get it going anyways?
Computer reboot didn't fix the issue, btw.
if (install_sound(DIGI_AUTODETECT, MIDI_AUTODETECT, NULL) != 0) { allegro_message("Error initialising sound system\n%s\n", allegro_error); return 1; }
return 1; is end the loop when the error happens tack out the return 1;
but you dont want to make any sound calls if the sound got and error at initialising.
so do some thing like this.
| 1 | |
| 2 | extern bool sound_on=true; |
| 3 | |
| 4 | if (install_sound(DIGI_AUTODETECT, MIDI_AUTODETECT, NULL) != 0) { |
| 5 | allegro_message("Error initialising sound system\n%s\n", allegro_error); |
| 6 | sound_on=false; |
| 7 | } |
| 8 | |
| 9 | //do this to all your sound calls |
| 10 | if( sound_on==true) |
| 11 | { |
| 12 | //play your museic |
| 13 | } |
| 14 | |
| 15 | if( sound_on==true) |
| 16 | { |
| 17 | //play your sample |
| 18 | } |
Alright. Thanks for the help:) We'll see if this gets the game working.
Problem's still there:-/ Time to put more checks in it to follow the flow.
Now it crashes here:
set_color_depth(16); cout << "Colour depth set\n"; system("pause"); if(set_gfx_mode( GFX_AUTODETECT_WINDOWED, SCR_WIDTH, SCR_HEIGHT, 0, 0)) exit(1);
Colour depth set is the last message he gets, so it's a problem with set_gfx_mode this time.
Bit odd that it's at another autodetect.
Edit (Nth): Ahh, problem solved. Friend was testing a friend of his' website out and had his comp in 800x600, which's also the resolution of the game. Seems like it didn't like that.
you should had something like what you had for sound allegro_message("Error initialising sound system\n%s\n", allegro_error);
So catching it and changing SCR_HEIGHT and SCR_WIDTH accordingly? Will see if I can add that:)
It all works like a charm now. Thanks alot for all the help:)