Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Ah, I had no idea. i’m using multi-config just so I can build debug or release, otherwise the main difference is the folder it builds to. It just seems that the audio is the main issue, you are getting a segfault when portaudio is initalising. I really don’t know what would cause that, I haven’t gotten that issue yet. Sorry, not sure what else I can do to help.

Thts probably explains why my directory structure ends up being slightly different. But it doesn't explain why loading the audio files gives different results and it then crashes when it attempts to actually play some music...

I added a bit of debug output and commented the exception out so it doesn't fail when loading the first file...

Loading audiodata: audio/music/Trials of The Pharaoh Gameplay1.ogg; frames: 6947987, channels: 2; sampleCount= 13895974
numread 6947904; frames 6947987
Loading audiodata: audio/music/Trials of The Pharaoh Gameplay2.ogg; frames: 5226003, channels: 2; sampleCount= 10452006
numread 5225920; frames 5226003
Loading audiodata: audio/music/Trials of The Pharaoh Gameplay4.ogg; frames: 4030355, channels: 2; sampleCount= 8060710
numread 4030272; frames 4030355
Loading audiodata: audio/music/Trials of The Pharaoh Intro.ogg; frames: 4923923, channels: 2; sampleCount= 9847846
numread 4923840; frames 4923923
...
ALSA lib pcm.c:8526:(snd_pcm_recover) underrun occurred
(+1)

It seems that libsndfile reads 83 less frames than expected every time you load a file, so when it is played there is an error as it accesses uninitalized memory.

I read over the libsndfile spec, it expects the info struct passed to sf_open to have a format value of 0. Maybe on my system it is set to zero automatically, but on yours it is uninitalized, so reads the wrong amount of frames.

if you place this line at the start of the AudioData(std::string filename) function that loads the audio:

//---snip---
AudioData(std::string filename)
{

   this->info.format = 0;  // <--- add this line

   SNDFILE* file = sf_open(filename.c_str(), SFM_READ, &this->info);
//---snip---

on my repo it would be line 35.

if that doesn’t work, here is a version of audio.h that doesn’t start portaudio or load any audio, the game is still completely playable. https://drive.google.com/file/d/1-0iQF-y4WovPo_n6aQFHmRLnNhTz-pyr/view?usp=sharing

Setting the `info.format` explicitly actually helped!

The game's running now and plays sound. I still get a lot of underrun messages from the ALSA lib though.

And some audio files seem to be different:

Loading audiodata: audio/vo/0-P2.ogg; frames: 252287, channels: 2; sampleCount= 504574
numread 252224; frames 252287
Loading audiodata: audio/vo/0-A2.ogg; frames: 212479, channels: 2; sampleCount= 424958
numread 212416; frames 212479

rounding error?

Not sure if that's correct

When I move that vertical block the angle of the ray changes so the reflected arrives a bit left or a bit right of the small scarab, but the rays emitted from it don't reflect the incoming ray's movement.

At some point I managed to get the whole level into some "semi-stable" state where it was flipping between the obstacles on and off and the ray could reach the target but not for a sufficient time to trigger the level finished... If it had been the intended solution I guess it would actually have registered the ray so I suppose that was just some edge case...

At this point it would actually be nice if there was some indication which of the levels one reached... ;)

Dispite the technical issues in getting the game running on my system (and some of them are still there, some of the VOs in the intro did not play), I love it. Especially that multi-refraction element is really cool!

(1 edit) (+1)

Wow! It’s mostly working. Thanks a lot for sticking with it, I still don’t know why some of the audio files don’t load properly (and this time it’s 63 frames too few, weird!). Now that I know what kind of problems the audio can cause on some systems, I will definitely try and make the audio playing header more robust.

Yeah, that level is probably the hardest (that isn’t the intended solution), I think there’s only 3 more levels after that. There’s a full run through of the game on the itch page for all of the solutions.

A level indicator is a good idea, I somehow didn’t think of that. The light rays still have a few issues, like the switching on/off. The reason the goal takes a few seconds to “charge” is to stop these issues being exploited to win by shining a laser over it quickly. Definitely not an elegant fix!