Developing with HLDJ's Interface

Discussion related to HLDJ, Steam, or gaming in general
Post Reply
Renegade
HLDJ Developer
HLDJ Developer
Posts: 1500
Joined: Sat Mar 01, 2008 2:02 pm
Contact:

Developing with HLDJ's Interface

Post by Renegade »

Part and parcel of creating a tool that acts like an in-game jukebox and file browser is to first create a rich, robust, and co-operative interface between the game (taking primary user input) and the tool running in the background. Naturally, this interface that HLDJ employs is well-suited for all kinds of applications other than just file browsers/players. Basically, the interface developed here allows the user to send commands to a listening application while never having to leave the game, AND proactively use the HL/HL2 engine to "forward" messages to your application.

As a result, I'm thinking of making HLDJ mod-able, allowing independent developers to create plug-ins that HLDJ will call when it receives a command. This will allow your tool to accept user input from the game console (without having to modify any game files), much the same way HLDJ does. This is geared towards other developers looking for a well-defined interface between the game and a program/tool they've created. If there is enough interest, I will start work on this, and if there is much interest, I may seperate and package the interface system seperately from HLDJ.
Please let me know if you're interested; post your thoughts in this topic.
montymintypie
Game DJ
Posts: 2
Joined: Wed Jan 18, 2012 6:03 am

Re: Developing with HLDJ's Interface

Post by montymintypie »

Hey, with the addition of the new sound system in TF2 making HLDJ unusable on 99% of servers, I've been looking into Virtual Audio Cable to play stuff.

Only problem, no current way of using VAC is as simple as HLDJ's interface. I can't work out how to communicate with the TF2 console (like HLDJ does), and I'm horrible at C, so I can't work out how you're doing it.

Basically, I'm looking for a way to completely copy HLDJ's interface, just with different backend commands to play the audio (in my case, most likely a small Python script). What's the best way I could go about this? Would an HLDJ interface be best, or should I make something from scratch due to the completely different systems?

Thanks in advance!
Renegade
HLDJ Developer
HLDJ Developer
Posts: 1500
Joined: Sat Mar 01, 2008 2:02 pm
Contact:

Re: Developing with HLDJ's Interface

Post by Renegade »

http://hldj.org/forums/viewtopic.php?f=3&t=949 is the best description on how to create your own HLDJ commands. Basically HLDJ communicates with the game by generating scripts on the fly. You get information/commands into the game by having it execute various scripts; you can get information/commands/user-input out of the game by having it write files and then reading those files (there are several ways of doing this; HLDJ binds command(s) to a key ("command relay key"), then calls writeconfig and scans the file that the game produced for the commands attached to that key).

naturally I'd recommend if you just want to roll your own commands it's easier to modify HLDJ. Or if you just want to play a file instead of loading it to voice_input.wav, you'd modify hldj_LoadFileIndex in hldj_api.c. There you'll notice a call to CopyFile which copies the audio file to voice_input.wav, so before that call you'd make a call to play the file instead, either using ShellExecute to launch it in the default media player or PlaySound.
montymintypie
Game DJ
Posts: 2
Joined: Wed Jan 18, 2012 6:03 am

Re: Developing with HLDJ's Interface

Post by montymintypie »

Thanks, that's just what I needed - if I get it working, am I fine to distribute the modified HLDJ?
Renegade
HLDJ Developer
HLDJ Developer
Posts: 1500
Joined: Sat Mar 01, 2008 2:02 pm
Contact:

Re: Developing with HLDJ's Interface

Post by Renegade »

yep, HLDJ is licensed under GPL (version 3) so you can modify it freely, and distribute it under the same license: http://www.gnu.org/copyleft/gpl.html
Post Reply