Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

A bit 'hasty' on AI


ghost's Avatar
0 0

Artificial Intelligence. I understand where it takes place in video games.. But I am a bit confused on well.. Its structure, etc etc. If anyone here know much of it or anything or programming AI into gaming could your please provide a example script. Or code snippet. Just so I can get an idea of its outlook. Anything you know of the topic I guess I am willing to hear. I was doing a lot a google reading on it the other night.. Its just a crazy impact.


Uber0n's Avatar
Member
0 0

I've been coding AI for some simple games. The thing about AI is that you can make it extremely simple or very complex - depending on the situation.

For example, the AI in Pac-Man (make the ghosts go towards you, but make them flee when they're "scared"/vulnerable) differs a lot from the AI in BattleField 2 (bots go to different places, work together in groups etc). If you explain a bit more in detail what kind of AI you're thinking about I might be able to help you more.

A common method for controlling AI is to make an "action stack". You know what a stack is, right? The last thing added to the stack is the first one retrieved; this is the opposite of a queue. For example, say the bot wants to go from place A to place B. Then you add "goto place B" to the bot's action stack. However, if the bot meets an enemy on the way there you add "attack enemy" to the stack. The bot will attack the enemy and if the bot survives, it will continue with the last command in the stack (keep on moving to place B). This way you can make the bot remember many commands but still set the priority and order for different tasks.


ghost's Avatar
0 0

Okay, I understand that. Now this is going to be my first AI and I want it to pretty much be like "battle field 2". However that is bad for a first assignment. I want an FPS AI thats all I know for now. But maybe a gane with stick figures with guns killing bots. Or dying from bots. Something simple to start with.


ghost's Avatar
0 0

haha, youre still staring out too high.

how about, you make an enemy chase a player in a 2D world?

build from there. have the enemy go find a weapon, then chase the player.

continue on with that.


ghost's Avatar
0 0

To me that sounds like a good idea DigitalFire. I just picked up "Sams teach yourself C++." Now is scripting AI done in basic C++ or does is revolve mostly around the highly skilled? Just anything you can throw at me.


ghost's Avatar
0 0

You know what would be an interesting topic? A.I. search methods. "Finding" the player.


ghost's Avatar
0 0

As in what? Like a map with dots in which alert you of enemies, etc etc.


Uber0n's Avatar
Member
0 0

chronicburst wrote: Now is scripting AI done in basic C++ or does is revolve mostly around the highly skilled? I'd say most AI programming requires experience and skill in the programming language you're working with ^^ but if you're good enough to make a 2D platform game in C++ you'll definately be able to code simple enemies that follow the character around.

anonymous0x0001 wrote: You know what would be an interesting topic? A.I. search methods. "Finding" the player. There are two common methods for this that I know of.

  1. Let the AI object "know" the position of the other players by reading their X+Y position (X,Y,Z in 3D games) and making actions based on the distance between them.
  2. Let the AI object explore the map, like in most strategy games. When it encounters an enemy it will "learn" its position, perhaps explore the area a bit more and then starting an attack.

ghost's Avatar
0 0

Ok. Well before I get into this to thickly I am going to touch up my C++ skills. As for the 2d thing. That is a great start beause good to upload to my server!


Uber0n's Avatar
Member
0 0

chronicburst wrote: Ok. Well before I get into this to thickly I am going to touch up my C++ skills. That's a good decision B)

As for the 2d thing. That is a great start beause good to upload to my server! Make sure you tell me when you're done with it! I'm always interested in seeing other people's work.


ghost's Avatar
0 0

Will do. I actually think the hardest part of this process will be trying to find this thread to repost about my new achievements. Well off to do some reading :)