Displaying HUD elements across a network, possible?
Moderator: InsideQC Admins
5 posts
• Page 1 of 1
Displaying HUD elements across a network, possible?
Hi, I was just wondering if it was possible to display HUD elements on everyones screen in the game.
For example: A coop game which displays the health of the other players ingame on your screen.
How would this been done in CSQC or standard QC.
I dont think I have a problem drawing an actual HUD, it's just grabbing the player data.
Thanks
For example: A coop game which displays the health of the other players ingame on your screen.
How would this been done in CSQC or standard QC.
I dont think I have a problem drawing an actual HUD, it's just grabbing the player data.
Thanks
- evilmarshy
- Posts: 6
- Joined: Mon Aug 08, 2011 9:08 pm
Re: Displaying HUD elements across a network, possible?
evilmarshy wrote:How would this been done in CSQC or standard QC.
mmm CSQC means "client side qc", i do not know
hi, I am nahuel, I love quake and qc.
-

Nahuel - Posts: 492
- Joined: Wed Jan 12, 2011 8:42 pm
- Location: mar del plata
Re: Displaying HUD elements across a network, possible?
Nahuel wrote:evilmarshy wrote:How would this been done in CSQC or standard QC.
mmm CSQC means "client side qc", i do not know
client side qc can communicate with server side qc though.
-

ceriux - Posts: 2223
- Joined: Sat Sep 06, 2008 3:30 pm
- Location: Indiana, USA
without extensions, you can either hyjack a stat somewhere on the sbar (combine armour and health into some combined amount maybe and reuse the armour field, or replace the display for the current ammo with your team mate's health perhaps, lots of tweeking), or you can use a centerprint (which is messy and requires lots of \n to move it up and down, and needs different numbers of them and spaces for different resolutions).
With ssqc and certain extensions, you can use svc_showlmp to do it (you may still need to know their resolution in order to position it at the bottom of the screen with DP, though if you're using telejano you can use a builtin for it without caring about their resolution).
with csqc, once the extra stat field is registered (don't register the field if the server doesn't support csqc and you can avoid all compatability errors, you'll just get no teammate info), the ssqc then just copies the teammate's health into the extra field and its easy for the ssqc.
void(float num, float type, .float fld) clientstat = #232;/*builtin to register field. if the engine doesn't support csqc, don't call this, nothing else will crash a server that doesn't support it*/
.float teammatehealth;/*write to this to make it available*/
float STAT_TEAMMATESHEALTH = 32; /*custom stats should be >= 32*/
clientstat(STAT_TEAMMATESHEALTH, 3, teammatehealth); /*so csqc querying STAT_TEAMMATESHEALTH will read the replicated self.teammatehealth*/
the csqc itself can be pretty simple. A bare csqc mod with Hud_DrawLargeValue ported over from fte's svn quakec/csqctest/cs/hud.qc may be sufficient. Assuming the code asks the engine to draw the hud first, you'll get everything pretty much automatically done for you:
void(float width, float height) CSQC_UpdateView =
{
clearscene();
setviewprop(VF_DRAWCROSSHAIR, 1);
setviewprop(VF_DRAWENGINESBAR, 1);
addentities(MASK_NORMAL|MASK_ENGINE);
renderscene();
Hud_DrawLargeValue('some vector here', getstatf(STAT_TEAMMATESHEALTH), 25);
};
And that should give you a basic csqc mod that appears to do nothing other than draw an additional 'large' numerical value at some position on the screen.
Admittedly you should probably test the stat somehow so you don't draw it if you have no team mate, or use multiple stats for multiple consecutive team members, or something, you'll want to add some logic in there, no doubt, but this at least should demonstrate basic csqc usage. You should also calculate the pos to draw the string based upon the user's (virtual) screen space (first two arguments) rather than hardcoding it, but that goes without saying.
With ssqc and certain extensions, you can use svc_showlmp to do it (you may still need to know their resolution in order to position it at the bottom of the screen with DP, though if you're using telejano you can use a builtin for it without caring about their resolution).
with csqc, once the extra stat field is registered (don't register the field if the server doesn't support csqc and you can avoid all compatability errors, you'll just get no teammate info), the ssqc then just copies the teammate's health into the extra field and its easy for the ssqc.
void(float num, float type, .float fld) clientstat = #232;/*builtin to register field. if the engine doesn't support csqc, don't call this, nothing else will crash a server that doesn't support it*/
.float teammatehealth;/*write to this to make it available*/
float STAT_TEAMMATESHEALTH = 32; /*custom stats should be >= 32*/
clientstat(STAT_TEAMMATESHEALTH, 3, teammatehealth); /*so csqc querying STAT_TEAMMATESHEALTH will read the replicated self.teammatehealth*/
the csqc itself can be pretty simple. A bare csqc mod with Hud_DrawLargeValue ported over from fte's svn quakec/csqctest/cs/hud.qc may be sufficient. Assuming the code asks the engine to draw the hud first, you'll get everything pretty much automatically done for you:
void(float width, float height) CSQC_UpdateView =
{
clearscene();
setviewprop(VF_DRAWCROSSHAIR, 1);
setviewprop(VF_DRAWENGINESBAR, 1);
addentities(MASK_NORMAL|MASK_ENGINE);
renderscene();
Hud_DrawLargeValue('some vector here', getstatf(STAT_TEAMMATESHEALTH), 25);
};
And that should give you a basic csqc mod that appears to do nothing other than draw an additional 'large' numerical value at some position on the screen.
Admittedly you should probably test the stat somehow so you don't draw it if you have no team mate, or use multiple stats for multiple consecutive team members, or something, you'll want to add some logic in there, no doubt, but this at least should demonstrate basic csqc usage. You should also calculate the pos to draw the string based upon the user's (virtual) screen space (first two arguments) rather than hardcoding it, but that goes without saying.
- Spike
- Posts: 2892
- Joined: Fri Nov 05, 2004 3:12 am
- Location: UK
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest