New AI v2.0

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
User avatar
Sphagne
Posts: 513
Joined: Wed Jul 16, 2003 3:36 am

New AI v2.0

Post by Sphagne »

OK. here is a revamped version of my other thread New AI TM, hope Randy likes these ideas better than the last ones... :wink:

This is a system by wich we can manage actors troughout the levels, so we can give them different tasks to perform and they can move trough the level without losing their way around and complete those tasks or report failure and get other tasks.

Examples for these tasks are attacking a target, or investigating a place where a sound was heard, or normal patrol routes, even the level designers can define new type of tasks for the actors to perform and report the results.

With this method, the actual emulation of AI for actors is a task for the level designers, not ZDoom, and ZDoom will only add some new tools for the level designers to use and emulate some intelligence for actors.

The foundation of this AI is made by a network of nodes connected by some special links, like brain cells connected by neurons, and this network spans through all or some parts of the levels, and those nodes and links control the actor movements and actions through out the wired parts of the levels, and check their different charactristics to decide if they can perform any of different tasks programmed into those AI networks.

Some new required actor charactristics are here:
  1. NPC lump name Hey we can have individual characters now.
  2. Sight Defines how good it can see into darkness and distance
  3. Visibility Defines how good it can be seen by other actors
  4. IQ 0<Dumb<100<Super-Intelligent<255
  5. Current Task Actor's current mission, while it moves around
  6. Prev Task It is set after completing or failing a mission
  7. Moral Actor is :
    • 0 Offensive
    • 1 Defensive
    • 2 Scared
  8. Action Style Actor Likes to :
    • 0 Stand still
    • 1 Be idle
    • 2 Guard areas
    • 3 Run missions
  9. Awareness Actor is :
    • 0 Unaware
    • 1 Alarmed
    • 2 Aware
  10. Department Team(0-255) Sub1(0-255) Sub2(0-255) Sub3(0-255)
  11. Some new bits like :
    • Can swim Actor can fly in water zones
    • Can jump Checked by AI network to see if we can make it jump around
    • Avoids fake floors Would not pass through them intentionally
    • Stays wired Would not leave the AI net for unwired places
    • Stays unwired Would not use AI network at all
    • CTF bits like : Actor carries the flag
The NPC lump name points to an optional lump name between N_START and N_END markers that would have some info to make the actor a unique one with individual charactristics and persona that may differ with it's race.

Within NPC lumps we can define initial health, armour, moral, prefered action style, team departments, and all the changeable actor bits for an individual actor.

We can define skins for actor helpers or bots, or we can define their weapon preferences and other bot charactristics.

Even we can define individual names for the NPCs, useful for bots as the game wants to announce their actions, and will become more useful if Randy implements a dialog system within the game. I am working on one with the help of these NPC lumps.

IQ defines the ability of the actor to perform some specific tasks within the AI net. i.e. an actor may be too dumb (or too smart) to perform a specific task, or begin a specific route.

Different tasks are given to actors within the AI net, and they will go about to perform them, and the net can check current_task, to decide where to send them, and when the task ends as a success or failure, their prev_task would be set to it and they would aquire new tasks to perform.

Level designers can emulate different morals for actors by giving them a specific moral value and defining different tasks for different morals within the AI net, so we can have offensive actors as well as defensive ones and even scared actors that evade opponents.

Actors can have different personalities as well, This can be done by setting the field Action_Style, some actors may behave just like current actors, i.e. stand still until they aquire a hate target, some may like to be idle and do small things, like walking around aimelessly while whistling to themselves.

Some actors may like to be on guard and watch around their place, and other actors may want to be in the middle of action and perform tasks around the levels.

Initially actors are unaware of enemies around them and are not so keen as they look around, but if they hear a sound, they would become alarmed and would look around a bit more carefully than before, but if they actally spot an enemy around, they would be their most cautious self and look around with utmost care.

The actors can be organized into departments, like CTF teams, or sides of a battle. We can have 256 teams and each team can have 256 departments and each department can itself be divided into 256 parts and then another 256 parts, i.e. a total of 2^32 departments in four levels.

Useful to organize the actors into different sides and each side into different task groups, to organize the action, for instance in a CTF game, we can have two or more teams that attack each other, each team can have defensive and offensive crew, and the offensive crew can be divided into 3 parts that would attack from left, middle and right, toward opponent bases, (depending the map design)...

Or we can have a battle between different sides and each side can be organized into commanders, sargeants, troopers, engeenears, medics, and each would have different tasks to perform.

Or we can have a battle between demons and humen, the demons would not be organized at all and would charge the human base in hordes, but the humen would have different departments, and defence themselves in an organized way...

Somewhere in Mapinfo we can organize the teams, so the teams know which teams they hate, and which teams are indifferent, and which teams are allies.

Code: Select all

MaxTeams=4
TeamHate=1,3
TeamAlly=1,2
Thus we would have 4 teams in the map, and team 1 and team 2 would be allied and they would attack team 3 and team 4 would be indifferent to all of them. Usefull for a battle between three sides with indifferent native people, or animals.

This can be changed by script functions like :
  • Team_Hate(int team1,team2)
  • Team_Clear(int team1,team2)
  • Team_ally(int team1,team2)
In these cases team departments are treated as the whole team.

The new actor bits:

Actor can swim bit lets actor to act as flying monsters withing water zones, want some crocs in your levels?

Actor can jump bit is checked by AI network to give the actors the tasks that need some jumping around, like jumping down from over a ledge.

Actor avoids fake floors, want to keep that fish under water, or that caco from entering that boiling blood?

Actor stays wired to AI net, i.e. would not leave the net for unwired areas.

Actor stays unwired, means it would not use the AI net at all and would act just like current monsters.

Actor carries the flag : In a CTF game it can be checked by AI net to guide the actor to the right way.

OK, back on the AI network structure:

Map Nodes are the signposts that mark the levels for the actors to follow, these make the basic AI network and will prevent the actors from being stuck behind structures and closed doorways.

The node objects can be attached to sectors by tags, or else they can control only the space within themselves, the space controlled by each node is called a Cell, (i.e. the sectors attached to the node or the space within the node object itself).

They also have flags to show the actors that they can perform some specific task by these nodes, i.e. a node may inform scared actors that it is a safe places as another node may tell the actors that they can initiate missions from there. Another node can have more than one of these flags, so it would attract more actors to itself.

The node structure is like a normal map object with these included:
  1. Sector tag Attached to any sector?
  2. Link tag You know, the nodes are linked to each other
  3. Radius Node object radius, useful when not attached to any sector
  4. Height Node object height, ditto
  5. Department Nodes belongs to a department. Organize the battle!
  6. Node style bits some bits to specialize the nodes :
    • Enabled Active or inactive, that's the question.
    • Border A port to unwired parts of the level.
    • Idle Hey you lazy bastardo, over here.
    • Guard Want to guard areas, come here.
    • Mission Got some tasks to perform, any volunteer?
    • Report Ok, what happened out there?
    • Attack I know how to kill'em, can you fly?
    • Defence Want to defend yourself? Peace of cake!
    • Retreat Better go that way, before it is too late.
    • Safe A safe place for scared actors.
    • Resource Bot's resources; need some health?
    • Goal Warning, here is the ultimate goal of the level, a CTF Flag?
    • Other... Any suggestion?
Sector tag informs the AI net which sectors are this node's cell, if it is 0 then the node only controls the space volume that it covers.

Link tag attaches the outgoing link objects to the node.

Radius and height define the node volume, these value are not needed if a sector tag is set.

Department, define which department of actors would seek this node actively, i.e. if the node department is set to 1-3-0-0 only the actors from 3rd department of the first team would seek this node for actions, it is free for all the actors if they just want to pass it but it would initiate actions only for it's specific department.

A department of 4-0-0-0 means all the actors of 4th team will use it and a null department value will say it is free for all.

Here is a brief description of node style bits:

A node marked as Border will be seeked by the actors which want to exit the wired part of the level for a target outside it, they would look for the nearest border node to the place and when they reach the node, they would take initial instructions from it to exit to the unwired part, more about the instructions later.

Action nodes marked as Idle, Watch, and Mission task starters, are seeked by actors that want to start a new task and have not aquired a hate target yet (or again), so these actors seek for the nearest such nodes, that match their persona and start their new task from there.

Report nodes are the ones that actors would seek after finishing a task (successfully or not), and from there they are guided to their new tasks.

Reaction nodes that are marked as attack, defence, and retreat nodes, are seeked whenever an actor spots an enemy and wants to react in some way to it (depending on his moral), for instance if an actor is offensive and spots an enemy, it would start towrd the target but it and would check each node that it passes for Attack flag, if it finds an Attack node then it would search it for attack instructions that would match it's persona and also the place that the target was seen, it does as it is told, more on that later.

If a scared actor spots an enemy, it looks for nodes marked as safe, and selects the node that is furthest from the enemy target and also would not force the actor to pass from the cell that contains the enemy. But in the way it searches the nodes that it passes for the Retreat flag that match it's own persona and match the place of the target enemy, or has no specified target place, then if found one it takes istructions from it and forgets about the safe place, but if it reaches the safe place and does not find a matching retreat node in the way, it takes some matching instructions from the safe node.

Resource nodes are to be seeked by bots that are in need of some resources like more health or weapons...

A node marked a Goal is the ultimate goal of the game, like the placeholder for CTF flags... The actors would seek for these nodes within their mission tasks.

May need a new node field for goal numbers if we need more than one goals in a level...

All the nodes in the AI network are connected to each other by some link objects, i.e. each Node object is linked to one or more Link Objects (by tags) and each link object points to another Node Object, so the network is made of conditional one way links.

The link objects can be normal selective one way roads to a destination node (Neurons) or they can have style flags that would render them to be place holders for some instructions (Manual) that the actors would follow in some specific situations.
  1. Destination Node where it leads
  2. Action Special optional special to implement AI (only map script# needed)
  3. Min IQ actor should not have less IQ
  4. Max IQ actor should not have more IQ
  5. Required Bits actor should have these bits
  6. Rejected Bits actor should not have these bits
  7. Required Mission should be the current mission of the actor
  8. Link style bits some bits to specialize the links :
    • Hold fire actor will ignore hate targets until the next node
    • Border a border action manual
    • Idle an idle routine manual
    • Guard an area guarding manual
    • Mission a mission manual
    • Report a report manual
    • Attack an attack manual
    • Defence a defence manual
    • Retreat a retreat manual
    • Safe a camouflage manual
    • Resource a resource finding manual
Note that you can not combine some of these flags safely, but you may if you know what you are doing, but it is recommended to use only one of these flags for each link.

If you set more than one flag for a link, you are suggesting that the attached manual link is good for both tasks. A possible case is Safe and Watch, or Report and Mission manuals.

If the required mission of a link object is not null, only the actors that have that mission for their current mission are allowed to use the link.

Link object test bits for actors should be something like these:
  • Actor can fly
  • Actor can swim
  • Actor can jump
  • Actor has far attacks can attack the target from afar
  • Actor has near attacks can attack the target from near
  • Actor is deaf deaf bit is set
  • Actor is alarmed has heard a sound
  • Actor is aware has seen the target
  • Actor is offensive likes to attack
  • Actor is defensive likes to defend
  • Actor is scared going to escape
  • Actor is organic flesh vs metal
  • Actor has low health Less than %50 of health
  • Actor has very low health Less than %10 of health
  • Actor wont leave AI net stays connected
  • Actor avoids fake floors and ceilings
  • Actor is a bot
  • Actor is carrying a flag in a CTF game
  • ...
A destination node is a must for regular neurons but for manual links it is optional but some of them might require them for some purpose, but surely not as a destination node for route finding system.

The actual path finding within the AI net is done by a recursive selective route finding as follows:

Whenever an actor wants to reach a target, the AI net would mark the target cell within the net and starts from the node of the actor's cell (the node of the cell which contains him), then lists the node's neurons that match his persona in a circular list and starts from a random neuron within the list, selects the target node of that neuron and recurses the routine for the new node, until it reaches the destination node of the route.

In this process the routes that pass from a single cell more that once are instantly skipped and the first route that reaches the destination cell would be selected for the actor to follow.

If a neuron links a node to another one with the IQ limit of 40-100 then the actors of IQ=30 can not use the link or if a neuron requires the Actor_Can_Fly bit then the non-flying actors can not use the link. By this selective action we can make the actors to perform that would match their persona and they would look more real, for instance an actor may jump off a ledge while another one would look for a staircase.

If a neuron has no special then it will only lead the actors that match its conditions to the next node of their path, so they would go toward the destination node of it, but if a it has a special, then if an actor matches the conditions, the special is run with actor as the activator and the destination node as the first parameter.

The level designers can test actor's properties within the special for more control over the different races. They can also perform some tasks within the specials, like calling an elevator, and with these tasks they can imply some intelligence for the actors and as the different actors have different charactristics and they are taking these instructions selectively then all the different actors of a same area would not act the same and we should have some realism here.

They can finally command the actors to go to the destination node, by a function like Actor_GoToNode(int node).

If an actor asks for a route to a target and none matching his persona was found then, depending on his mission he would act differently, if his mission was to kill a hated target then he would act a current ZDoom actor and be on his own until the conditions change, but if he loses the sight of the hated target or if had other missions other than killing a target in hand and he could not reach the destination, then he would assume the mission as a failure and would try to report it, or start a new mission.

The actual implementation of the actor movement within the AI net is achieved by combining the current patrolling behaviour of the actors and their hate system, so that even if they are aware of a hated target, they look into the network for a path toward the target and dont just move toward him.

I mean that the current Chase, and VileChase behaviour should be changed to search the AI net for routes toward the target and in the end if no routes were found in the net then the current behaviour is performed, i.e. chase-attack.

So an actor would have a hate target and a target node, and he would use attack-seek-node method instead of just chase-attack with optional execution of neuron specials that may interfer with this behaviour, i.e. the current actors may open doors while chasing the target, but with this method they may do just anything that would come to the level designer's mind.

And the actors would follow the AI net routes even if they are aware of their target enemies, (contrary to the current patrolling actors), because the node finding and route following procedure is within their own Chase code and it guides them through the level hopefully toward their target, depending on the level designer's intentions, but this may not be the case.

For instance they may jump into a pit and go underground, then surprise the target from behind, or they may go toward an elevator and call it down and use it to go to a balcony, then from over the balcony jump over a bridge to come over a barricaded tower and jump into it to reach their target.

The neurons are used for pathfinding purpose, but manual links are used for other tasks for instance:

When an actors spots an enemy and he is not scared, he would start the attack-seek-node chase toward the target but in the way, he would search the nodes that he passes for attack or defense flags, (depending his moral), for instance he would look for attack nodes, and when he finds one, he would look into it's manual links for attack links that match his own persona and point to the cell containing the enemy, or do not point to anywhere at all, i.e. destination node is null, and when a match is found then, they would look at the manual link, if it has no special then they stay over the node and would not move and attack the target enemy from afar until they are killed or the mission is over i.e. they kill the enemy or lose sigh of him and could not find a way to him.

After that they would go for a report, but if the matching manual link has a special then it is run with the actor as the activator and the target node as the first parameter, from then on it is the task of the level designers to perform some intelligent actions that matches the actor and the target place, i.e. Flip a switch in front of the actor and flood the target place with nuke, for instance, or instruct the actor to jump over the enemy's head from above a ledge where he is standing on...

The defense and retreat nodes are just like attack nodes, with exception that retreat nodes are seeked when the actor is trying to reach a safe node, but if no matching safe node is found, then they would act just like when they are attacking the target, with the difference that they would look for retreat nodes in the way.

Idle, Guard and Mission manual links are seeked whenever an actor is in need of a mission and has not aquired a hate target yet (or after another mission if not auired a mission in a report node), if a matching link is found, either it has a special or not, in the latter case they would just stay over the node object face it's direction, and if it has a special, it is executed like other specials in the net.

And if an actors want to report about a past mission, he would actively seek nodes with report flags that would match it's persona (including department), and if a report manual link matching his persona is found, then he would try to reach the node and after that would execute the special or stand still if it has no special.

Border manual links are used when an actor wants to unwire, to instruct him some initial actions, like openning a door to the unwired area. As a border manual link would unwrire the actor before executing the special, the link sould ignore the target node of the link and also unlike other similar cases if the link has no special, the actor would not stay over the node object, because he is free and would act like any current ZDoom actor.

The exception is when the actor has a bit that prevents him from becoming unwired, in this case he would stay wired to the net and would ignore Border manual links and would act as if there are no such links in the net.

Resource links are to be used by bots and as currently I do not know the bot capablities I have not decided about them yet.

There are some default mission types and the level designers can make new ones, if actor has no mission then the field is null but he can have some :
  1. Heard a sound and going to investigate
  2. Saw an enemy, going to kill
  3. Searching for new missions
  4. Attacking an enemy, (Attack Nodes)
  5. Defending their place, (Defend Nodes)
  6. Retreating or hiding, (Retreat Nodes)
  7. Being just idle, (Idle Nodes)
  8. Guarding areas, (Guard Nodes)
  9. Performing a mission, (Mission Nodes)
  10. Reporting a mission's result, (Report Nodes)
  11. Searching for safe nodes
  12. Hiding in the safe place, (Safe Nodes)
  13. Performing unwired tasks, (Border Nodes)
  14. Searching for resources, (Bot:Resource node)
  15. CTF flags like :
    • Guarding the flag
    • Going for enemy flag
    • Retrieving enemy flag
    • Going for the base flag in the hands of an enemy
Each time an actor is given some instructions by a special map node (like Attack Node), it`s current mission field is set to that mission (like 4 as Attacking_an_enemy), but the level designers can change that value any time in the course of the actions, to force him do some specific actions that differs from other actions.

Level designers can assign some other missions to the actors by a script function like Actor_SetMission(int mission) and they can check this value by something like Actor_CurrentMission, and Actor_PervMission.

It is useful to define instructions for some specific new types of missions that only actors performing that specific missions would follow.

Using this mission based control over the actors we can easily make CTF levels with computer controlled actors and the players, we should just try some ingenious scripts to emulate the bot AIs for those CTF levels.

Here are some technical useful info:

The level designers should be able to turn off and on some nodes in the realtime, for instance for the times when they want to flood areas with lava and want to force the actors to avoid these areas or maybe when they want to make the actors ignore some places initially and then after removing obstacles, let them use that areas.

Some nodes can be placed in the middle of the air for Flying monsters and the neurons leading to them can make sure that only flying actors would try to reach them.

Here is a tip to make actors behave more lifelike and do not see into the darkness :

Whenever a target gets in the FOV of an actor, a calculation is made between the actor's Sight power and the target's visibility and the distance between them and the light value of the sector that the target is standing on, then if the result is OK then the actor would see the target, and if not then it would simply ignore the target.

Thus if we are able to change and check the Sight and Visibility factors of the actors, (including the players) we can have a fully functional Stealth system incorporated into the levels, with Cloaking devices and such, or RPG elements like Stealth skill that can be gradually improved...

The actors can now behave differently if they hear a sound from enemies, curently they become instantly aware of their target and it's whereabouts, and would sence its position from behind the walls. This was good for the original Doom as they could not find their ways around the levels, but now we can change the behaviour to this :

They can mark the original place that the sound was made (i.e. mark the attached node) then they would change state from unaware to Alarmed and would try to reach the target node, via the AI net, then if in the middle of the route they spot the target enemy they would search the net and adjust their route for the new position and change their state to Aware, each time they lose track of their target they would mark the last place that he was seen and would try to reach there, and if they spot or hear him again, they would readjust their route toward him again (aware or alarmed).

The differnet states of the actors would affect their Sight powers so if in the Unaware state they have a specific Sight power, in the Alarmed State, they would be slightly more keener and would see better into the dark, and distance, and in Aware state they would be even more keener than before.

And if they are shot, they would become instantly aware of their target even if he is hidden in a dark and distant place and mark the place for destination, but if after that the shooter changes place and move to another dark place, and they don't see the actual movement, then they may lose track of him, in this case they may stay longer at the target node and search the area a bit more than usual, but eventually they may lose interest and announce the mission as failed and go about their business.

Something else, if the actors are chasing a target and they reach to a place that has the same Path node as the target has, then they would ignore the AI net and behave like a normal ZDoom actor, i.e. a Demon may circle areas and moves about a complcated way toward the target, but as it reaches to the destination Cell then it would charge toward the target and attack him as a normal Demon would do, with the exception of when it had lost sight of the target, so that it would try to reach the target node and search the area from there.

i.e. any time the actor and the target enemy are in the same cell the actor would ignore the AI net and would act as a current actor. This is a must for near-attackers.

Another thing, if the actors want to start a route they are not forced to reach the Node of their cell before they go toward the next Node, and they can check their Node for the next Map Node and go toward it initially, and this would apply to Reaction Nodes as well, i.e. if an actor spots an enemy and wants to attack him from afar by an Attack Node, he would check the Attack Links of that Attack Node from afar before even it starts to go toward the Node and if he finds a match for the Target place and his own persona in the Attack Links then he would start to go toward the Node and take the instructions from there.

If no match is found, then he would start the normal attack-seek-node route toward the target enemy, but in another cell he might find another attack node and restart the routine again.

And I think for the actors that are following a route, if they lose sight of their target, and they reach the target node, and fail to see their target, they should completely forget about him and become unaware of him, and would do normal tasks until they aquire new targets. This should be default behaviour of the actors in the end of the routes, and it would not affect the actor behaviours in the current levels, because there are no routes in them.

And remember, all these would work if we have an actual AI net in the level, and/or by checking an option in the MapInfo lump, and for ye olde Doom levels nothing would change.

Actor sight calculation:

Randy, is it too hard to implement actor sight calculation?

I have experienced with the formula and I came to a conclusion:

Actor vision formula:

l=(0-255)=Light value of target's sector
s=(0-255)=Actor sight
v=(0-255)=Target visibility
d=(0-25000)=Distance between actor and target

fl=Light factor
fv=Visibility factor
fd=Distance factor
dc=Distance cue

Lg(x)=ln(1+x)

if these phrases are true the target is visible:

fl*Lg(l)+fv*(Lg(s)+Lg(v))-fd*Lg(d) > dc
or
d < Exp(fl*Lg(l)+(fv*(Lg(s)+Lg(v))-dc)/fd)

Suggested values:
I have tested lots of different values but these values gave the best results

fl=2.0
fv=1.0
fd=1.0
dc=12.8

Examples for maximum visible distances:

Keen sight, Visible:
l=255, s=150, v=100 : Max(d)=2758 Map pixels
l=192, s=150, v=100 : Max(d)=1551
l=128, s=150, v=100 : Max(d)=700
l=064, s=150, v=100 : Max(d)=177
l=000, s=150, v=100 : Max(d)=0

Human sight, Visible:
l=255, s=100, v=100 : Max(d)=1865
l=192, s=100, v=100 : Max(d)=1048
l=128, s=100, v=100 : Max(d)=468
l=064, s=100, v=100 : Max(d)=118
l=000, s=100, v=100 : Max(d)=0

Keen sight, Stealth%25:
l=255, s=150, v=075 : Max(d)=2075
l=192, s=150, v=075 : Max(d)=1179
l=128, s=150, v=075 : Max(d)=526
l=064, s=150, v=075 : Max(d)=133
l=000, s=150, v=075 : Max(d)=0

Human sight, Stealth%25:
l=255, s=100, v=075 : Max(d)=1388
l=192, s=100, v=075 : Max(d)=788
l=128, s=100, v=075 : Max(d)=352
l=064, s=100, v=075 : Max(d)=89
l=000, s=100, v=075 : Max(d)=0

Keen sight, Stealth%50:
l=255, s=150, v=050 : Max(d)=1392
l=192, s=150, v=050 : Max(d)=791
l=128, s=150, v=050 : Max(d)=353
l=064, s=150, v=050 : Max(d)=89
l=000, s=150, v=050 : Max(d)=0

Human sight, Stealth%50:
l=255, s=100, v=050 : Max(d)=931
l=192, s=100, v=050 : Max(d)=529
l=128, s=100, v=050 : Max(d)=236
l=064, s=100, v=050 : Max(d)=59
l=000, s=100, v=050 : Max(d)=0

Keen sight, Stealth%75:
l=255, s=150, v=025 : Max(d)=709
l=192, s=150, v=025 : Max(d)=403
l=128, s=150, v=025 : Max(d)=179
l=064, s=150, v=025 : Max(d)=45
l=000, s=150, v=025 : Max(d)=0

Human sight, Stealth%75:
l=255, s=100, v=025 : Max(d)=474
l=192, s=100, v=025 : Max(d)=269
l=128, s=100, v=025 : Max(d)=120
l=064, s=100, v=025 : Max(d)=30
l=000, s=100, v=025 : Max(d)=0

Example sights:

Actor helpers (humen) :
Unaware sight : 75
Alarmed sight : 100
*Aware* sight : 125

Mancubi :
Unaware sight : 80
Alarmed sight : 110
*Aware* sight : 130

Archviles :
Unaware sight : 100
Alarmed sight : 125
*Aware* sight : 150

Example visibilities:

Spectres : 50
Normal actors : 100
Lost souls : 200

Visibility suggestions:

I think blur spheres should halve the visibility factor for the duration of their effects.

Stealth monsters should have visibility of zero when they are hidden.

When the actor's sprites are full bright (shooting frames) then their visibility should be double their normal visibility.

Simpler formula:

In the actor sight calculation formula that I have suggested, as all of the factors are integer numbers, and if you don't want to let the users to change the formula factors, and you want to keep it a fixed formula, then we can change this formula into this:
  • (l*l*s*v)/d > 360000
  • or
  • d < (l*l*s*v)/360000
You can play with the number 360000 to get the best results.

Main menu option:

You can add an option in the main menu to let the players be able to select this actor sight checking for the older levels, if they like it.

A battle scenario that will be possible to implement, with this new AI system:

You enter an area and there are a Revenant and several demons scattered around a yard patrolling the area or doing idle jobs, like eating corps or snorting or sniffing at the corners, as the monsters see you the revenant runs toward a staircase and starts to climb it, while at intervals it stops to shoot a fireball at you, in the meantime the demons are running toward the far right doorway to enter the terrace over which you are standing, the revenant reaches a door, opens it to enter a room containing a turret, stands behind the turret and starts to shoot imp fireball toward you, (while behind the turret it will not fire it`s own fireball at you), and you run around as the demons eat the fireballs, one by one they retreat and exit to the yard and start to climb the stairs to the turret room and they attack the busy revenant, he kills his attackers by punch and returns to the turret... until he eventually dies and the demons exit the room and descend to the yard and enter the terrace to attack you, without loosing their way.
Last edited by Sphagne on Sat Jul 26, 2003 6:33 am, edited 2 times in total.
User avatar
Zell
Posts: 791
Joined: Thu Jul 24, 2003 7:47 am
Location: IN A GODDAMN BOX[In Erie.]

