scitari Posted April 11, 2020 Share Posted April 11, 2020 I am looking for BASIC and/or assembly code examples for enemy AI. Any good resources or examples you know of? Are their particular AI code examples you like to use in your games? I have searched here an AA and haven't found much. Google is useless because of all the deep learning AI for playing Atari games pages that come up. I am particularly interested in AI for an enemy moving toward and attacking a player. Many thanks!!! Quote Link to comment Share on other sites More sharing options...
scitari Posted April 11, 2020 Author Share Posted April 11, 2020 Found this thread for the 2600 Quote Link to comment Share on other sites More sharing options...
Rybags Posted April 11, 2020 Share Posted April 11, 2020 Such things aren't machine specific. In the modern day it's more sophisticated but still relevant to older systems. Games like Wolf3D tended to use set paths combined with a pathfinding methodology if they spotted the player. In it's simplest form a pathfinding algorithm just heads for the player but in anything but an obstacle free open world it's a flawed concept because obstacles can halt the enemy in his tracks. Just throwing something in like random deviation can be sufficient to turn a simple faulty algorithm into one that looks and acts more intelligent. 1 Quote Link to comment Share on other sites More sharing options...
ilmenit Posted April 11, 2020 Share Posted April 11, 2020 Really depends on the game type you are doing. Is it real-time or turn-based? How many enemies are active in the same time? In action games usually the only viable option for machines with limited CPU is a variant of State Machine or Decision Tree, sometimes with some simple scripting language, sometimes "hardcoded". Basic info about Wolfenstein3D AI is in http://fabiensanglard.net/gebbwolf3d_v2.1.pdf 1 Quote Link to comment Share on other sites More sharing options...
scitari Posted April 11, 2020 Author Share Posted April 11, 2020 Implemented a very simple enemy tracking AI that is based on player position. Here is a short video. This is a concept for a game I am making. TEST.avi Quote Link to comment Share on other sites More sharing options...
Schlortt Posted April 12, 2020 Share Posted April 12, 2020 I agree with Rybags, obstacles add great complexity. One of my current projects is to add AI to 2600 Combat. Biplanes, Jets and tanks with open playfields were easy the tank levels with mazes were challenging to create and I still don't have it where I want it. For War Room, the AI was pretty simple. A few parameters in the game: - No obstacles but there is a green slime that starts in the middle and grows and the bullets are not unlimited - Bullets are not unlimited and bullet packs appear randomly - Game is broken into rounds where you have to outlast your opponent (IIRC, everyone gets ten hits.) This is from memory so it may not be perfectly accurate but AI Priorities change based on game state: Grabbing bullets are generally the first priority and this changes things up quite a bit and works to randomize things a bit. If AI has no bullets, it flees from the opponent If the opponent has no bullets, it gets more aggressive in attacking. If the AI has a lot of life left and the opponent is down to almost no life left, the AI gets more aggressive in attacking. Shooting: AI only shoots if it is lined up with the opponent Horizontally, Vertically or Diagonally. This shot is always based on where the opponent is and doesn't anticipate where the opponent will be. One thing that I have never figured out is that Player 2 is much better than Player 1 even though I think the logic is exactly the same. Search for "AI logic" in the assembly code... It isn't commented very well. 2 Quote Link to comment Share on other sites More sharing options...
scitari Posted April 13, 2020 Author Share Posted April 13, 2020 23 hours ago, Schlortt said: I agree with Rybags, obstacles add great complexity. One of my current projects is to add AI to 2600 Combat. Biplanes, Jets and tanks with open playfields were easy the tank levels with mazes were challenging to create and I still don't have it where I want it. For War Room, the AI was pretty simple. A few parameters in the game: - No obstacles but there is a green slime that starts in the middle and grows and the bullets are not unlimited - Bullets are not unlimited and bullet packs appear randomly - Game is broken into rounds where you have to outlast your opponent (IIRC, everyone gets ten hits.) This is from memory so it may not be perfectly accurate but AI Priorities change based on game state: Grabbing bullets are generally the first priority and this changes things up quite a bit and works to randomize things a bit. If AI has no bullets, it flees from the opponent If the opponent has no bullets, it gets more aggressive in attacking. If the AI has a lot of life left and the opponent is down to almost no life left, the AI gets more aggressive in attacking. Shooting: AI only shoots if it is lined up with the opponent Horizontally, Vertically or Diagonally. This shot is always based on where the opponent is and doesn't anticipate where the opponent will be. One thing that I have never figured out is that Player 2 is much better than Player 1 even though I think the logic is exactly the same. Search for "AI logic" in the assembly code... It isn't commented very well. Awesome! Thanks for posting 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.