jgabaut / helapordo

A roguelike terminal game, using ncurses.
https://jgabaut.github.io/helapordo-docs
GNU General Public License v3.0
15 stars 0 forks source link

[FEATURE] In game sound #90

Open khushal-banks opened 2 months ago

khushal-banks commented 2 months ago

Is your feature request related to a problem? Please describe. I want to hear game start/over sound, fight started sound like X vs Y, in fight sounds (dhishum-dhishum), kill sound like KO, character sounds etc

*Describe the solution you'd like If possible please add pre-recorded sounds and play them in-game at suitable/synchronus time

Describe alternatives you've considered Nothing considered. If not possible i would play music on my device and enjoy that instead.

Additional context Pretty much every game has sounds. They are useful in engaging audience and attract their attraction. It would be lovely if helapordo could have this inbuilt or using a third-party tool like mpv cli-player or vlc cli-player

What are your thoughts on this? Close this whenever you see fit.

Thank you for helapordo.

jgabaut commented 2 months ago

Additional context Pretty much every game has sounds. They are useful in engaging audience and attract their attraction.

Yeah, I guess, but pretty much every game is not running inside a terminal. This is a project of passion that does not have that much bulk when it comes to logic code. Most of the resulting binary space is made up of the animation encoding, which will be updated gradually.

I did a quick check on miniaudio to see how big the single-header lib would be.

$ wc -l miniaudio.h 
92621 miniaudio.h

While this is not a problem per-se, to me it seems supporting sound in any capacity (I don't know if miniaudio would actually suit this use case) needs a lot of support code that I'm simply not willing to pull in right now.

It would be lovely if helapordo could have this inbuilt or using a third-party tool like mpv cli-player or vlc cli-player

I don't know about using a third party tool. You mean attaching a child process running a headless vlc or something?

If it can be made optional end doesn't end up being a nightmare to support and mantain, it sounds interesting. I'm very reluctant to the idea but I want to hear what you were referring to.

Describe alternatives you've considered Nothing considered. If not possible i would play music on my device and enjoy that instead.

This sounds kinda funny. I don't know if you were being serious, that's alright in both cases. :smile:

What are your thoughts on this? Close this whenever you see fit.

In general, I don't really think this will be done soon but it is 100% a nice would-be addition to the ncurses build. As for the raylib build, there's raudio which will make this integration much easier (and definitely planned).

If you want to try taking a stab at this, you may expand your ideas. If you have questions, you're welcome to ask.

I think the issue should stay open, since even the raylib build still has no sounds (not that it has anything else of value).

khushal-banks commented 2 months ago

I don't know about using a third party tool. You mean attaching a child process running a headless vlc or something?

If it can be made optional end doesn't end up being a nightmare to support and mantain, it sounds interesting.

If you are open to this and once you finalize the sound files that you want to use, then; let's create a new branch where you initially add calls to empty functions to play selected sounds. As, only one sound can be played at a time. It would be best if we create separate thread which would in an infinite loop will wait for events from queue.

Queue event be:

Commands:

jgabaut commented 2 months ago
* Using something like [aplay](https://www.geeksforgeeks.org/aplay-command-in-linux-with-examples/) seems like a great fit.

Maybe, I will have to look into the interface for this.

If you are open to this and once you finalize the sound files that you want to use, then; let's create a new branch where you initially add calls to empty functions to play selected sounds. [...]

This is interesting but clearly needs sound (pun intended) internal definitions of what's going on, to be mantainable.

I will have to put this on hold for a while, since the current minor release is already quite burdened and it's the longest break since last minor ever.

I'm gonna try to include some new developments on this on an upcoming dev cycle, but for now I'd just keep the issue open. If you prefer it, I may close as not planned and reopen when the time is right.