Post by Zell »

the human actor helpers, maybe they could be implemented to say like, "taking fire!" or "Got one" like the cop in half-life. that'd be cool.
User avatar
Hirogen2
Posts: 2033
Joined: Sat Jul 19, 2003 6:15 am
Graphics Processor: Intel with Vulkan/Metal Support
Location: Central Germany
Contact:

Post by Hirogen2 »

Reading it...
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

Interesting read but one big question:


How the hell should all this be implemented without a complete rewrite of all the internal game logic? This would be no longer Doom! It's more like EDGE squared.
User avatar
Sphagne
Posts: 513
Joined: Wed Jul 16, 2003 3:36 am

Post by Sphagne »

Well I know that Chase and VileChase Code pointers should change and Maybe the monster reactions while they see or hear enemies, and maybe adding support for NPC lump, and AI net management, new actor properties...

Thats lots of features and I know it so I am not hoping to see them implemented in about a week, but I know that if they are implemented, we shall have a ZDoom that gives more designing power to the level designers than lots of the more modern games... 8-)

But it is all just daydreaming now.

Let's cross our fingers. :wink:
GameArena
Posts: 182
Joined: Wed Jul 16, 2003 4:35 pm
Location: Outside of a bubble... Looking at all the humans inside.

Post by GameArena »

