Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/06/23 11:29
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
7 registered members (fairtrader, Quad, miwok, Martin_HH, AndrewAMD, alibaba, dpn), 581 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
AI/Player Combat Zones, AI guru input needed :) #317222
03/30/10 04:26
03/30/10 04:26
Joined: Apr 2002
Posts: 1,246
ny
jumpman Offline OP
Serious User
jumpman  Offline OP
Serious User

Joined: Apr 2002
Posts: 1,246
ny
Hey everyone, I have kind of a complicated problem, if you could take a read and see if you can help I'd appreciate it.

My game can technically handle up to 60 of my AIs, however having them all moving and shooting at the same time lowers the frame rate drastically. So I'm going to implement a way for AI's to be created depending on the player's progression in the level. Each "combat zone" would spawn it's enemy units whenever the player entered that zone. This way I could spawn only the relevant enemies, and technically have over 60 units in the progression of the level.

So the first idea is to place pre-defined trigger gateways such as doors. These doors would open when the current zone is cleared, and the next zone would populate with enemies. Ai's would never be able to pathfind to any node that is locked out. This method is fine, up until how my AI's can flank their target.

When an AI chooses to flank a target, it wont necessarily move to the closest node that it's target is next to. It can choose to move to a node that is to the left or right of the target. So this can put the AI's final destination to a node that is on the other side of a wall, and then proceed to move towards the target after reaching the flank node. The flanking behavior works well because it doesnt use line of sight to the target, and it breaks up the combat in areas with alot of cover.

However with this flanking behavior, and the above combat zones, the zone trigger entities can work against the AI. Because no node will know what zone it is in, (unless i go into every node and assign a zone to it), an AI can choose to flank to a node that should be locked out, but will continue to do so. I need a way to broadly assign nodes their designated zones.

I thought about using passable map entities, assigning them a zone number, duplicating them to the shape of the zone I wanted, then letting the nodes do an intial in_passable check to see if its inside a zone, and then assign itself to the zone of the passable map entity.

This is a fine brute force way of assigning multiple nodes a zone right inside wed other than going into every node, however I already have alot of clutter in WED. AIs, scene objects, wed blocks, path nodes, terrain, and then adding another array of map entities could get very annoying to work with inside wed.

My next idea was to use WED's path object to define a faux polygon shape, and then do a "point vs polygon" collision/inside polygon function to assign a node a zone. This is the most elegant way i can think of, however its the most complicated due to polygon math. I can explain this more in depth if youd like.

/exhale

Re: AI/Player Combat Zones, AI guru input needed :) [Re: jumpman] #317224
03/30/10 07:34
03/30/10 07:34
Joined: Feb 2009
Posts: 2,154
Damocles_ Offline
Expert
Damocles_  Offline
Expert

Joined: Feb 2009
Posts: 2,154
The easiest way is to activate and deactivate the AIs depending
on a distance value.

With these zones you will have a problem at the boundary of
the zone. Where the AI might instantly shut down at the "door".

Just make the AI "activate" (able to act, and visible to other
AIs) at like 2000 quants, and deactivate if further than 2500 quants.
In deactive mode, the AI just checks the distance to the player
every second or so, and is else just a passive model with "idle" animation.

You can also dynamically tune the game by adjusting the Distance values then.
More flexible than a zone system, and much less manual work.

To avoid the player to "pull out" single AIs from a group,
temporarily increase the activate distance by 300 quants
or so, when a AI newly activates. (or let it activate other
AIs close by)

-----

If you really want to use the zone approach, you
can dynamically determine if a node is in a zone.

Use a "fill" algorythm for that.
Block all "door nodes" out,
manually assign a zonenumber to one node in the zone,
and let it look for all connected nodes.
Then assign them the same zone number.
(its also less manual work, and more flexible)

Re: AI/Player Combat Zones, AI guru input needed :) [Re: Damocles_] #317365
03/30/10 22:18
03/30/10 22:18
Joined: Apr 2002
Posts: 1,246
ny
jumpman Offline OP
Serious User
jumpman  Offline OP
Serious User

Joined: Apr 2002
Posts: 1,246
ny
hey damocles, thank you for taking a look.

The combat zones are not combat spaces where AI's will shut off if they exit the zone. These combat zones are more like unlocked areas. So for example, you are in a basement and you kill all the enemies in there, you can open the door to the first floor. At this point the enemies in the 1st floor are created. The flow of combat can and most likely will move back into the basement if an AI chooses to move around alot. If an AI decides to move to the basement then so be it. He just shouldnt be able to move up to the 2nd floor, which is currently locked.

Re: AI/Player Combat Zones, AI guru input needed :) [Re: jumpman] #317392
03/31/10 09:29
03/31/10 09:29
Joined: Nov 2008
Posts: 946
T
the_clown Offline
User
the_clown  Offline
User
T

Joined: Nov 2008
Posts: 946
I'd rather define zones using corner points; let's say, u want a zone of 500*500 quants, u place a point in the upper left corner (from a top view), and one in the lower right corner;
Both corner points get an ID, for example in a skill, and then, in code, write their positions in, say, a struct field that can be accessed by all entities to read out the zones corners (given the case u want rectangles as zones).
This system would define clear spaces that the AI can access.
Dunno if this is a clear explanation though; I tried my best. grin

Re: AI/Player Combat Zones, AI guru input needed :) [Re: the_clown] #317733
04/02/10 01:55
04/02/10 01:55
Joined: Apr 2002
Posts: 1,246
ny
jumpman Offline OP
Serious User
jumpman  Offline OP
Serious User

Joined: Apr 2002
Posts: 1,246
ny
hey the_clown

I would love to use the corner point method, but that limits the zones to be square shaped correct?

Currently Im thinking of using the method damocles mentioned. I would need to clearly define zone entry points using doors/gates, but have these entities passable when the nodes are computing their paths (im using george's old school A* pathfinding, george is awesome):

1. Gate entities are passable in the beginning
2. Level computes pathfinding
3. Gate entities become solid
4. Nodes begin their zone assignments

The few downsides to the above method is that I need to define the zones using gates instead of building a zone using an outline shape. I need to be on top of what doors can lead to what areas. The other is that the zone traces that each node will have to make will take an extra pause in the level when it starts. (To alleviate this, I would make a quick autosave after the level computes and then reload this autosave after death so the level doesnt calculate again)

Re: AI/Player Combat Zones, AI guru input needed :) [Re: jumpman] #317759
04/02/10 12:35
04/02/10 12:35
Joined: Nov 2008
Posts: 946
T
the_clown Offline
User
the_clown  Offline
User
T

Joined: Nov 2008
Posts: 946
Originally Posted By: jumpman
hey the_clown

I would love to use the corner point method, but that limits the zones to be square shaped correct?




Well, yes. But it would also allow zones that dont consist of rooms though.


Moderated by  HeelX, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1