Jump to content
  • entries
    943
  • comments
    5,899
  • views
    923,763

Three's a Crowd


Josh

5,639 views

 Share

Crowd navigation is built into Leadwerks3D. You just set a destination, and your characters will automatically travel wherever you tell them to go. I think having navigation built into the engine will give us better results than a third party add-on would. We can automatically recalculate sections of the map that change, AI script functions can be called when certain events occur, and the code to control characters is extremely simple.

 

 Share

20 Comments


Recommended Comments

You seem to *really* like Left4Dead. ... a lot! :)

 

Anyway, I think this will give quite an edge to beginners and save a lot of time to more experienced users.. Nice work!

 

Some questions though. Will it work seamlessly with terrain and custom geometry (ie. buildings that can be entered and are placed on terrain, a cave mesh that's placed to a terrain 'hole', etc). Do you plan to supplement this with a traditional waypoint system, so you could connect two adjacent nav meshes (two towns that are far apart), or would we need to roll-out our own? ... This is already usable for numerous types of games even in it's current form, but since you're tightly integrating it with the engine, I think it would make sense to really flesh it out and make the most of it...

Link to comment

I seem to repeat myself a lot with you but I'll do it again anyway: very nice! :) I've gotta say that if this works properly, this will be the top 5 features I would buy Leadwerks3D for (though I'm still hoping to make my dream platformer first).

 

Hoped-for sub-features:

 

1. Most games have enemies that stop chasing the player after a while and return to their original position. This is usually done in one of three situations:

a. The distance between the player and the enemy is great enough.

b. The distance between the enemy and its original position is great enough

c. Player enters a safe area.

 

2. Enemies following at different speeds (I'm sure this is a given, though it's worth mentioning).

 

3. And here's the big one: enemies that can go where other enemies can't. Like fire enemies that can't cross water. I suspect this would require a separate nav-mesh (or whatever it's called). I don't know if Leadwerks3D could use more than one nav-mesh at a time and have two entities assigned different ones. Or can tiles be given characteristics? The simplest way would be to just change a tile's characteristic in the editor. Though I admit I don't know anyone who would use this just yet. I'm sure it could be done down the line should it become a popular request.

 

I'm as excited about this as you are. I didn't really realize how much I missed this feature until I saw your videos and those of others trying to implement this.

Link to comment

Here's what I'm thinking:

 

-Melee enemies stop when they reach a certain distance. Zombies, anything with a sword, anything that bites.

 

-Enemies with projectile weapons should stop on two conditions.

1. A clear line of site to their target exists.

2. They are within firing range (consider a crossbow or something with a high arc).

 

The second type of enemy might retrace their steps to back away from the player when not firing, stopping when the line of sight is broken. This might be a good approximation for running for cover, then coming out to shoot, then hiding again.

Link to comment

lol, tournamentdan (instantly hums benny hill jingle)

 

Josh, having these extra parameter controls accessible will be of

great use! (I'm liking gamecreator's ideas as well)

 

depending on how fps-costly this is, I could see this also being immediately

applicable to adding secondary 'non-conflict' life to a game world--thinking

flocking fauna (fish, birds, etc.) or man-made stuff like background airplane paths, cars, etc.

The idea would be to set 1 'hero/leader' NPC on a path and have instances

or other NPCs flocking behind. In this regard, some built-in randomization or

noise/turbulence to the accuracy of the path-following would be handy too.

Link to comment

Nice Josh, as was said there needs to be a way to adjust it. Also while talking about built in features. Have you given any consideration to a built in 'Game Save' feature. Saving Game data and reloading it is a major hurdle for Game builders to get working.

Link to comment

Oh amazing :)

And there will be lot more applications or other game genres possibles , like invincible ennemies following you and you must hide on shadows or special floors tiles ... etc ...

 

@gordonramp :

I think game saving is very specific, and you have a very simple method that can be to save checkpoints to make things easy, like saving player life, ammo, Scenario completed stages ... all that in a simple file.

And games that don't use checkpoints and saving real time action , are too much easy , it allows players to finish the game lot more easy, caus you save each time you are doing well against a bosss for example ...

Link to comment

Well very good AI behavior,

can we expect some AI paths and AI tracks for car racing game style ?

 