I don't think you realize what an insane amount of coding this would require. It wouldn't exactly be hard, but would be without a doubt, tedious and epic. While I was working on WoW I added a waypoint system with only 3 different nodes: Prone, Snipe, and Guard (Where they would not stray more than a certain amount from the point). With just those 3 it was a vast amount of lines, and that was only with a little enviromental logic. So they'd change the way they acted based on the their health, the players health, ammo and so on. Before you elaborate on your plan to much further, I suggest you try to get a definite answer on whether Randy is willing to take the time to add such a feature.
User avatar
Hirogen2
Posts: 2033
Joined: Sat Jul 19, 2003 6:15 am
Graphics Processor: Intel with Vulkan/Metal Support
Location: Central Germany
Contact:

Post by Hirogen2 »

A basic of that can be implemented. The rest you have to do ;)
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

GameArena wrote:I don't think you realize what an insane amount of coding this would require. It wouldn't exactly be hard, but would be without a doubt, tedious and epic. While I was working on WoW I added a waypoint system with only 3 different nodes: Prone, Snipe, and Guard (Where they would not stray more than a certain amount from the point). With just those 3 it was a vast amount of lines, and that was only with a little enviromental logic. So they'd change the way they acted based on the their health, the players health, ammo and so on. Before you elaborate on your plan to much further, I suggest you try to get a definite answer on whether Randy is willing to take the time to add such a feature.
As an experienced programmer I'd say that something like this might easily take a year or two to implement until everything is tuned to work right and all bugs are ironed out. With a small programming team this might be manageable but for one person this can quickly turn into an endless task. Considering that the amount of mappers which would actually use it would be rather small (most maps don't even contain modified monsters!) my advice would be to skip it and concentrate on more important things.
User avatar
Sphagne
Posts: 513
Joined: Wed Jul 16, 2003 3:36 am

