FAQ  •  Register  •  Login

Animation driven AI (QuakeC) with IQM - how?

Moderator: Inside3D Admins

<<

motorsep

Posts: 146

Joined: Wed Aug 02, 2006 11:46 pm

Location: Texas, USA

Post Sat Mar 24, 2012 4:50 am

Animation driven AI (QuakeC) with IQM - how?

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

User avatar

Posts: 68

Joined: Mon Oct 04, 2010 9:08 pm

Location: Lincoln, California

Post Wed Jun 13, 2012 8:30 am

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

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: 2070

Joined: Fri Nov 05, 2004 3:12 am

Location: UK

Post Wed Jun 13, 2012 3:47 pm

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

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: 146

Joined: Wed Aug 02, 2006 11:46 pm

Location: Texas, USA

Post Wed Jun 13, 2012 5:19 pm

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

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: 2070

Joined: Fri Nov 05, 2004 3:12 am

Location: UK

Post Wed Jun 13, 2012 6:08 pm

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

just because you can use framegroups doesn't mean you have to.
<<

motorsep

Posts: 146

Joined: Wed Aug 02, 2006 11:46 pm

Location: Texas, USA

Post Wed Jun 13, 2012 6:27 pm

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

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: 2070

Joined: Fri Nov 05, 2004 3:12 am

Location: UK

Post Wed Jun 13, 2012 6:43 pm

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

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: 146

Joined: Wed Aug 02, 2006 11:46 pm

Location: Texas, USA

Post Wed Jun 13, 2012 7:18 pm

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

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: 399

Joined: Thu Jan 14, 2010 7:11 am

Post Wed Jun 13, 2012 10:45 pm

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

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: 146

Joined: Wed Aug 02, 2006 11:46 pm

Location: Texas, USA

Post Wed Jun 13, 2012 11:22 pm

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

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

User avatar

Posts: 1475

Joined: Sat Nov 25, 2006 1:49 pm

Post Thu Jun 14, 2012 12:20 am

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

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: 146

Joined: Wed Aug 02, 2006 11:46 pm

Location: Texas, USA

Post Thu Jun 14, 2012 12:38 am

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

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

User avatar

Posts: 726

Joined: Fri Sep 05, 2008 11:04 pm

Location: Kiel

Post Fri Jun 15, 2012 8:02 pm

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

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: 146

Joined: Wed Aug 02, 2006 11:46 pm

Location: Texas, USA

Post Fri Jun 15, 2012 8:09 pm

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

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

User avatar

Posts: 726

Joined: Fri Sep 05, 2008 11:04 pm

Location: Kiel

Post Fri Jun 15, 2012 8:39 pm

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

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

Return to Artificial Intelligence

Who is online

Users browsing this forum: No registered users and 0 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.
Icons provided by Aha Soft