system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: How does AI (Bots) work in video games?
gpt
AI in games has to have a couple things first; you have to have a designed goal for the AI to do first, and allow it access to stuff to achieve that goal.

In a video game this might turn out to be something like a standard fighting game; where the AI is designed to win the match, and is given access to button combination inputs to achieve that.  If they want to get a bit into it with difficulty settings, they could change which moves/combos the AI can execute, or how quickly it reacts.

In something else like a strategy game, they tend to give the AI certain goals to hit before launching an attack/defending an attack.  IE: Have 10 builders/harvesters, 20 attackers, and 2 defensive structures; then issue commands to move attackers across the map toward a target destination.

How that all is built is basically programming the AI, although depending on what you want the AI to do, it might range from just mashing buttons to figuring out pathfinding for a giant army.  And in plenty of cases, the person programming the AI might let the AI cheat a bit.

Now in cases where people argue they want difficulty to mean something more than enemies become bullet sponges, while the player hits like a wet noodle.  They want the difficulty increase to mean enemies are smarter too - but that comes at a cost in programming & CPU cycles.  Is it really worthit to add in more in-depth AI that checks whether one room is good to hang out in because it has a lot of cover (and having all the programmatic checks and balances to go with that), or use those precious spare moments on the CPU to push out a few more frames per second?