Skip to main content

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

I haven’t included a full dependancies list yet. It’s really two different executables, one linking to OpenGL and one linking to Vulkan. So if you want to build the vulkan version check my vulkan-environment repo for the depenancies: https://github.com/NoamZeise/Vulkan-Environment (On that repo at the bottom there is a setup with aptitude on linux, which goes over what you need to install)

After you have those, you should run cmake from a build folder in the root of this game’s repo like “cmake .. -DGFX_ENV_VULKAN=1” to setup for the vulkan version. then build the executable and put the resources folders (textures,audio,shaders,maps,dialogue) with the executable and launch.

If you have any issues, please let me know.

Not sure about vulkan, OpenGL should (generally speaking) be fine. `libvulkan` is installed, though.

I think there are some more fundamental things missing about using cmake.

(1 edit)

I can tell you exactly what I have, I’m using the ninja multiconfig buildsystem which in turn uses gcc.

in a build folder in the base of the project I run

cmake .. -G"Ninja Multi-Config" -DGFX_ENV_VULKAN=1

then I run

cmake --build . 

If there are any dependancies missing, or an issue with the code, it should show up.

I actually didn’t expect people to build it from source, so I haven’t tested it on a fresh linux install or anything, so there might be something I have installed that i’m overlooking.

So I guess I will have to install "ninja-build" for this as well first...

So I installed "ninja-build" but it's just asking for a "build.ninja" file of which there is none in the project

That’s not supplied by the project, thats generated by cmake automatically if you pass the -G”Ninja Multi-Config” arg. Let me outline the exact commands(if using a fresh clone of the repo, and in it’s root):

mkdir build
cd build
cmake .. -G"Ninja Multi-Config" -DGFX_ENV_VULKAN=1
cmake --build . --config Release

~/jam2022/NoamZeise/TrailsOfThePharaoh/build$ cmake .. -G"Ninja Multi-Config" -DGFX_ENV_VULKAN=1
CMake Error: Could not create named generator Ninja Multi-Config
(+1)

Ok I have a fresh linux install, so I now have exact build instructions that work for fresh install on the repo. I also had a problem with a certain compiler, that is fixed now, so the code has changed slightly.

https://github.com/NoamZeise/TrailsOfThePharaoh

if you check the readme, it goes over everything I did to get it working step by step. Also if you aren’t using proprietary graphics drivers the vulkan version might not work.

So... the "Vulkan" attempt didn't really work out (see other posting). Now going OpenGL.

First attempt... Well, better start with a clean "build" folder :D

Second attempt... Well, readme tells me to generate and download "glad" header files. Oh well...


So... It's more or less what the pre-build version gave me. to get portaudio I had to downgrade jackd but to run jackd I had to upgrade it again, and when I start it the game crashes with some ALSA errors. And without jackd running even before that...

ALSA lib pcm_dsnoop.c:641:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm_dmix.c:1089:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
Cannot lock down 82280346 byte memory area (Cannot allocate memory)
Cannot lock down 82280346 byte memory area (Cannot allocate memory)
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_dmix.c:1089:(snd_pcm_dmix_open) unable to open slave
Cannot lock down 82280346 byte memory area (Cannot allocate memory)
Segmentation fault (core dumped)

hm... the binary doesn't land in "builds/Release" but in "builds". if I go into "build/Release" apparently it works better (it can load textures and stuff), but is still unavle to do any sound and terminates:

failed to load audio data at audio/music/Trials of The Pharaoh Gameplay1.ogg

BTW: "Ninja Multi-Config" actually comes with with cmake 3.17 (and Ubuntu 20.04 has only 3.16... figures)

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