Page 1 of 2

Best Method for Various Player Heads

Posted: Thu Mar 01, 2012 12:56 am
by Ghost_Fang
So as the title says I want to have various heads/helmets for player models and maybe even NPCs. What would be the best way of doing this in Darkplaces? I am going to assume that Md3s are my best bet, unless there is a better way? If Md3 are the best way, could anyone point me in the direction of good, Darkplaces compatible, Md3 documentation? The few that I found seemed pretty Q3A and Sauerbraten specific, and I'm pretty sure Darkplaces doesn't support ALL of the Md3's features.

Re: Best Method for Various Player Heads

Posted: Thu Mar 01, 2012 1:10 am
by leileilol
Darkplaces does support all of MD3's features (.skin files, tags).

Read dpextensions.qc

Re: Best Method for Various Player Heads

Posted: Thu Mar 01, 2012 4:36 am
by Ghost_Fang
i assumed that already: EDIT: Sorry misread that. leileilol
Ghost_Fang wrote:I'm pretty sure Darkplaces doesn't support ALL of the Md3's features.
In dpextensions.qc, all i see about md3s is:

Code: Select all

//DP_GFX_QUAKE3MODELTAGS
//idea: id Software
//darkplaces implementation: LordHavoc
//field definitions:
.entity tag_entity; // entity this is attached to (call setattachment to set this)
.float tag_index; // which tag on that entity (0 is relative to the entity, > 0 is an index into the tags on the model if it has any) (call setattachment to set this)
//builtin definitions:
void(entity e, entity tagentity, string tagname) setattachment = #443; // attachs e to a tag on tagentity (note: use "" to attach to entity origin/angles instead of a tag)
//description:
//allows entities to be visually attached to model tags (which follow animations perfectly) on other entities, for example attaching a weapon to a player's hand, or upper body attached to lower body, allowing it to change angles and frame separately (note: origin and angles are relative to the tag, use '0 0 0' for both if you want it to follow exactly, this is similar to viewmodelforclient's behavior).
//note 2: if the tag is not found, it defaults to "" (attach to origin/angles of entity)
//note 3: attaching to world turns off attachment
//note 4: the entity that this is attached to must be visible for this to work
//note 5: if an entity is attached to the player entity it will not be drawn in first person.

Re: Best Method for Various Player Heads

Posted: Thu Mar 01, 2012 9:33 am
by Seven
Hello Ghost_Fang,

DP_GFX_QUAKE3MODELTAGS is exactly what I would do, too.
"setattachment" is your best friend i guess :)
I think SUPA wrote a small tutorial here in the inside3d forum how to exactly use "setattachment".
Pleased search for it if necessary.

Inside the monster spawn function you will have a small random function that selects the head.
Then use "setattachment" to glue them together.

Good luck.
Seven

Re: Best Method for Various Player Heads

Posted: Fri Mar 02, 2012 5:19 am
by Ghost_Fang
Is there a good tutorial or documentation how to use these properly in darkplaces?

Re: Best Method for Various Player Heads

Posted: Fri Mar 02, 2012 2:13 pm
by Ace12GA

Re: Best Method for Various Player Heads

Posted: Fri Mar 02, 2012 11:35 pm
by Ghost_Fang
Ace12GA wrote:Check out supertorso: http://forums.inside3d.com/viewtopic.php?t=58
Yea tried that. It might be easier to understand if it would actually work. I tried supertorso and nothing happened, i don't see any of the models or anything....

Re: Best Method for Various Player Heads

Posted: Sat Mar 03, 2012 3:11 am
by Ace12GA
Ghost_Fang wrote:
Ace12GA wrote:Check out supertorso: http://forums.inside3d.com/viewtopic.php?t=58
Yea tried that. It might be easier to understand if it would actually work. I tried supertorso and nothing happened, i don't see any of the models or anything....
Look at your shadow in game, read the readme and switch to 3rd person. It works in Darkplaces, and the code makes extensive use of the Q3 MDL tag system to tie together the model from separate parts.

Re: Best Method for Various Player Heads

