Jump to content
The Dark Mod Forums

Benefits from LOD AI?


Springheel

Recommended Posts

I'm looking into whether LOD AI would be a good idea. Just to log my first test:

 

10 AI, 2 lights.

 

3100 poly version -- 51 fps

1550 poly version -- 61 fps

 

(better check to make sure the shadow meshes match up though)

  • Like 2
Link to comment
Share on other sites

It would certainly allow for more Ai in a map,

 

Well, my tests should answer that question. I'm not sure poly count is the main bottleneck though.

Link to comment
Share on other sites

I guess the first thing I should have done is test whether LOD actually WORKS with AI. I was under the impression it did, as people had asked me to make LOD AI versions in the past. But if it does work, I'm not able to see how. No combination of spawnargs I've used has had any effect.

Link to comment
Share on other sites

It would certainly allow for more Ai in a map, somthing player's always complain about not having enough off.

 

Pretty sure the limit was because AI runs on one thread along with the rest of the game and the CPU can only calculate so much.

You got the slow down even when not looking at the 32 AI in the test map.

But that was 6 years ago or so.

I always assumed I'd taste like boot leather.

 

Link to comment
Share on other sites

My tests suggest that there are definitely savings to be had...just reducing the quality of the shadowmesh can save some FPS. LOD would also allow me to make AI look better at close range...we could swap in fully modelled hands at close range, for example.

 

It's a shame it doesn't work...I could have sworn Tels asked me to make LOD AI at one point.

Link to comment
Share on other sites

Steve, I don't suppose in exploring LOD you found anything to suggest that md5mesh support might be easy to do?

Link to comment
Share on other sites

I don't know... I didn't spot any clues, but I wasn't looking for them and I don't know off hand how the model or md5mesh is set up for an ai. Lod works by manipulating the values normally set by the "model", "skin", and "noshadows" spawnargs on an entity. I don't know whether md5meshes are specified through the model spawnarg, but even if they're not, adding that functionality might turn out to be as easy as it was to add support for blendlights to entity lights. I'll be back within reach of my pc Friday afternoon. I might need to tap you for a bit of info, but let's try it out then and see.

Link to comment
Share on other sites

Animated entities have a "model" spawnarg (which points to a modelDef).

 

ModelDef entities have a "mesh" spawnarg that points to a specific md5mesh file.

 

From a maintenance standpoint, it would be easiest if the lod spawnargs could be added to the modelDef, like below:

 

 

model tdm_ai_scientist {

inherit tdm_ai_proguard

mesh models/md5/chars/inventors/scientist/tdm_inventor_scientist.md5mesh

 

"lod_1_distance" "600"

"mesh_lod_1" "models/md5/chars/inventors/scientist/tdm_inventor_scientist.md5mesh"

 

channel torso ( *Spine_Dummy)

channel legs ( origin Pelvis Pelvis2 *Hips)

 

//replacing animations that don't fit character

anim idle_nose_wipe models/md5/chars/guards/proguard/idle_armwipe.md5anim

anim idle_nosewipe_short models/md5/chars/guards/proguard/idle_ponder02.md5anim

anim idle_spit models/md5/chars/guards/proguard/idle_armwipe.md5anim

anim idle_eat models/md5/chars/guards/proguard/idle_ponder02.md5anim

 

 

 

}

Link to comment
Share on other sites

I agree, otherwise we'd end up duplicating the model defs and have to support changing the anim override and channel settings too.

 

I'll need to find where and when the lod models get loaded. It doesn't seem to be while the entity is spawning. Perhaps it happens during runtime, or perhaps once for all entities at the end of spawn time, in some code I haven't found yet. I'll shelve that question until I'm back. Given that Tels talked to you about it, I assume he thought it could be done.

 

Can you recommend a pair of existing model defs that'll be compatible? So I can try it out. I assume I'll need to find two ai meshes that have the same joints, but I don't know how common that is or whether anything else will need to match.

Link to comment
Share on other sites

Try this one:

 

