Page 1 of 2

Animation driven AI (QuakeC) with IQM - how?

Posted: Sat Mar 24, 2012 4:50 am
by motorsep
I was thinking to use Quake's AI code as an example for my AI code, as it has animation driven movement. However, I have no clue how would I do that with IQM models, as they contain framegroups (self-playing animation), not frames.
Can anyone help out with small sample code? Thanks.

Re: Animation driven AI (QuakeC) with IQM - how?

Posted: Wed Jun 13, 2012 8:30 am
by blubswillrule
define animation driven o.O

Re: Animation driven AI (QuakeC) with IQM - how?

Posted: Wed Jun 13, 2012 3:47 pm
by Spike
its worse with regular quake models where the movement speed is dependant upon the current frame. zombies kinda lurch and all.
was trying to hack up csqctest for animating everything clientside using just 'actions' instead of frames. not gonna say its perfect in any way. :P

Re: Animation driven AI (QuakeC) with IQM - how?

Posted: Wed Jun 13, 2012 5:19 pm
by motorsep
Damn, I wrote it way back when I still had the explanation given to me by LordHavoc in my head :P

Animation driven is when AI is called after frame of interest. Since MDL/MD3/DPM are frame based, you would call AI function after particular frame to make monster shoots or be in pain, etc. So I think that is what animation driven AI is. IQM is framegroups based meaning individual frames are not exposed to qc in ssqc. You can only say "play walking anim" and walking anim will be played. That means there is no way you can call AI easily after monster makes its 5th step, for example.

So some examples of AI working with IQM models would be nice to have.

Re: Animation driven AI (QuakeC) with IQM - how?

Posted: Wed Jun 13, 2012 6:08 pm
by Spike
just because you can use framegroups doesn't mean you have to.

Re: Animation driven AI (QuakeC) with IQM - how?

Posted: Wed Jun 13, 2012 6:27 pm
by motorsep
IQM format is superrior to other formats supported by DP. It's native exporter for Blender for once, which exports directly to IQM - no mess with intermediate formats. IQM can be used for static meshes with no bones, for static meshes with bones, and ofc for animated skeletal meshes. IQM supports vertex alpha which allows texture blending on animated models. The format is optimize for faster loading and for better performance. Why would I use something else?!

DPM requires to export into SMD first (or MD5, which currently has no Linux util to parse into DPM and exporters for Blender are broken), then convert. Plus I'd have to mess with text files to specify anims, fps, looping, etc.

And coding animation is easy - self.frame = 1 plays entire animation :) Very useful for animated map props.

Re: Animation driven AI (QuakeC) with IQM - how?

Posted: Wed Jun 13, 2012 6:43 pm
by Spike
I didn't say use anything else. just expand the frames into separate framegroups. one frame per group, and its directly equivelent to an .mdl for easy vertex animation. :P

Re: Animation driven AI (QuakeC) with IQM - how?

Posted: Wed Jun 13, 2012 7:18 pm
by motorsep
Yeah, we discussed that with divVerent. I'd still have to make .framegroups which would virtually separate framegroups into frames. However that's not how framegroups work, it's what you call jumping through the hoops to get the result :)

I am looking for clean and native to IQM solution.

Re: Animation driven AI (QuakeC) with IQM - how?

Posted: Wed Jun 13, 2012 10:45 pm
by taniwha
For new models: don't create multi-frame groups in the first place (may not be desirable, though).

Modify the engine to call a qc hook when the model's frame changes. Better yet (?), make it a frame "trap point" (like debug trap points): the engine calls the hook when a specific frame is selected. This would work even for q1 mdl :)

Re: Animation driven AI (QuakeC) with IQM - how?

Posted: Wed Jun 13, 2012 11:22 pm
by motorsep
taniwha wrote:For new models: don't create multi-frame groups in the first place (may not be desirable, though).
Then you will have static mesh. Framegoup based formats have to have more than 1 frame in a framegroup. Otherwise your model will be static. There is no reason to use IQM if you want to live in a stone age.
taniwha wrote:Modify the engine to call a qc hook when the model's frame changes. Better yet (?), make it a frame "trap point" (like debug trap points): the engine calls the hook when a specific frame is selected. This would work even for q1 mdl :)
That's counter productive. Sounds like a horrible hack.

Re: Animation driven AI (QuakeC) with IQM - how?

Posted: Thu Jun 14, 2012 12:20 am
by frag.machine
I have absolutely ZERO experience wih IQM (note to self: we need to fix this) but doesn't the format documentation supply any hint on how to deal with this ? Sounds quite strange such feature-filled model format being so hard to work.

Re: Animation driven AI (QuakeC) with IQM - how?

Posted: Thu Jun 14, 2012 12:38 am
by motorsep
frag.machine wrote:I have absolutely ZERO experience wih IQM (note to self: we need to fix this) but doesn't the format documentation supply any hint on how to deal with this ? Sounds quite strange such feature-filled model format being so hard to work.
It's not hard to work with at all. I coded player's model and first person weapon animation myself and I don't even qualify myself as a coder.

The issue is that Quake's AI isn't designed to be used with such format. So I am looking for a way to adopt it for IQM. It's just a matter of designing a way to call AI when needed. Basically need to use timing for AI calls vs calling AI after single frame.

Re: Animation driven AI (QuakeC) with IQM - how?

Posted: Fri Jun 15, 2012 8:02 pm
by goldenboy
IQM is framegroups based meaning individual frames are not exposed to qc in ssqc.
Hm, to animate an IQM model in QC I do the exact same thing as with MDL. Example

http://pastebin.com/iR9XsSSB

Each frame is exposed to the QC.

But I may be misunderstanding you.

Re: Animation driven AI (QuakeC) with IQM - how?

Posted: Fri Jun 15, 2012 8:09 pm
by motorsep
I think you are wrong.

If you do self.frame = 1 for IQM model, you will see whole animation playing automatically. If you do the same for MDL, you will only see 1 static frame.

Re: Animation driven AI (QuakeC) with IQM - how?

Posted: Fri Jun 15, 2012 8:39 pm
by goldenboy
Well, I think I don't understand you. The code I pasted definitely works.