Interactive Music: Client Only Events Please


(Spankey666) #1

Hi everyone - new to this form so please go easy on me if this is obvious, but I have spent ALL day (since 5am:mad:) working on this and have gotten nowhere.

I have made a music system (dll) that is intended to connect to any game. I have successfully plugged it into Wolf:ET but only when it runs as a server. It runs from game events and evolves the music based on whats events are sent out. For example:


//----------g_clients.c------------
void SetWolfSpawnWeapons(...) {
...
IMS_PostEvent(eClassMedic, 0.0,0.0);
...}

//-----------g_cmds.c-------------
void ClientCommand(...) {
...
IMS_PostEvent(eWeaponFired, 1.0,0.0);
...
}

It all works great when I run it as standalone server, but im trying to make a fraps vid of it and I dont want to look like a billy no mates with no other players (no one joins my servers).

What i’d like to do is have one of my PCs running some Bot mod as a pure server. Then my other PC as a client (with working music) connect to that server and have it all work.

When I try to move this code over to any client only sided code (cg_event.c - cg_main.c - cg_playerstate.c) none of them works. Can anyone shed some light on how the whole client-server thing works? I mean - is my local client binary (cgame_mp_x86.dll) even used when I connect to a server? And if so - where would be a good place to insert my event triggers?

Any and all help very much appreciated. I’m going nuts here trying to sort this thing out. Also - i’ll make this music system public if and when it works

Spankey


(dutchmeat) #2

Hello spankey, welcome to the board.

One of the best references I could recommend is Code3Arena. This article is about the QVM(quake virtual machine, which eventually became dynamic libraries, like cgame_mp.x86 in W:ET):
http://code3arena.planetquake.gamespy.com/articles/article9.shtml

Also, if you’re willing to share this music system, then we could determine what the best place is to call certain functions(IF POSSIBLE!).


(Spankey666) #3

Thanks for that link Dutchmeat. I think I will start by trying to add some client console commands to start and stop the music engine, then go from there.

I’ve put a little video of how it currently works with on my site - all events and commands are server only at the moment:
http://www.marcuswilkinson.com/index.php?page=ims

I am definately willing to share the engine! It can be customised from text files and you can add your own music as you like. If i get enough interest I will make it a bit more accessable (write a guide, put the whole thing up for download etc). Any advice as to where to put certain events (on the client side) would be greately appreciated!

Basically my engine only has 3 functions:
start,
stop,
send event.

The events are basically anything that should change the mood of the game. e.g. firing weapon. getting shot, drowning etc. Events can also have an intensity so the distance to enemy could effect the music (make it more tense).

The events i have at the moment are:

	eTimeRemaining=0,
	eEnemyRange=1,
	eFriendlyRange=2,
	eClassObjectiveRange=3,
	eTeamObjectiveRange=4,
	eWeaponFired=5,
	eEnemyInjured=6,
	eFriendlyWeaponFired=7,
	eFriendlyWeaponImpact=8,
	eEnemyWeaponFired=9,
	eEnemyWeaponImpact=10,
	eHealthChange=11,
	eFriendlyCovertOpsSpottedLandmine=12,
	eFriendlyEngineerPlantedLandmine=13,
	eFriendlyCovertOpsStolenUniform=14,
	eFriendlyUndercoverCovertOpsRevealed=15,
	eFriendlyEngineerPlantedDynamite=16,
	eFriendlyEngineerConstructedBuilding=17,
	eFriendlyEngineerDiffusedLandmine=18,
	eFriendlyPlayerRevived=19,
	eFriendlyMedicDropMedipack=20,
	eFriendlyFieldOpsDropAmmoPack=21,
	eFriendlyFieldOpsArtilleryStrike=22,
	eFriendlyFieldOpsAirStrike=23,
	ePromotion=24,
	eSpawn=25,
	eDeath=26,
	eTeamMateDeath=27,
	eFriendlySpawn=28,
	eClassSoldier=29,
	eClassMedic=30,
	eClassEngineer=31,
	eClassFieldOps=32,
	eClassCovertOps=33,
	eTranquillity=34,
	eUrgency=35,
	eDensity=36,
	eStealth=37,

(dutchmeat) #4

That video and POC looks very interesting, I would like to see this in our Wolfenstein: Vampire mod. Care to join?


(Spankey666) #5

Sounds good - although I cant put too much work in right now, you can certainly add my engine to your dist and I will help you customise it. Even make some tracks for you if u like. How far along are you guys with this mod?

I looked through that guide you gave me, and still had no joy. I tried adding my own functions to both UI and CG areas of the projects. It doesnt seem to work.

Any suggestions where to put my code?


(dutchmeat) #6

Well, since it’s going to be a client who’s playing the sounds(asuming it’s downloaded/installed on the local machine), we have to place it in the cgame lib.

First we have to initialise the engine, so all sounds are preregistered. Then we have to hook your engine to the cgame events.
However, until I have taken a look at your engine, I don’t know where to put what.

you could do something like this:

CG_INIT: initialise everything here

CG_DrawActiveFrame: you could check the weaponstate here, this function is called every frame


(Rudi) #7

Whatever the hell it is you’re trying to do, do you want to make it for all mods etc.? Contact me on MSN or something… msn@rudivisser.com :wink:


(dutchmeat) #8

Not all mods are opensource, so it can’t be implented in all mods.
but it’s Spankey’s decision to make his engine opensource.


(Rudi) #9

No problem


(Spankey666) #10

Well Rudi the iGod has hinted at something that runs client side only outside of the dll’s that can also listen to game events. If this is true, I might wee myself :eek:
Stay posted… ( New IMS videos and explanation up on my site: www.marcuswilkinson.com/index.php?page=ims )