Posted: Sun Mar 04, 2012 5:21 am
by ceriux
if your using mdl's you could try the visible equip thing using drawonlytoclient?

Re: Best Method for Various Player Heads

Posted: Wed Mar 07, 2012 12:37 am
by Ghost_Fang
Ace12GA wrote:
Ghost_Fang wrote:
Ace12GA wrote:Check out supertorso: http://forums.inside3d.com/viewtopic.php?t=58
Yea tried that. It might be easier to understand if it would actually work. I tried supertorso and nothing happened, i don't see any of the models or anything....
Look at your shadow in game, read the readme and switch to 3rd person. It works in Darkplaces, and the code makes extensive use of the Q3 MDL tag system to tie together the model from separate parts.
Well i see it... but whats the point if the model doesnt work? I cant get them to work at all...
ceriux wrote:if your using mdl's you could try the visible equip thing using drawonlytoclient?
That was my first intention, but i am attempting to use md3s to be a bit more clean about it. Its beginning to seem like im stuck with mdls...

Re: Best Method for Various Player Heads

Posted: Wed Mar 07, 2012 2:54 am
by qbism
Ghost_Fang wrote:Is there a good tutorial or documentation how to use these properly in darkplaces?
http://www.quaketastic.com/upload/files ... -05-05.zip

Re: Best Method for Various Player Heads

Posted: Wed Mar 07, 2012 4:06 am
by Ace12GA
Ghost_Fang wrote:Well i see it... but whats the point if the model doesnt work? I cant get them to work at all...
My point is that if you look at cl_main.qc, you will see where the player model is assembled from 4 separate md3 models into one model. It does work, the purpose of super torso was to demonstrate a system by which the players arms and torso bend to match the view pitch. Regardless, there is the working code that assembles the models into one working model. I would think that would be a great starting point to simply swapping the head on a player model using md3's with attachment tags.

Sorry if that is not helpful.

Re: Best Method for Various Player Heads

Posted: Wed Mar 07, 2012 8:51 pm
by Ghost_Fang
Ace12GA wrote:
Ghost_Fang wrote:Well i see it... but whats the point if the model doesnt work? I cant get them to work at all...
My point is that if you look at cl_main.qc, you will see where the player model is assembled from 4 separate md3 models into one model. It does work, the purpose of super torso was to demonstrate a system by which the players arms and torso bend to match the view pitch. Regardless, there is the working code that assembles the models into one working model. I would think that would be a great starting point to simply swapping the head on a player model using md3's with attachment tags.

Sorry if that is not helpful.

No thats great and all i can see how to code them via QC. But what good does it do if i cant even get the md3s to show up, just the shadows?

Re: Best Method for Various Player Heads

Posted: Wed Mar 07, 2012 9:21 pm
by Ace12GA
Ghost_Fang wrote:No thats great and all i can see how to code them via QC. But what good does it do if i cant even get the md3s to show up, just the shadows?
It shows you how to spawn and connect md3 models from the qc. You want to have multple player heads, so, using the md3 tag attachment stuff, you have a headless player model, and then you have a half dozen head models. All are md3, and have suitable attachment tags placed.

From qc, you spawn the main part of the player model, then the head, and attach the head to the player model. Swapping the head is as simple as removing the current head, destroying the object, spawning a new head, and attaching it.

Well, maybe not simple, but the code in that project demonstrates how to do that clearly and cleanly. That was my point. The functioning of that project so far as visually seeing the model is immaterial. That you can see the assembled model's shadow working, shows that it is working. You are not going to directly see your player model or it's head in game either; other clients will.

Re: Best Method for Various Player Heads

Posted: Fri Mar 09, 2012 5:23 am
by Ghost_Fang
I know, i will definitely use supertorso for a reference when the time comes, but my only issue is that there is NO MD3, its not there at all, chase_active 1? Nope.avi connect another client? nope.avi. I cannot see the player model at all in game. And i think the code was designed so you could see your arms, torso and legs in first person anyways. I'm almost thinking about just using a headless player.mdl and having the heads spawn with MOVETYPE_FOLLOW. :/