it would be so usefull, thanks

Link to comment

Excellent. Ai is a complex thing. Different behaviors are needed in different types of games. The best thing would be if we could control different conditions by the script. To write scripts for different behaviors if it is possible . Crowd system in 3dsmax has predefined behaviors and scripted behaviors . In that case everybody will be happy :)

 

Josh we need something like onUpdate() for each enemy , where we can add game-specific logic. It would be enough if we can say stop for each enemy when we want.

 

Then all that conditions like:

 

1. A clear line of site to their target exists.

2. They are within firing range (consider a crossbow or something with a high arc)

3 somebody shoot at me Look for cover :)

 

we can control alone.

 

Great progress , Can't wait to put my hands on :)

Link to comment

Tower Defense! One of the most basic and probably first things indie people make :)

 

One thing about what you were showing to make the AI "smarter". When you went behind the wall they all picked a direction around it, but when you moved closer to one side they all changed and found the shortest path, however they would never have "seen" you do that because you were behind a wall so would be more realistic if they only changed directions from "seeing" you and knowing to change directions. May setup some variable with the "followers" that indicates only changing direction when they "see" you and if they don't see you they either patrol randomly or go back to what they were doing? Just a thought.

Link to comment

Regarding the AI following:

 

Normally the player moves through a map and alerts enemies when they come within a certain range and have a direct line of sight. You don't normally have a mob of enemies chasing a player through a map.

 

Enemies should be faster than the player, so that they are forced to deal with them as they are encountered.

 

So what would normally happen is you would move to an area, encounter some enemies, be forced to fight them there, then move on. Since enemies would be placed around the map in different locations, they normally would not all be coming at you from one direction.

Link to comment

Well I guess something that could happen is a player runs through some door that closes behind him and now the AI have to get to the player another way. That would be sort of like what you showed in your video except you just went through the wall instead. Basically it adds an element of the AI chasing the player, running into an obstacle and just picking a direction to get to the last known point of the player and sticking with that direction unless they see the player again to make them change.

Link to comment
Guest Red Ocktober

Posted

great job grasping the inner workings of the lib in such a short time...

 

looks really good...

 

 

--Mike

Link to comment

I may call the AI class an "Actor" and switch our Actor class to something else, like "Modifier" or something. Maybe the class functions would look something like this:

 

Actor::SetTargetEntity(Entity* entity, int mode, float distance)

 

Makes an actor follow an entity.

 

distance

When the actor gets this close, it stops following.

 

mode:

0 - always follow

1 - move to last visible point

2 - stop when line of sight is lost

3 - stop when a line of sight is acquired (for projectile enemies)

 

 

Actor::SetTargetPosition(Vec3 position, float distance)

 

distance

When the actor gets this close, it stops following.

 

You could do all this manually in script, but my guess is there are ways I can make it more optimal if it's built into the engine, like staggering the updates or running it on a separate thread.

 

Maybe the actor would have Lua functions like this:

 

function actor:TargetReached()

function actor:TargetLost()

function actor:TargetAcquired()

function actor:GotBoredAndTookANap()??? :P

Link to comment

Looks fine. Now we can make Assassin's creed :P Move to last visible point and search . If you see him, follow him again. If not ,go back and drink beer :P

Link to comment

I like that solution. This stuff always makes me think of Metal Gear. One of those games had a mini game where you had to navigate your way around some complex room with moving guards and cameras and not be seen. You tap on the wall and the guards says "huh?!?" and comes looking. If he finds nothing over a given amount of time he goes back to where he was and what he was doing.

 

I so want to make a mini game like that! It was so much fun back in the day.

Link to comment

I so want to use this crowd AI in a mini game like Leeroy Jenkins :P

You aggro one enemy, run away and because he has aggro on you, every other enemy who sees the enemy who has aggro to you will aggro you too. Soon you have all the enemies chasing your arse.

Link to comment

The industry term for an AI 'actor" "entity" "class" brain whatever you want to call it is usually Agent, not Actor. Usually safe neumonic to maintaing your finalized character an Actor, with the sub components of a Model, Entity, AI Agent / Brain, etc. Just my two cents.

Link to comment
Guest
Add a comment...

×   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.

×
×
  • Create New...