Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+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!