Inside3D!
     

Wanted: Engine hacking Guru to program a 'SkinBlind' effect

 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> Engine Programming
View previous topic :: View next topic  
Author Message
OneManClan



Joined: 28 Feb 2009
Posts: 62

PostPosted: Sat May 09, 2009 5:46 am    Post subject: Wanted: Engine hacking Guru to program a 'SkinBlind' effect Reply with quote

Hi Guys,

I've been stunned and surprised at the amazing talent on this forum; guys who it seems can do anything! And effortlessly!?! MauveBib has already coded two amazing creations (HolyChap, and the SmokeGrenade) which I am honoured to have featured in my weekly game [AD BREAK: Weekly AGR Session, every Sunday, 22:00 GMT, tastyspleen.net:26666, Q1 Custom TF Mania!!]... um, er ..where was I, ah yes, the request:

I have a request which I hesitate to ask for, because the CustomTF programmers have already referred to it as an 'annoying' hack, and refused to tackle it, because it also requires server coding, ie in C.

Here's the concept:
Whilst affected by the (hallucinogenic) Gas Grenade, affected players can't distinguish teammates from the enemy. They see all other players with the Quakeguy skin. The effect lessens in intensity as the gas wears off:
Code:
// SkinBlind pseudocode:
if (gassed)
     {
     int seconds_on = 6;
     int seconds_off = 1;
     while(effected by gas)
          {
          SkinBlind (seconds_on--); // player sees all skins as Quakeguys
          SkinNormal (seconds_off++);
         }
     }


Apparantly this CAN'T be done in Quake C, in the .dat, because there's no way to make one player see a different set of skin to another player, and the only way to do this is with a server hack. I've been told that "there's basically nowhere in the code that deals specifically with updating skin and color changes on the server side." CustomTF runs on the server cpqwsv.exe, which can be downloaded here. I've had a look at sc_user.c (where I assume the SkinBlind code would go) and the fact is, I'm far too newbie to even dare *attempt* it.

Anyway, I don't know how long it would take a REAL programmer to code, but I've already been stunned at how easy some things are for a Guru, so I have no idea whether it would take minutes, hours, or days to code. I'm hoping that either:

1. The CustomTF guys are exaggerating, and it's not so tough.

2. There's an easier way, which no-ones yet thought of.

3. Maybe someone here WANTS a 'challenge'!! Smile

4. (off the top of my head) I'm told that MVDSV can do this, but am assuming that 'porting' CustomTF to MVDSV is not an option... though being able to record entire games would be absolutely BRILLIANT!

So there it is. This is one of my last 'dream' changes to AGR CustomTF and hopefully, not as 'difficult' as I've been told. If there's anyone out there who wants to make the 'SkinBlind' effect a reality, that would be brilliant.

Thanks guys,

(fingers crossed!!)

Smile


OneManClan
ps. Bear in mind that, apart from Thunderwalker, AGR is the only Quake1 mod I know with organised matches, and an active, growing fanbase, so your work WILL appreciated by heaps of people every week, and your place in Quake history will be assured. Smile


Last edited by OneManClan on Wed May 20, 2009 3:54 am; edited 5 times in total
Back to top
View user's profile Send private message
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Sat May 09, 2009 11:35 am    Post subject: Reply with quote

quakeworld clients use the skin userinfo key to choose which skin to use on any given other player.
And this can be faked via QC, without depending on any extensions.
In fact its no less practical to do that in qc than than in c.

Code:

#define svc_setinfo         51      // setinfo on a client

local entity e;
local float n;

msg_entity = self;
while (n < 32)
{
 n = n+1;
 e = nextent(e);
 if (e.classname == "") //only if the player is actually valid
  continue;
 if (e == self) //only if the other player is not ourself.
  continue;
 writebyte(MSG_ONE, svc_setinfo);
 writebyte(MSG_ONE, n-1);
 writestring(MSG_ONE, "skin");
 if (self.isgassed) //I dunno what your code is like
  writestring(MSG_ONE, "default");
 else
  writestring(MSG_ONE, ClassSkinForPlayer(e));
}


