AI is... working... better

Published July 28, 2006
Advertisement
Hey everyone!

Sorry I have been neglecting my daily journal posts, I was just informed a few days ago that I was actually hired full-time at my job rather than part-time, so now by law I'm required to work at least 40 hours a week, which means an 8 hour day, which means not much programming is going on, but a lot of planning has been going on in my head, so when I do program, it's pretty sraightforward[grin]

AI (Part II)
In my previous AI entry, I described in vivid detail the AI engine of Angels 22, but in this one, I'll describe the results of implementing that system. Anyways, I implemented the system pretty much the same way I described in that entry, with a few minor modifcations (which are boring, so I'll leave them out). As it turns out, the system works pretty well, although in my haste to get something working, I ended up writing hacked up code like in the snippet below:

if(currentstate != TAKEOFF && currentstate != LANDING){for(int i = -20; i < 20; i ++){bool check = true;if((int)((plane->xpos)/32)+i<0)check = false;if((int)((plane->xpos)/32)+i >= plane->terrain.size())check = false;if(check && plane->terrain[(int)((plane->xpos)/32)+i] > plane->ypos -128){waypointy = plane->terrain[(int)((plane->xpos)/32)+i]+256;if(i < 0 && plane->angle > 90 && plane->angle < 270)waypointx = plane->xpos- 512;if(i > 0 && plane->angle < 90 || i < 0 && plane->angle > 270)waypointx = plane->xpos+ 512;PushState(PULLOUT);}}}


I can't even decipher what I wrote that code for, but judging by the pushing of the PULLOUT state at the bottom, I assume it's some sort of terrain avoidance thing I thought up late last night[grin] Anyways, it's going to take some time to get rid of that kind of stuff, but in the process I'm finding lots of tweaks that add performance and believability to the AI.

Visual Cues
Initially, I was having some trouble interpreting what the AI was thinking(ie. what state was it in, where was it heading, etc) when it did something stupid, so I coded up a quick visualization of the AI_Pilot's state, which is drawn above the AI airplane as you can see in the screeny below:



In this screen you can see me (lower right) flying with my wingman (upper left) flying in formation. The text above the AI plane tells it's currentstate, and the blue line shows it's current waypoint, which, in the FORMATIONFLYING state, is equal to 64 pixels above the player's position. I haven't gotten order giving to work yet, so the AI is locked to the orders it's given on initialization, so you can't tell him what to do yet, but if you let him loose with a ATTACKALL order, he'll rip up the level without much difficulty.

As you can see, I've been focusing on the AI as of late, so not many cool new visual features, but hopefully spending this much time focusing on AI will give the player a much more cohesive experience, and besides, what's an airplane game without player/wingman chatter?

Anyways, thats all for now, let us know what you guys think of the project so far, and we'll talk to you guys later! Peace Out!
Previous Entry AI is... working
Next Entry ...sfg.fsg...
0 likes 3 comments

Comments

Samsonite
Cool.




Can we get a demo now? [grin]
July 28, 2006 02:54 AM
-justin-
i know what you mean about the work... i try to blame my not programming on work :P i haven't programmed in 3 or 4 weeks, even though there have been times when i've had time

so in other words, don't slack (like me) and keep working hard, luving what you got!
July 28, 2006 02:15 PM
Sir Sapo
Quote:Can we get a demo now?


All in due time.....[grin]

Quote:i know what you mean about the work... i try to blame my not programming on work :P i haven't programmed in 3 or 4 weeks, even though there have been times when i've had time

so in other words, don't slack (like me) and keep working hard, luving what you got!


Yeah, sometimes I just get home and lack the willpower to sit down and code stuff.

Thanks for the comments!
July 28, 2006 07:37 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement

Latest Entries

!

1181 views

'Roids

1498 views

Post Dva

1280 views

Untitled

1116 views

I'm a sad panda...

2127 views

Untitled

1019 views

Progress

1063 views

Angels 2X!!!!!

1485 views

T3H Progress!

1309 views

ZOMG!!!!

1189 views
Advertisement