Post by Sphagne »

Well, It will take lots and lots of tedious work for ordinary programmers to to the job, but we all know Randy for sure and he may find shortcuts that we can not think of, but on the whole you are right.

But some parts of it are quite independant from others like the new swim and avoid fake floor actor property bits or the monster sight calculation... so if he starts from that places, they are quite good features to add to the game, then some day we may hear that Randy has done it all.

I have seen this sort of things from Randy, or else I would have not thought to write all these here.

Lots of the new ZDoom features, were made from scratch, but as I have said before, I dont expect a miracle. :wink:

P.S. In these ideas there are lots of small independant ideas that can be realatively easily implemented that would not require the other part to work to a degree and those parts can be done one by one until we may require just the core AI net to have it all completed.

For instance Adding IQ to monsters and giving the default Doom monsters different IQs and adding the support to dehacked and making this actor property available to scripters to check and change, we can write scripts that check actor IQs to perform different tasks. and I t would not need the whole AI net to be used...
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

Sphagne wrote:Well, It will take lots and lots of tedious work for ordinary programmers to to the job, but we all know Randy for sure and he may find shortcuts that we can not think of, but on the whole you are right.

Don't insult me! :wink: I've been doing programming professionally for 10 years now and normally my expectations of how long something like this will take are quite correct. This will be a huge pile of work if done full time. To be more precise this AI stuff is probably the most time consuming work of all because it is so hard to test. I worked on a project that contained some AI programming and the programming and testing of this stuff took 2 people almost half a year and that was significantly simpler than what you suggested.
User avatar
Sphagne
Posts: 513
Joined: Wed Jul 16, 2003 3:36 am

