Animation driven AI (QuakeC) with IQM - how?

Discuss Artificial Intelligence and Bot programming.
motorsep
Posts: 231
Joined: Wed Aug 02, 2006 11:46 pm
Location: Texas, USA
Contact:

Animation driven AI (QuakeC) with IQM - how?

Post 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.
blubswillrule
Posts: 68
Joined: Mon Oct 04, 2010 9:08 pm
Location: Lincoln, California

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

Post by blubswillrule »

define animation driven o.O
A truly rewarding experience for an AI coder: watching your ai navigate the map... makes all the time invested in the code worth it :)
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

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

Post 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
motorsep
Posts: 231
Joined: Wed Aug 02, 2006 11:46 pm
Location: Texas, USA
Contact:

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

Post 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.
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

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

Post by Spike »

just because you can use framegroups doesn't mean you have to.
motorsep
Posts: 231
Joined: Wed Aug 02, 2006 11:46 pm
Location: Texas, USA
Contact:

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

Post 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.
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

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

Post 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
motorsep
Posts: 231
Joined: Wed Aug 02, 2006 11:46 pm
Location: Texas, USA
Contact:

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

Post 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.
taniwha
Posts: 401
Joined: Thu Jan 14, 2010 7:11 am
Contact:

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

Post 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 :)
Leave others their otherness.
http://quakeforge.net/
motorsep
Posts: 231
Joined: Wed Aug 02, 2006 11:46 pm
Location: Texas, USA
Contact:

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

Post 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.
frag.machine
Posts: 2126
Joined: Sat Nov 25, 2006 1:49 pm

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

Post 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.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
motorsep
Posts: 231
Joined: Wed Aug 02, 2006 11:46 pm
Location: Texas, USA
Contact:

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

Post 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.
goldenboy
Posts: 924
Joined: Fri Sep 05, 2008 11:04 pm
Location: Kiel
Contact:

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

Post 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.
motorsep
Posts: 231
Joined: Wed Aug 02, 2006 11:46 pm
Location: Texas, USA
Contact:

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

Post 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.
goldenboy
Posts: 924
Joined: Fri Sep 05, 2008 11:04 pm
Location: Kiel
Contact:

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

Post by goldenboy »

Well, I think I don't understand you. The code I pasted definitely works.
Post Reply