Entity chase player without stuck
I am writing an Zombie Entity that would chase player when they when close.
But the map have a lot of obstacles that player can abuse and make the Zombie stuck on the other side (like a table or a car) and kill it easily I was thinking about using A* Pathfinding but it cost a lot of CPU Another method I was think of is mark player's origin every 10 distance => Make Zombie go to that origin in order But it make the Zombie look stupid if player just running around a circle and then the Zombie did the same. Is there other method/way I could use for this problem? |
Re: Entity chase player without stuck
1 Attachment(s)
I've try'd to make such Zombie AI in the past,
I'll add the code, see if there is anything usefull in it. NOTE: Only a few functions work, A* Pathfinding is broken to last time I tested it. Also code is old, optimizes recommended. |
Re: Entity chase player without stuck
i'd suggest to make a predefined path origins for the map.
as czbots work You do still need efficient path finder to help you with the obstacle and setting the path origins |
Re: Entity chase player without stuck
Make touch so zombies can pass through the 'obstacles'.
|
Re: Entity chase player without stuck
Marking the player origin is an option,
if you add a check that bot could skip a few if possible & faster. That would solve the circle problem. |
Re: Entity chase player without stuck
Quote:
Quote:
Quote:
No, thank you. Quote:
|
Re: Entity chase player without stuck
Yes celena it does consume alot of CPU but just for a while on the start of the map
|
Re: Entity chase player without stuck
The only way I can think of is waypoints.
https://user-images.githubuserconten...54230fbcbb.png The logic is quite simple, but will take some work. 1. You need to set the waypoints for each map and save the data, similar to map spawns editor. 2. In the zombie "walk function", check if there is any obstacle. If false, keep moving, if true, look for the waypoint closest to the zombie towards of its target and move it towards that point. 3. When there's no more obstacle or case the zombie has already walked to the waypoint, repeat from step 2 4. When the zombie reach its target, attack! You can try to take a look at the artificial intelligence codes to see how it works like Podbots, HL1 source code or an open source game engine like Godot, and try to implement with amxx. It's not impossible, it will just take some work. Good luck! |
Re: Entity chase player without stuck
Quote:
Quote:
It is gonna be long :crab: |
Re: Entity chase player without stuck
Is there any way to "predict" the players path, or to use player path and randomize it a bit, so it wont look like that.
|
All times are GMT -4. The time now is 10:56. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.