Post by Sphagne »

Well, you know, I am not as amateur as you may think, because we are in the same proffession.

I started programming for hobby when I was 11, when a friend bought me a ZX Spectrum, and I have been constantly hacking and changing games since then, and even writing some from scratch, (I had my own Wolf3d episodes years before I heard about the programs that changed it). Let alone my serious programming business which is about the same as yours, You know I started a bit young. :wink:

Back to the topic, I started this thread after I looked at the available ZDoom functionality, mind you I am not a C programmer so I did not look at the source, all is from what I see on the screen and what I guess from past experience, so I may be wrong, but :

Currently we have map spots and patrol points, we have patrol point specials, we can influence monster hate target, All of these were not there in Doom, but were implemented by Randy.

So if we take these available resources and combine the Patrol points and their specials into the Chase code pointer and the monster hate system, i.e. add the patrol point target to the hate target, and we can have them both working together, so the monsters would follow a defined path even if they hate another actor and would stop to shoot at them at intervals.

I dont know how much work it would need but if it is done we have taken a good step toward the goal, If I know this can be done, I will become sure of the way ahead, just read away...

Well, the next step is to make a new type of patrol point that have a some basic AI node charactristics, we dont want to take a big step, so that we might fail it, just small steps...

So we make a node object that is attached to some sectors by tag and also to some link objects by tids, no checks and flags for now, the link objects should be another type of objects like patrol point specials but they should only have a destination node just for now, so we may have a very basic net made of nodes and one way links with no conditional checks, and so on...

