Forum

Animation driven AI (QuakeC) with IQM - how?

Discuss Artificial Intelligence and Bot programming.

Moderator: InsideQC Admins

Animation driven AI (QuakeC) with IQM - how?

Postby motorsep » Sat Mar 24, 2012 4:50 am

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

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

Postby blubswillrule » Wed Jun 13, 2012 8:30 am

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

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

Postby Spike » Wed Jun 13, 2012 3:47 pm

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

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

Postby motorsep » Wed Jun 13, 2012 5:19 pm

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

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

Postby Spike » Wed Jun 13, 2012 6:08 pm

just because you can use framegroups doesn't mean you have to.
Spike
 
Posts: 2883
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

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

Postby motorsep » Wed Jun 13, 2012 6:27 pm

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

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

Postby Spike » Wed Jun 13, 2012 6:43 pm

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

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

Postby motorsep » Wed Jun 13, 2012 7:18 pm

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

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

Postby taniwha » Wed Jun 13, 2012 10:45 pm

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/
taniwha
 
Posts: 399
Joined: Thu Jan 14, 2010 7:11 am

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

Postby motorsep » Wed Jun 13, 2012 11:22 pm

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

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

Postby frag.machine » Thu Jun 14, 2012 12:20 am

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)
User avatar
frag.machine
 
Posts: 2070
Joined: Sat Nov 25, 2006 1:49 pm

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

Postby motorsep » Thu Jun 14, 2012 12:38 am

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

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

Postby goldenboy » Fri Jun 15, 2012 8:02 pm

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

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

Postby motorsep » Fri Jun 15, 2012 8:09 pm

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

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

Postby goldenboy » Fri Jun 15, 2012 8:39 pm

Well, I think I don't understand you. The code I pasted definitely works.
User avatar
goldenboy
 
Posts: 924
Joined: Fri Sep 05, 2008 11:04 pm
Location: Kiel

Next

Return to Artificial Intelligence

Who is online

Users browsing this forum: No registered users and 1 guest