Note that if you're paranoid, you can clear out the team/bottomcolor/topcolor keys too.
Just make sure you don't spam this every frame - only send it when the player's gassed status changes.

Of course, this is binary state. There's no blending or anything going on, because that requires client changes, not server changes. With the right alpha values, and depth testing, it can be done with csqc just fine. But the majority of clients don't support that, so its really not useful to you at this time.
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
OneManClan



Joined: 28 Feb 2009
Posts: 62

PostPosted: Sun May 10, 2009 3:16 pm    Post subject: Reply with quote

[DISCLAIMER: I'm still a newbie programmer. Apologies in advance for potentially unbelievable ignorance of basic concepts]

Hey Spike,

Spike wrote:
quakeworld clients use the skin userinfo key to choose which skin to use on any given other player.
And this can be faked via QC, without depending on any extensions.
In fact its no less practical to do that in qc than than in c.



In Custom Team Fortress, if you try to change your skin by typing "setinfo skin xxx' at the console, you get kicked from the game.
[EDIT: I started off thinkinh this was Quake C code below, but it's C, right? This is meant to go somewhere in the server code..?]

Code:

#define svc_setinfo         51      // setinfo on a client

local entity e;
local float n;


/* presumably 'self' means the player, so.. since 'self' means something [i]else [/i]in the 'hallucination' part of spy.qc (where I assume this code belongs) , I have to replace 'self' with whatever entity contains the actual player, yes? */

msg_entity = self;


while (n < 32)
{
 n = n+1;
 e = nextent(e);


// ''"? why not   ->    if (e.classname == "player") ??
 if (e.classname == "") //only if the player is actually valid


// 'continue' ? Is this Quake C or C?  :?
  continue;

 if (e == self) //only if the other player is not ourself.
  continue;


 writebyte(MSG_ONE, svc_setinfo);

/* my Quake C compiler didn't like 'n-1' so I substituted another variable which had the value of (n-1). Again, it's possible I misunderstood, and this is Server Code were talking about. */
 writebyte(MSG_ONE, n-1);


// by 'skin' do you mean the actual string 'skin' or should I substitute the 'quakeguy' skin here?
 writestring(MSG_ONE, "skin");

// I replaced the following line with
// if (te.tfstate & #TFSTATE_HALLUCINATING)
// where 'te' is the player entity who is gassed.
 if (self.isgassed) //I dunno what your code is like


  writestring(MSG_ONE, "default");
 else

// Sending a function as a string? This must be C.
// U did a search and can't find a reference to this function.
// There is a:
// void(entity p) TeamFortress_SetSkin;
// in Quake C, but it cant be sent as a variable.

  writestring(MSG_ONE, ClassSkinForPlayer(e));
}


Spike wrote:
Note that if you're paranoid, you can clear out the team/bottomcolor/topcolor keys too.


You mean because the Quakeguy can have those colors, yes. I'd like him to be a standard Quakeguy with no colors... how?

Spike wrote:
Just make sure you don't spam this every frame - only send it when the player's gassed status changes.


Cool.

Now, I have NO idea what the following sentence means. Embarassed

Spike wrote:
Of course, this is binary state. There's no blending or anything going on, because that requires client changes, not server changes. With the right alpha values, and depth testing, it can be done with csqc just fine. But the majority of clients don't support that, so its really not useful to you at this time.


binary state?
blending?
alpha values?
depth testing?

Embarassed

(If these aren't relevant to the task at hand, then you don't have to explain these terms - unless you feel like it)

I'll forward your code to those less newbie than me, unless there's something obvious I've missed, in which I'd love to do this myself, especially if as you say, it doesn't require a server hack.

thanks,


OneManClan
Back to top
View user's profile Send private message
OneManClan



Joined: 28 Feb 2009
Posts: 62

PostPosted: Mon Jul 19, 2010 11:16 am    Post subject: Reply with quote

I moved my follow-up post to the QuakeC Programming section as it's not really relevant to 'Engine Programming'
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> Engine Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group