Then we can place these nodes and links in a test level and change the new Chase code to work with the new AI net as follows:

The original patrol points told the actor to go toward the next point and the next one sent it toward the next one and so on...

But now the actors should have a new field that can hold a linked list of object indexes that point to node objects, this can be called Current_Route, at the begining of the chase the actor checks this route to see if the final node is the one that holds the hate target, if so then it follows the route nodes just like a normal patrolling monster, (but toward a hated target).

If not then it asks the AI manager to find a route for it, from his current cell to the cell that holds the target, the AI manager calls a recursive routine to check the node-links net, (you know, each node is connected to other nodes by some one-way link objects), and it would skip routes that pass a node more than once and calls this recursive routine till it reaches the target cell, or the links end without a result. No doubt, some optimization here would speed up the routine but for the start this would suffice...

The instant the AI system reaches the target cell, it extracts the route object indexes and places them in the actor's route field, for him to follow.

If the target moves and changes cell, then the actor looks in his own route list to see if the target is still within the route, if so then it truncates the route to the target place and continues his way toward him, and if not then it would ask for a new route toward the target...

This would happen again when the he loses sight of the target and sees (or hears) him again, and this route would eventually lead him to his target.

I want to know how much work is needed to build to this part of the AI net? you know only this fraction of the whole lot would make sure the actors know how to follow the net around the levels.

The next step is adding specials to the link objects to be run and adding a new script function like Actor_GotoNode to be run at the end of the special routine to make sure the actors would continue to follow the route, now the actors would perform special jobs in the middle of the route, jobs like calling down an elevator or jumping down a ledge...

The next step would be adding conditions to the links and adding some new actor properties as I have suggested, now we can fine tune the net for different types of the actors...

from now on you have a good working net available that only needs enhancements in the future, you can release it to the public to be tested, just remember to add all the final fields and properties to the actors and node and link objects even if they would not work for now, because you would not want to be stopped in the track for the compatibility problems.

By now you would have monsters that would know their ways around the levels and could do lots of actions in their ways toward their targets, but there would not be any different types of nodes and links, like : Border, Attack, Defence, Safe, Mission...

When the basic net is available you can take your time to add these new types of nodes and links one by one...

Well I just wanted to tell my oppinion in the matter and it is that I dont think this is such an epic project as you may think, because lots of the functionality is currently available, am I correct Randy?

Well even if I am proved wrong, then how about thinking about my last proposal :

These ideas have lots of independant part from which some are real good, how about implementing some of those independant ones?

I am really serious about that monster sight calculation and it would add a great feature to the game. And any time you implement it into the game, we can await a new wave of thiefy and stealthy levels that require the players to stick to shadows and dark places, and turn off room lights and so on... quite some new possibilities here, so please think about it. :)
GameArena
Posts: 182
Joined: Wed Jul 16, 2003 4:35 pm
Location: Outside of a bubble... Looking at all the humans inside.

Post by GameArena »

You can't really shortcut AI, as there is no real standard. As someone stated previously, I doubt it would take over a year, if you were to work pretty steadily on it, something could be easily be done with a month. Perfected? No. But still usuable and worthwhile.
User avatar
randi
Site Admin
Posts: 7746
Joined: Wed Jul 09, 2003 10:30 pm
Contact:

Post by randi »

I still think what you're suggesting is a lot of work. If you're suggesting I actually use a neural network for AI, I have zero experience with that, so I would need to do a lot of research before I even attempted to work on it. For more traditional path finding where you just search a graph, I also lack any experience with performing it in real time with a moving target and changing world conditions.
GameArena
Posts: 182
Joined: Wed Jul 16, 2003 4:35 pm
Location: Outside of a bubble... Looking at all the humans inside.

Post by GameArena »

That's where I come in :P
User avatar
Sphagne
Posts: 513
Joined: Wed Jul 16, 2003 3:36 am

Post by Sphagne »

Well, Randy, just think about it, I think that GameArena has about grasped the essence of it and suggested a month of work would give us a simple but working version of it, and I think I have described it (badly, I know) in my last post, will you read my last post in this thread more carfully, please? :D :D :D

I am not suggesting a neural network AI, I chose these names because of some similarity between my links and neurons, and like you I do not know about the pattern recognition and other AI by neural networks.

All that I am suggesting is a way to guide the monsters to their tagets by a thechnic like the current patrol points, and if you can combine the Hate system and Patrolling system then what I am suggesting after that is running a recursive routine function that moves from a node to another until the nodes are finished or we reach the target's node, no optimization for now.

Whenever the AI logic fails and the monsters do not find a way to target they can revert to the curent behaviour. (until the implementation of Report... nodes.)

Well, I think the good point of these methods is that you can write it in a way that would look as if they have not changed a bit in current maps.
Last edited by Sphagne on Mon Jul 28, 2003 7:33 am, edited 1 time in total.
Locked

Return to “Editing (Archive)”