model tdm_ai_citywatch {

inherit tdm_ai_proguard

mesh models/md5/chars/guards/citywatch/tdm_ai_citywatch.md5mesh

channel torso ( *Spine_Dummy)

channel legs ( origin Pelvis Pelvis2 *Hips)

 

"lod_1_distance" "600"

"mesh_lod_1" "models/md5/chars/undead/skeleton/skeleton.md5mesh"

 

}

 

That should cause the citywatch to turn into a skeleton at 600 units. Should be fun. :)

Link to comment
Share on other sites

Tracker created #3770. Simply plugging the existing LOD code into AI (i.e. just swapping the model) changes the guard's body to a skeleton but leaves him with his original head and no animations. That's not what we were planning to do, but I wanted to know what'd happen. Now looking for a way to switch him smoothly, which'll need to continue the current animation somehow to support your model hands etc. I suppose that'd be less important for making distant AI low-poly.

Edited by SteveL
Link to comment
Share on other sites

The heads are a separate, attached entity, so it makes sense they wouldn't switch the way things are currently set up. If heads can't use LOD that's not a big deal, though it would be a bonus if they could.

 

 

Now looking for a way to switch him smoothly, which'll need to continue the current animation somehow to support your model hands etc

 

Not sure what you mean about the hands...?

Link to comment
Share on other sites

I'll be aiming for heads too, once I work out why model-switched AIs can no longer walk. They play further idle animations ok.

Not sure what you mean about the hands...?

You mentioned modelled hands as a possible benefit. For any close-up work like that, we'll need to preserve and continue the AI's current animations though the mesh switch. Currently, the SetModel method for AIs resets all the anim channels.

Link to comment
Share on other sites

Oh, right. Yes, if the animations can't be preserved then the benefits would be a lot less, even at a distance.

Link to comment
Share on other sites

Did that run on idTech too? having a bit of trouble figuring it out just from googling.

 

I'm still only a couple of hours into this investigation. My computer has been out of action all weekend. Plenty to find out yet before I'll have any idea what is and isn't possible.

Link to comment
Share on other sites

Ok I got a proof of concept working, by using an new SwapModel() procedure for animated entities that changes the render model and the animated model but without resetting ongoing animations.

 

The heads can be dealt with the same way as the AI bodies -- they are animated entities too -- so I reckon they'll be able to have optional LOD spawnargs added to their model defs just like the AI bodies will (once I've set that bit up -- I did this demo by using spawnargs on the AI themselves).

 

I assume that doing this would be crashy or unpredictable if the animations and/or skeletons of the two models were not compatible. I've put in a couple of compatibility checks, but it won't be a problem for genuine LOD switches, which'll use identical animations and skeletons. In my tests, if the ai starts off as a skeleton (because he's too far away at map load), then when he turns into a human he carries on shuffling like a skeleton until he hits his first path corner. After that, he walks like a human. That's intentional (no resetting of ongoing animations), and again, that won't be an issue for real LOD ai.

 

I've not worked out how best to implement it yet, this is to just show that it's possible. I'll finish doing my homework and then consult the team about what else we might need to test or cover off.

 

http://youtu.be/6sjFt_eUO54

  • Like 1
Link to comment
Share on other sites

Very exciting!! Thanks for taking this on Steve. :)

 

Did anyone else start thinking about interesting ways to use this for creative creatures? You could have AI that 'turn into' skeletons or ghosts or something when they get close enough to attack you, but look like regular AI at a distance. Or something like Sotha's creatures, that are completely invisible until they get close to you, and then they suddenly become visible.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recent Status Updates

    • Petike the Taffer  »  DeTeEff

      I've updated the articles for your FMs and your author category at the wiki. Your newer nickname (DeTeEff) now comes first, and the one in parentheses is your older nickname (Fieldmedic). Just to avoid confusing people who played your FMs years ago and remember your older nickname. I've added a wiki article for your latest FM, Who Watches the Watcher?, as part of my current updating efforts. Unless I overlooked something, you have five different FMs so far.
      · 0 replies
    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 4 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
    • OrbWeaver

      I like the new frob highlight but it would nice if it was less "flickery" while moving over objects (especially barred metal doors).
      · 4 replies
×
×
  • Create New...