player shoot and running question

Discuss programming in the QuakeC language.
Post Reply
drm_wayne
Posts: 232
Joined: Sat Feb 11, 2012 5:47 pm

player shoot and running question

Post by drm_wayne »

Hey,

Im currently looking for an simple way to make the playermodel able to handle 2 different animations:
When the player doesnt move he should play the "stand and shoot" animations, and when moving the
"run and shoot" animations..

Im using the "SetClientFrame" function from scratch qc..
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Re: player shoot and running question

Post by Spike »

if you want to do it properly, you'll need to use FTE_CSQC_SKELETONOBJECTS and a skeletal model. this should also allow you to twist the spine, play different parts at different speeds, and should allow foot syncing if done properly.
Simple use of it still requires having a copy of the player in csqc.
if you don't do it properly, you'll probably end up resetting the run animation while shooting. The alternative is to make numrunframes*numshootframes frames in order to switch between them properly. Its just messy.
drm_wayne
Posts: 232
Joined: Sat Feb 11, 2012 5:47 pm

Re: player shoot and running question

Post by drm_wayne »

regular MDL and NetQuake (FitzQuake), no FTE and Darkplaces stuff...
It has been done before in a Quakemod, but i forgot the name...
Cobalt
Posts: 445
Joined: Wed Jun 10, 2009 2:58 am
Location: New England, USA
Contact:

Re: player shoot and running question

Post by Cobalt »

Are there real run n shoot animations in the stock player model? Last time I looked, the only one with the right footwork frames was the axe. The other weapons dont move the feet at all when moving and attacking....
drm_wayne
Posts: 232
Joined: Sat Feb 11, 2012 5:47 pm

Re: player shoot and running question

Post by drm_wayne »

i want it for my own playermodel...
too bad nobody can help :/
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Re: player shoot and running question

Post by Spike »

instead of the curent way of animating, call some other function that works out which frame to use based upon whether you're running (or not) and when you started shooting (or stopped).

or make two entities for the player, a bit like quake3. have the legs entity animate independantly based upon the player's speed, but be sure to update its origin to match the main/upper player model within playerpostthink. no framecount explosion then. when the torso is idle, it can use the same frame as the legs and switch to its own animation when not idle (you might want to animate the legs in playerprethink so that its done before the player/torso's think, but be sure to do the setorigin within playerpostthink - this location is mandatory or it will get disjointed or laggy).
drm_wayne
Posts: 232
Joined: Sat Feb 11, 2012 5:47 pm

Re: player shoot and running question

Post by drm_wayne »

well im using scratch qc setclientframe function...
I wonder if theres a way to change the animations with
a "self.isfiring" (TRUE / FALSE) float based on button0 / !button0
somehow...

Code: Select all

void () SetClientFrame =
{
// note: call whenever weapon frames are called!
    if (self.anim_time > time)
        return; //don't call every frame, if it is the animations will play too fast
    self.anim_time = time + 0.1;

    local float anim_change, run;

    if (self.velocity_x || self.velocity_y)
        run = #TRUE;
    else
        run = #FALSE;

    anim_change = #FALSE;

    // check for stop/go and animation transitions
    if (run != self.anim_run && self.anim_priority == #ANIM_BASIC)
		{
		dprint("anim_change = TRUE \n");
        anim_change = #TRUE;
		}
	
    if (anim_change != #TRUE)
    {
        if (self.frame < self.anim_end)
        {   // continue an animation
            self.frame = self.frame + 1;
            return;
        }
        if (self.anim_priority == #ANIM_DEATH)
        {
            if (self.deadflag == #DEAD_DYING)
            {
                self.nextthink = -1;
                self.deadflag = #DEAD_DEAD;
            }
            return;    // stay there
        }
    }

    // return to either a running or standing frame
    self.anim_priority = #ANIM_BASIC;
    self.anim_run = run;

    if (self.velocity_x || self.velocity_y)
    {   // running
		self.frame = 15;
		self.anim_end = 20;
    }
    else
    {   // standing
		self.frame = 0;
		self.anim_end = 9;
    }
};

frag.machine
Posts: 2126
Joined: Sat Nov 25, 2006 1:49 pm

Re: player shoot and running question

Post by frag.machine »

Spike wrote:instead of the curent way of animating, call some other function that works out which frame to use based upon whether you're running (or not) and when you started shooting (or stopped).

or make two entities for the player, a bit like quake3. have the legs entity animate independantly based upon the player's speed, but be sure to update its origin to match the main/upper player model within playerpostthink. no framecount explosion then. when the torso is idle, it can use the same frame as the legs and switch to its own animation when not idle (you might want to animate the legs in playerprethink so that its done before the player/torso's think, but be sure to do the setorigin within playerpostthink - this location is mandatory or it will get disjointed or laggy).
I have one version of this *kinda* working (some quirks in the frameloops) in DP (uses MOVETYPE_FOLLOW). Basically I split the player model in two halves and glued two non-solid entities checking the player entity movements and frames.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Re: player shoot and running question

Post by Spike »

he said 'no FTE and Darkplaces stuff'
frag.machine
Posts: 2126
Joined: Sat Nov 25, 2006 1:49 pm

Re: player shoot and running question

Post by frag.machine »

https://www.youtube.com/watch?v=Uq-jIj058FU

No MOVETYPE_FOLLOW. No vwep or attacks besides the kick, though
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
drm_wayne
Posts: 232
Joined: Sat Feb 11, 2012 5:47 pm

Re: player shoot and running question

Post by drm_wayne »

issue fixed...
re-wrote the entire way to handle playerframes..
Quakes original qc is just shit :lol:
leileilol
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Re: player shoot and running question

Post by leileilol »

to be fair you are trying to beat a rushed 1996 game to do new things, this is something that isn't even possible in any modern doom port ever. Even Unreal had a similar thing with a run-while-shooting animation as well as aiming up/down variations.
i should not be here
drm_wayne
Posts: 232
Joined: Sat Feb 11, 2012 5:47 pm

Re: player shoot and running question

Post by drm_wayne »

i made an own way to handle the anims, which took awhile to make but it was worth it.
It works like i wanted, and its totally different from the regular quake code.
Maybe it can be made simpler but atm im checking the players state (walk/run, button0
pressed etc..) to update the animations.

Each anims are defined (#define PLAYER_STAND etc..), getting updated via
float (float anim_type, float lastframe) GetClientFrames:

Code: Select all

	switch (anim_type)
	{
		case #PLAYER_STAND:
			if (lastframe)
				return 9;
			return 0;
			break;
Just as an example ;)
Post Reply