Specifically, is there a way to make monsters rotate around all the sectors they can access?
I'm creating a mod where monsters duke it out deathmatch style and I need them to rotate
around the map when they're not fighting, looking for new targets.
Is there a way to make Monsters explore?
Moderator: GZDoom Developers
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
- Matt
- Posts: 9696
- Joined: Sun Jan 04, 2004 5:37 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Debian Bullseye
- Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
- Contact:
Re: Is there a way to make Monsters explore?
Trying to work out which ones they can access, without spending a lot of time having them go through all their surroundings by trial and error, seems to be the biggest issue.
- Caligari87
- Admin
- Posts: 6230
- Joined: Thu Feb 26, 2004 3:02 pm
- Preferred Pronouns: He/Him
- Contact:
Re: Is there a way to make Monsters explore?
I made a "searching" AI procedure that mostly works with existing A_Chase code.
Look at Josh771's universal Enhanced AI for a more complex implementation of this idea, using nested goal nodes to search each area the monster reaches before moving on.

- If the monster doesn't have a target pointer, create a path node somewhere nearby.
- Set the monster's goal pointer to the path node.
- When the monster reaches the path node, remove it.
- If the monster doesn't reach the node in some reasonable time, remove the node and start over.
- Cast rays in a 180° fan from the monster's facing angle (I like to limit these to 512 units or so).
- Pick the longest ray and set a new path node at the end of it.
- Repeat.
Look at Josh771's universal Enhanced AI for a more complex implementation of this idea, using nested goal nodes to search each area the monster reaches before moving on.

Re: Is there a way to make Monsters explore?
Thanks @Caligari87, I'm excited to try this out