Forums » Suggestions

[lua] expand certain functionality in the gksound library

Mar 31, 2023 Luxen link
Incarnate, from another thread
We're also likely to update the actual game-engine sound-system around the same time.

Since you have some plans, any chance I could ask for these additional functions?

gksound.GetTrackLength(file_pointer)
○ Provides the millisecond length of a track. if no file is provided, uses the currently playing track

gksound.GetTrackPlayhead()
○ Returns the millisecond point of the current song

gksound.SetTrackPlayhead(number, fade_boolean)
○ Sets the playhead of the current song; optionally fade

gksound.GetCurrentTrack()
○ Returns the file name of the track currently playing

Obtaining the track length and getting or setting the playhead could allow for music that advances in stages (not sure the proper term, but Redout pulls this off wonderfully; the song advances based on the speed you're racing at); the "danger" music could get more aggressive based on number of enemies within a certain vicinity, or how much damage they have taken. The latter function would be more for verifying a track valid to the circumstances is still playing, and initiating a new file seek operation if the track is no longer valid.

I just finished making the core of a system that plays tracks described by tags relevant to the sector they should play in - for example, music/itani_battle.ogg could be selected as long as the current sector validates for "danger" and "itani_faction". Other tags could include "distant" (the player is >3km from large objects and enemies) or even "combat" (overrides danger; not only are there enemies in this sector, but they're close by and/or the player is taking damage from them). More tags and tracks can be added by other plugins freely.

The above functions aren't *neccesary* for this plugin, but making that functionality available would be nice.
Mar 31, 2023 incarnate link
Well, I don't have any problem with adding more functions?

But, none of this has anything to do with what I was talking about.. this is not related and will not come about as a byproduct of the other development.

Also, when one is creating a system to do some kind of triggered change in thematic musical queue, it's generally based on a preset change-point, to allow the music to stay consistent. If you just cross-fade to some rando jump-point, the transition may be a bit jarring (discordance, varying time signatures, etc).

Anyway, this isn't something that we would likely use internally. We've talked about adding more triggering mechanics for decades, but it probably wouldn't work like this. But, that doesn't rule out the possibility of adding some functions for plugin developers.

I cannot make any promises of particular priority, however.
Apr 01, 2023 UncleDave link
I don't know too much about how music transitions would be implemented but I am a curious lad.

My thought is that you could have several tracks for a situation that represent different levels of intensity (eg. passive, threat imminent, engaged in combat) so that they can be cross-faded into each other seamlessly on trigger, but they'd maintain the same mitre, key and harmonic pattern.
Apr 01, 2023 incarnate link
I mean, we know how to build a dynamic music system.

I was just explaining to Luxen that what he's asking for is not going to be that.