I'm Selfishly Bumping This
for a bit more visibility. Has anybody had the chance to have a look?
#2136 posted by Baker on 2016/06/19 01:31:23
1) Did you run the example irctest.c and test it against your irc server? What was the result and in the case of failure, the error code or response?
2) What IDE are you are using for debugging, setting breakpoints and stepping through code to look at the values of different variables and checking function results?
The library you are using looks like it requires at least an intermediate understanding of C to be able to use it since it uses callbacks, but if you are able to run the irctest.c successfully you might be able to successfully break it into pieces as-is and put it in the appropriate places.
Hey Baker.
Thanks for the response.
So I was using just a text editor without using an IDE. In hindsight that was a terrible idea, so I've installed codeblocks as that is the project file that is included with quakespasm. So far the debugging tools look pretty reasonable.
Strangely the example executable doesn't work for me at all, they aren't even recognising the inputs from the console... weird.
Unfortunately the irctest application isn't ideal as it uses a loop function that freezes quake. It doesn't exit the loop once it has entered it. Instead the documentation suggests a select loop which I've added to my code.
The problem is way before that though, the select loop doesn't even get the chance to run, as it only does that once the connection is completed, whereas the app makes a connection, but refuses to keep alive. My IRC server spits back a timeout error.
I'll keep digging with the debugger, if you have any ideas I'd love to hear them.
#2138 posted by Baker on 2016/06/19 21:00:07
You should get the irctest example working before trying to integrate it into Quakespasm, otherwise you can't be sure you are dealing with a working model.
Btw, your code in Host_Frame will trying ro connect over and over and over again but you may know this.
Yes, the sample code isn't ideal for Quake, because of the design of the loop but the first phase of anything is making sure what you've got actually works.
Taking shortcuts in coding and not doing things proper just leads to massive headaches, so you really need to get the sample working first to verify what you have will even work.
Shamblernaut
#2139 posted by ericw on 2016/06/19 21:22:47
Got the code compiling on OS X after a bit of fighting with the libircclient configure/makefile.
I think one issue is: if IRC_Connect_f is called with `irc_connect_bool` false, the irc_session variable will be an uninitialized pointer; then this line: "if (irc_is_connected(irc_session) == 0)" will access the bogus pointer, which should crash.
I think maybe you want irc_session to be static?
AddressSanitizer in clang/Xcode will catch this kind of thing; MSVC and recent versions of gcc also have similar functionality, I think.
Shamblernaut
#2140 posted by szo on 2016/06/20 10:15:07
For the record, the mainstream libircclient code
at sourceforge.net is at version 1.9, as opposed
to the old fork at github being back at 1.6:
https://sourceforge.net/projects/libircclient/
Changing Music Playback?
#2141 posted by aDaya on 2016/06/20 10:22:40
So I've been thinking: the game's original code should mention going to the CD drives or the music, so is it possible to reroute the path from the CD drives to a custom one inside one of my mod's directory?
If yes, how can I do it?
I'd like to do that mostly so custom music can be done without dealing with engine-specific music playbacks, like Doom or UT.
#2142 posted by Baker on 2016/06/20 12:46:05
Quake has support for a CD --- like an actual CD that plays in a 1990s CD player stored in the CDDA format.
https://en.wikipedia.org/wiki/Compact_Disc_Digital_Audio
Think of the answer as basically no, but if you were really, really determined and had a thing for fiddling with hex editors and old software maybe you could do it, like the guy who made Windows 95 run on his Apple Watch.
Daya
#2143 posted by Kinn on 2016/06/20 13:05:38
Are you talking about tricking a quake engine into reading the "cd data" from a location that's not the cd drive, without modifying the engine?
I don't have a scooby doo how you'd do it, but just wondered if that's what you're asking.
@szo
thanks for the heads up, I had version 1.8, I linked the wrong version.
however, in the change notes in 1.9 from 1.8
"Fixed an error if the TCP connection to the IRC server couldn't be established under 250ms."
Kinn
#2145 posted by aDaya on 2016/06/21 00:46:07
That's it basically.
If I can't do that however I can still have a workaround but it would only works for darkplaces and quakespasm/fitzquake, and including custom music would be tricky since you can only put track numbers.
But if there's a way to make quake play properly named music tracks even if it still looks for the CD location that would be great.
@Daya
#2146 posted by Spike on 2016/06/21 05:02:38
sorry for the mindless babble...
cd audio is handled by both engine AND the gamecode, which is not a happy combination - the engine can't use track names because the mod will somewhat stomp over it, and the mod can't use names because there's no standard way to actually do that (and would still get nuked on each map change).
so we're stuck with the server changing tracks on map changes, and maps+mods only using 0-255 values for track numbers.
despite CDs being mostly irrelevant now, dp+fte both still retain the cd command, with a distinction made between numeric and non-numeric tracks.
'cd play 5' plays track 5, but 'cd play omgwtf.ogg' plays the named file instead of a numbered one. this also works with 'cd loop foo' too, of course.
The coolest thing about this is that the following command works too:
cd remap TRACKNUMBER TRACKFILENAME
which is just great for remapping a track number to a named file (just don't expect it to change anything until the track is next changed). This can be great for config files.
the catch is that you're still fighting the svc_cdtrack that the server sends when you first connect, yay race conditions.
anyway, set world.sounds=0 inside worldspawn so that any cd tracks the server sends will be ignored and not give hideousness, and then send a 'cd loop foo' stuffcmd, or a 'music foo' stuffcmd to make quakespasm happy, while fte is happy with either (I'm too lazy to comment on other engines).
That way, you get full control over what is actually played.
Spike
#2147 posted by aDaya on 2016/06/21 11:17:57
"'cd play 5' plays track 5, but 'cd play omgwtf.ogg' plays the named file instead of a numbered one. this also works with 'cd loop foo' too, of course. "
So what you're saying is, I can have a music track named "woah.ogg" and have in worldspawn's sounds line "woah" and it would play it on both Quakespasm/Fitzquake and Darkplaces?
Or must I use the world.sounds=0 thing, but then how would darkplaces play custom tracks if the commannd is different there?
Thanks For The Help Everyone :)
Szo, Baker, EricW
I got it working... Now I need to polish it up :)
On Music...
What would be the best way to implement progressive music, whereby entering into a mob filled area, the music becomes faster or different "battle music" fades in? Vice versa after the battle.
I'm not building this myself, I'm just interested how one might achieve this. I reckon it would compliment the game quite well.
Would you quakec? modify engine? use custom ambient sounds and triggers?
How I've Implemented Before
#2150 posted by ijed on 2016/06/22 19:17:32
Is to have two pieces of music playing at once and crossfade their volumes linked to another variable - usually something simple like player % health.
Both of the pieces of music work in theory when played at full volume together, but won't sound too good. The idea is that one piece is the 'action' music and the other the 'calm'.
Action starts at 0 volume and calm at 1 (full). As the player health drops and rises you switch the volumes - the lower their health, the higher the volume of the action music.
Never done this in Quake, although it wouldn't be difficult - could be done purely in qc, although you'd need to do some proper music editing using midis to turn off/on instruments and get the two identically sequenced but different sounding tracks.
That Is
#2151 posted by ijed on 2016/06/22 19:18:44
The lower the player health, the higher the volume of the action music and the lower the volume of the calm music.
Interesting
I guess that's how the heartbeats work in some games too, except with volume and speed.
Hmm
The variable I would use would be the quantity of mobs that have the player targeted as their enemy.
Or even total mob health as a percentage.
Probably with some kind of distance from player function as well. So that if you leave a single mob behind you won't constantly have battle music playing.
#2154 posted by Kinn on 2016/06/22 20:08:16
/is playing oblivion
/a small crab emerges from a pond 25 yards away
EPIC BATTLE MUSIC
@shamblernaut
#2155 posted by Baker on 2016/06/23 03:31:07
Nice to see you got your modification working.
#2156 posted by Baker on 2016/06/23 03:40:59
Probably with some kind of distance from player function as well.
Shamblernaut walks over a bridge. There are fish below.
Combat music ensues.
Shamblernaut finishes crosses the bridge. Combat music wanes.
Close call! Major skirmish averted!
do rottfish target the player out of the water?
Rotfish
#2158 posted by Preach on 2016/06/23 08:40:18
Monsters in Quake can't trace line-of-sight through water by default. wateralpha didn't exist in the original Quake. Preventing fish from alerting on players they can't attack is the main reason not to alter this behaviour.
ijed: There's a bit of a challenge in Quake that you can't modify the volume of a sound while it is playing. You'd have to build some kind of drum machine/sequencer in QuakeC and manually repeat the samples at different volumes - maybe like the procedural music in Left 4 Dead. I worry that variations in the frame rate would make that a bit wobbly.
Related joke: How do you know a drummer is knocking at your door? A: He speeds up
Forgot About That :)
#2159 posted by ijed on 2016/06/23 14:50:24
Constructing it by hand would allow you to do the knocking drummer effect though - upping the tempo as well as or instead of the sound volume changeover.
And there's always the classic HL1 method - ambient sounds only, and whenever a big fight starts play a short, scripted, one shot piece of music.
|