Forum

Print something to a polygon/entity?

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Print something to a polygon/entity?

Postby jim » Mon Oct 27, 2008 8:58 pm

Is it possible to print a message into polygon? I'm thinking of leaving the HUD away and have a wrist console that tells player how much health, armour, etc, he/she got.

I don't really like the idea that I'd have to make 3 polygons/entities if I wanted to have a 3 number display, then repeat this for all stats I want to have displayed... Maybe that's ok if it's just one counter in a weapon, that don't need 3 numbers, just 2.

If not possible, I'll just do something simpler.. Like some color gradient box polygon that change color and/or size...
zbang!
User avatar
jim
 
Posts: 599
Joined: Fri Aug 05, 2005 2:35 pm
Location: In The Sun

Postby Spike » Mon Oct 27, 2008 9:10 pm

how many different skins am I allowed to use?....

Well, you could use attachments and join multiple models together to form a single view model, changing the skin to set the number shown on a per-character basis.

Alternatively you could use DP_GECKO_SUPPORT... but that's not really practical.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby MeTcHsteekle » Mon Oct 27, 2008 9:53 pm

hehe do what they did in that new game Dead Space, i saw a preview and they put the health bar on the main characters back

well, hm that wouldn't work for the ammo though :?
bah
MeTcHsteekle
 
Posts: 399
Joined: Thu May 15, 2008 10:46 pm
Location: its a secret

Postby Urre » Tue Oct 28, 2008 9:48 am

jim: There's always polygon-drawing available in CSQC...
I was once a Quake modder
User avatar
Urre
 
Posts: 1109
Joined: Fri Nov 05, 2004 2:36 am
Location: Moon

Postby jim » Wed Oct 29, 2008 1:02 pm

What does that polygon drawing do? Can it draw multiple different textures into one polygon and have them at different coordinates in it and have some scale adjustment? Would it be able to write a message into the polygon.. like when player receives a message, then print it in that polygon instead of upper left corner or center of the screen?

Then I could make the game send long spam letters into player's wrist console :twisted:

Could this text scroll up and down if it didn't fit well enough into the wrist console display?

For player stats, I would like to have a picture of a simple human body that is separated into some areas, then maybe some lines drawed from the parts. This would be a backdrop, this wouldn't animate (but maybe the different parts could change colour). Then I would have 6 or 7 number values from 0 to 100% to indicate the status of a body part. The lines would "connect" these to the body parts.

Code: Select all
                       ___
                      /   \     HEAD 100%
                      |- -| ------------|
                      \ - /
 R. ARM 100%        ___|_|___        L. ARM 100%
 |------------ ____/  /   \  \____ ------------|
              |______|     |______| 
                      \___/ 
     L. TORSO 100%    /   \ \__   U.TORSO 100%
     |-------------- |     |   \-------------|
                    / \___/ \
  R. LEG 100%      /   | |   \      L. LEG 100%
  |--------------- |   | |   | ---------------|
                   |   | |   |
                 __|   | |   |__
                |______| |______|


Or maybe even draw the stuff in ascii like this...
zbang!
User avatar
jim
 
Posts: 599
Joined: Fri Aug 05, 2005 2:35 pm
Location: In The Sun

Postby Urre » Wed Oct 29, 2008 2:39 pm

The polygon drawing in CSQC does just what you'd imagine it does, it draws polygons. In other words, yes, you could make Doom3 like screens if you like. But the point is that you really need to code all of it yourself, but the possibility is there.

It doesn't quite work the way you imagine it, it doesn't alter the texture on a given polygon, but rather, you can draw new polygons with a slight offset from the surface you want them to be displayed on. This is, simply, how polygons work. It's very rarely necessary to alter the texture, but rather, new polygons are drawn in front of it, with such a minor offset that it's impossible to spot. This is how decals in games are done. This is also how the Doom3 screens were done.

You'd need to somehow indicate the position, size and direction of the surface you want to show your offscreen HUD on (I recommend either by using the getsurface* builtins, or by external files which point to a certain tag on a model, together with info for surface size), and draw your 3D HUD based on that information, clipping the polygons and aligning the textures based on the direction and size of the surface. Depending on your level of knowledge about polygon drawing, this is either easy or hard, but in any case a time-consuming task.

All of the features you describe would be perfectly possible, but don't imagine it to magically work, you have to code all of it, the scrolling, everything. The difference with CSQC and SSQC, is that things like this are finally possible.
I was once a Quake modder
User avatar
Urre
 
Posts: 1109
Joined: Fri Nov 05, 2004 2:36 am
Location: Moon

Postby Spike » Wed Oct 29, 2008 9:46 pm

Tbh, I forgot about the polygon rendering stuff.

Urre wrote:You'd need to somehow indicate the position, size and direction of the surface you want to show your offscreen HUD on (I recommend either by using the getsurface* builtins, or by external files which point to a certain tag on a model, together with info for surface size), and draw your 3D HUD based on that information, clipping the polygons and aligning the textures based on the direction and size of the surface. Depending on your level of knowledge about polygon drawing, this is either easy or hard, but in any case a time-consuming task.

If its a skeletal model, tags are the way to go if you want to animate the model properly (warning: DP's gettaginfo doesn't interpolate, but its easy enough to make a fix for that).

Assuming you want your hud to form a square on an animating model, the cleanest way is to use 3 bones and to extrapolate the fourth. The area to be drawn into should have any pre-made polygons missing. You then want to draw your hud as a series of triangle-pairs in the space. Try and avoid overlapping as inaccuracies will show then. Also reuse calculated vertex points for multiple polys (that is, figure out all the subcoords as the first step, and just draw polys with the given textures in the second.

This isn't drawing on the model, this is using CSQC to actually draw part of the model itself.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby Urre » Thu Oct 30, 2008 8:18 am

Spike: Shouldn't it be possible to have the polygon pairs overlap with a small offset on those that are meant to be drawn in front of the background polygons? I'd imagine it'd be easier to code, even if you wanted multiple layers, just add more offset depending on what layer the elements are on?
I was once a Quake modder
User avatar
Urre
 
Posts: 1109
Joined: Fri Nov 05, 2004 2:36 am
Location: Moon

Postby jim » Thu Oct 30, 2008 3:19 pm

Maybe I'll do something simpler, and I just realised that displaying the hud in some wrist console would be a minus if player has it compared to when he doesn't have it. And I wouldn't want to leave the hud completely away when wrist console not in possession.

But I think for weapons it's fine to leave the ammo counter completely away in some old fashioned weapons, and then have some displays in new age weapons.

Oh and I'll probably have to take a look at csqc anyway, so is this stuff here up to date: http://quakery.quakedev.com/qwiki/index.php/EXT_CSQC ? And is it all?
zbang!
User avatar
jim
 
Posts: 599
Joined: Fri Aug 05, 2005 2:35 pm
Location: In The Sun

Postby Urre » Fri Oct 31, 2008 9:43 am

It is relatively up to date, but it is far from all. Your best bet is to use one of the available CSQC source bases, and just experiment your way forward, in order to learn CSQC.
I was once a Quake modder
User avatar
Urre
 
Posts: 1109
Joined: Fri Nov 05, 2004 2:36 am
Location: Moon


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest