Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Making the AI

Author
Message
KamaKase
21
Years of Service
User Offline
Joined: 29th Oct 2002
Location:
Posted: 10th Jul 2004 01:17
I know this is a very evil topic....which I'm sure everyone hates. To get myself back into the swing of DBPro programming (I've started too many projects, so I'm gonna try and hammer them out....but first: ).
The trouble is, as I'm doing this mini project, I've never actually got round to having to do any AI before. Is there a standard way of doing it? In general??

I was just going to use a couple of (oh I've forgotten the name of that variable type...you call it with the DIM command) use it to analyse every "active" object within close proximity to the object, and then depending on the "mode" of the object deciding which has the top priority and then dealing with that....and if possible dealing with another one at the same time.

Is that a decent way of doing it? I often fail to see shortcuts and I don'wanna waste my time.
zircher
21
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 10th Jul 2004 05:28
Arrays?

AI tends to be very problem specific. Each game has its own problems and ways of solving them.
--
TAZ

History did not begin with PONG. -- Greg Costikyan

Game Beavers
KamaKase
21
Years of Service
User Offline
Joined: 29th Oct 2002
Location:
Posted: 11th Jul 2004 05:37
"Arrays?"

...that's the one!!!

"AI tends to be very problem specific. Each game has its own problems and ways of solving them."

...I thought that was coming.....it's very much a grey area with games. Oh well, thanks for reminding me of Arrays!! *smacks head*.
Physics coder
20
Years of Service
User Offline
Joined: 25th May 2004
Location: United States
Posted: 12th Jul 2004 05:54 Edited at: 12th Jul 2004 06:05
Quote: "
"Arrays?"

...that's the one!!!
"

lol
what type of game is the AI for? RTS, FPS, Racing, etc...

usually when thinking of a way to program AI, and i don't know where to begin, I usually get the game ready for it, as in functional with ammo, shooting, armor, whatever is is your game. Next I think of how I would play the game like:
if health>min_health_amount
get nearest health
else
if ammo>min_ammo_amount
get nearest ammo
else
go to player and attack
endif
endif
this would need functions for get nearest health etc. but it makes sense. changing things like min_health_amount would affect the style of the AI player, like if min_health_amount=0 he would dual the player to the death the first time he saw the player. or if min_health_amount=100 the ai would run away the first time get got shot.

you would loop through all the AI players like that. also you can give the ai different accuracy amounts depending of the difficulty setting.

the 'go to player and attack' on a lower level would be:
if los(player)=true
aim
shoot
else
get path to nearest waypoint with los with player
follow path
endif

it can get a LOT more complicated with Team FAA or different power-ups.

last year I made a game where the items the player could pick up were something like:
ammo(MISSILES)
health
grenade
laser
teleport

EDIT: forgot to say these types of weapons are ranged weapons, you'd need to program AI to use the infinite range LASER when the normal MISSILES are out of range, use MISSILES when the enemy is in range, or use the damageful-GRENADE when the enemy is within range of the AI player, and outside the blast radius(wouldn't want him throwing grenades when hand-combat would do(unless the AI is a terrorist) /EDIT

In the game I made a while back i programmed the hardest AI to always have "get teleport" at the top priority, so it would get a teleport, and if the AI was 3 shots from death it would teleport to a random spot on the level, thus become invincible, lol.

you will also need a way to see if the AI is under attack, and if so, decide what to do. if the ai is on its path to get a teleport, gut during the trip an enemy starts attacking him, then fight back cuz it can do without the teleport for a while.

or like if an a player is under attack and he's on the same team as the AI player, should the AI go and help the friend or get more missiles?

also if the AI is under attack by 2 or more enemies, it should always attack the weaker one as the sooner you have less enemies, the better.

Sorry for rambling, I like AI programming. lol.

So yeah, to sum it up, it's really game specific and how you want your AI players to play the game.

-----------------------------------
To delete the bug, delete the code.
Specs: Sony VAIO Laptop, Windows XP, P4 2.8Ghz, 512MB RAM, ATI Radeon 64MB video memory, DBP Upgrade 5.3.
KamaKase
21
Years of Service
User Offline
Joined: 29th Oct 2002
Location:
Posted: 12th Jul 2004 09:39 Edited at: 12th Jul 2004 09:40
Thanks, that's a great help......I guess I was just trying to wimp out.
It's no way near as complicated as that, but it's hard to get your head round on your first try.
Advice: just get on with it and try.

My only problem is that for FPS's etc...you can rely on the route finding to do the moving aspect.

You'll see what I mean if/when I finish my pitiful game.
zircher
21
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 13th Jul 2004 02:03
You might want to do some research on AIs in general. While some of it can be very complex, the reality is that AI is just finding a simple method to solve a problem.

Amit's site is one of my favorites. It is not written for DB, but you can take the ideas there and apply them to your programs.
--
TAZ

http://www-cs-students.stanford.edu/~amitp/gameprog.html

History did not begin with PONG. -- Greg Costikyan

Game Beavers
KamaKase
21
Years of Service
User Offline
Joined: 29th Oct 2002
Location:
Posted: 17th Jul 2004 00:29
Hey, that's a VERY good site. Loads of very useful stuff. Thanx a lot!!
eat much pie
20
Years of Service
User Offline
Joined: 9th Apr 2004
Location: Within the mind of a lowly mortal...
Posted: 17th Jul 2004 01:56
Quote: "
the 'go to player and attack' on a lower level would be:
if los(player)=true
aim
shoot
else
get path to nearest waypoint with los with player
follow path
endif
"


I'm currently making a program that will allow you to make these paths called Checkpoint Router. It has loads of functions (see my site for more info, link's in my sig) and is a simple click-to-use piece of software.

If you have questions about it, visit:
http://forum.thegamecreators.com/?m=forum_view&t=32596&b=5

It should be done by the end of July/beginning of August.

Happy Coding!

Checkpoint Router: my very own AI routing program: http://eatmuchpie.dbspot.com

Login to post a reply

Server time is: 2024-09-22 16:28:14
Your offset time is: 2024-09-22 16:28:14