![]() |
| | #1 |
| Rambling Man Join Date: Jan 2002
Posts: 1,050
| Game Design Topic #1 - AI Behavior Game Design Topic #1 ---------------------------- AI Behavior in a Space Shooting Game ______________________________ What type of AI would you like to see in a space shooting game? Do you want to see an AI that goes after the player aggressively with no other regard. An AI that plays it smart and tries to avoid the 'danger' areas? An AI that is completely random (however this usually creates a rather dumb AI)? Personally I think it's a matter of trying to set up a predertimed method the AI should follow. Like have a bunch of different types of methods the AI can go from. Meaning that one enemy ship might try to come from one top corner and then diagonally slide down to the middle of the screen and from there make it's way towards the player ship. Another enemy AI might try to stay to the side of the screen the whole time while shooting at the player fiercely but it would be really difficult for the player to shoot the ship because the player's attention might be focused on in the middle of the screen. Basically I think it's smart to use a variation of predertimend AI behaviors without including much randomness at all. The randomness slows down the AI decision making and usually makes the AI decision AI making worse. I don't think each AI behavior should have more than one 'bail-out' if it comes to a point where it might be killed (i.e. run into player ship, hit by a bullet, etc...). I think to create a smiple yet potent AI it is best to leave as much randomness out of the equation as possible. It's ok to have a few random AI behaviors but that's about it. Well, those are my thoughts on how AI behavior should be dealt w/ in a (2D) space shooter game. What do the rest of you think? Come on people lets get some good discussion going! |
| TechWins is offline | |
| | #2 |
| Refugee Join Date: Aug 2001
Posts: 2,052
| The AI should be unpredictable: Games with a predictable AI get boring FAST! The AI should play smart, yet aggresive: It should find the right moment to attack, but when it does, it should attack very well.
__________________ Please direct all complaints regarding this post to the nearest brick wall Have a nice day. |
| face_master is offline | |
| | #3 | ||
| Registered User Join Date: Sep 2002
Posts: 83
| Quote:
Quote:
![]() When they spawned, they randomly chose one of 5 'ai styles': -try to attack the player, angleling (sp?) down towards him -rushing towards the bottom in the middle, shooting constantly -rushing towards the bottom on the sides, shooting constantly -camping up the top of the screen, trying to snipe the player from afar -and one other one, which i've forgotten ![]() These styles were pretty basic, but as you were facing 40+ of them in the later levels, it looked pretty impressive ![]() With 20/20 hindsight, there were probably far better ways of doing this; I could have made them team up (ie: they wait up the top, then attack in waves) and make them try not to shoot each other so much . Formations would have been cool as well...and having them change attack styles if losing, or if the player is low on health / occupied...or all rush for the side of the screen the player is furthest away from...damn, why didn't I think of this stuff at the time? ...whew, that went on a bit longer than I intended | ||
| Bieh is offline | |
| | #4 | |
| Registered User Join Date: Sep 2002
Posts: 83
| Quote:
| |
| Bieh is offline | |
| | #5 |
| Guest Join Date: Aug 2001
Posts: 4,923
| For one, I think the AI should be adjustable to levels of difficulty for a player. I always hate football games and shoot-em-up's for that very reason. They always use the most intense attacks, resulting in a very short game Aside from that, the AI should be delegated into certain tasks, ie: AI for following a character separate from the AI of choosing an attack approach, etc. |
| Sebastiani is offline | |
| | #6 | |
| Registered User Join Date: May 2002
Posts: 274
| Quote:
__________________ ¿Red Baron? "Imagination is more important than knowledge" -Albert Einstein (1879-1955) Check out my games! [code] /* dont forget code tags! */ [/code] | |
| red_baron is offline | |
| | #7 |
| Guest
Posts: n/a
| Well I haven't done any good AI programming, but i can only imagine Artificial Intelligence directly implies something that cannot think for itself but must react to conditions in the 'world'. I think that is what the other people who posted on this thread were getting at. For example having 'enemy spaceships change formation when losing' could be done with static class variables that keep track of how many spaceships exist. If there are less than a certain amount of spaceships then they assume a tighter position otherwise they choose a larger position. Of course you could have a whole ****load of positions to choose from, not just one. It also seems to me that the AI that seems the most intelligent are simply the ones that can react to the most conditions. For example they do not just change position if they are losing, but the least damaged enemy spaceships protect the more damaged enemy spaceships by getting in between them and the player, and spaceships with a more appropriate type of armor plating face the player when the player uses a weapon that isn't as strong against their type of armor plating, and so on and so forth. Ideally artificial intelligence can test for every condition possible, but even in some simple games it can be very difficult to program for every condition. |
|
| | #8 |
| Rambling Man Join Date: Jan 2002
Posts: 1,050
| face_master, all that is easier said than done. I think in a space shooting it is best (in terms of ease and effiency) to have most of the AI behavior predertimened. This doesn't mean that the behavior can't be complex. It's just that an AI that is largely based off of randomness is going to be poor. If the AI were to check too many conditions it might wind up making an even worse decision than staying on it's 'normal' path. If a good AI behavior is planned out for the enemy then the enemy shouldn't have much need to changed it's course of movement. Such as if you have the behaviors like Bieh listed. Maybe include a few more behaviors that are little bit more divers, but that shoud still provide for a decent AI. Although, including a few special conditions when the AI should act differently *to add to the inpredictability of the AI* couldn't hurt too much. All in all, though, I think predertimened AI behaviors, with little change in it's behavior, is best for a space shooting game, because it's very easy and it's potent. |
| TechWins is offline | |
| | #9 |
| Guest Join Date: Aug 2001
Posts: 4,923
| I am no expert, but I have many opinions and some experience with this field. I want to digress a little and use some prose to further the discussion a little... There are two main difficulties in artificial intelligence: the abstraction and the implementation. Though seemingly simple, the abstraction is difficult to implement, the implementation hard to abstract. Bringing the two together in an intelligent and perhaps reusable way is the puzzle. The abstraction is, of course, the easier of the two. Like asking someone a strategic question: the mind does little work here. It is the implementation where most mistakes are made, mainly because the coupling between the two must be just right, neither too loose nor too tight. So for most games, predetemined patterns are favored because people like a little predictability. Unwelcome surprises make unpopular games...but the pattern must be loose enough to seem life-like. A good modelling technique is known as the "wandering gunsight". Here we construct a gunsight to be controlled by some input method, whether mouse, keyboard, or otherwise. At first we design it such that commands from the controller have a clear, separated interface with the virtual gun. Then we insert a single object between these two which takes in the input from the first and feeds directly to the second. Add an external toggle to remove and replace this "fudging" object at any moment. Perfecting this technique will pave the way to more generic code. Finally, the intervening object should do three main things: using very small random deviations, it should cause the sight to wander just above the threshold of noticability. Next, it should randomly ignore some of the input, thus "malfunctioning" just slightly. Finally, it should be recieve one more input, called "intent". This might be the coords of a moving target which have themselves been altered by a similar object, creating a "not so perfect aim", or similar. Altogether this yeilds: "intent" + "wander" + "imperfection" == good AI! Just remember that the algorithms and data structures used must be a careful mix of reusable and specific code. Anyway, are you using C++ or what? This seems like a fun project though...good luck to you! |
| Sebastiani is offline | |
| | #10 | |
| Rambling Man Join Date: Jan 2002
Posts: 1,050
| I think that was very well put, Sebastiani. However, you left out one important category---adaption but you might have included that as part of its intent. The AI should be able to adapt to the unexpected occurrences, such as the player cutting off its intended path. This is where really the hard part comes into play. It's hard to come up with an algorithm for the AI to adapt to the situation, which is why AI still has a long ways to go before it can truly challenge the human. Although, in a simple space shooting game a perfect AI isn't neccessary. That's why in the game I'm creating I've decided to do away with having a lot of AI adaption. It seems to me that I will probably spend more time on making the AI fairly adaptable for it to actually be worth it. Basically I think in overall terms I'll be better off just sticking with the AI's predertimened behavior method. So far I've come up with a decent way of doing this or so it appears. Quote:
| |
| TechWins is offline | |
| | #11 | |
| Guest Join Date: Aug 2001
Posts: 4,923
| Quote:
Very dorky, but my neices and nephews love him! They've been bugging me to get him to do more than just walk and jump, of course... Anyway, just let me know if you get stuck on anything. Good luck! | |
| Sebastiani is offline | |
| | #12 |
| Guest
Posts: n/a
| Aww its cute ![]() by the way I had like no clue what you guys were talking about in your posts, especially you S man What exactly do you mean by ai abstraction is hard to implement and the ai implementation is hard to abstract? Can you say it in human terms? Something mortals might be able to understand? |
|
| | #13 | |
| Guest Join Date: Aug 2001
Posts: 4,923
| Quote:
int main(){ player john; player larry; while(john.dead == false && larry.dead==false){ john.move(); larry.move(); if(john.collides(&larry); crash(); }//...while... return 0; } Because we were beginners we gave people names to the characters, thought of interactions in a simple way, and basically could not separate from the "top-down" view (the abstraction). If asked how to program this game, the implementation would be less than easy and the game would quickly degenerate into a bug-ridden mess! Thus, "the abstraction is difficult to implement". Now switch to an old school systems programmer who is asked to write such a game. He might start with: int main() { if( (seg_fault(r_entire_bin(h_result, p_main))) == SEG_FATAL) { //... } do{ if( (r_tree_parse(&h_result)) & PARSE_FATAL) { //... } //... while(h_result); return EXIT_SUCCESS; } Here we have the opposite problem altogether. This programmer can certainly get the program to work, but when asked to add a new feature, he fears he will have to give the user (another programmer) four more functions instead of one, which must be called in a certain order, and which must recieve certain ranges of preinitialized values, and on top of that, the return values might be one of six possible results for each of the functions, all of which must be checked! The problem is, he cannot seem to get "the big picture" in order to connect things properly. This is the meaning of "the implementation is hard to abstract". The whole idea of OOP was to facilitate a happier medium, by encouraging more humanistic viewpoints of programs, by giving the programmer things such as operator overloading, templates, etc - things that encouraged more maintainable and generic coding practices, basically. Object oriented programming is here to stay, and for a good reason. Anyway, with reference to AI we have to first realize that there are real data structures that must be dealt with, real algorithms to be debugged and perfected, and that we cannot simply start coding under the pretense that the interactions will be clean and simple. The reality is that programming involves more low level interactions than high level, and that to ensure total connectivity, some hard design decisions and trade-offs must be made. Where the line is drawn is the art of it! | |
| Sebastiani is offline | |
| | #14 | |||||
| Rambling Man Join Date: Jan 2002
Posts: 1,050
| Quote:
Quote:
Quote:
Quote:
Quote:
The other day I came up with a way that's going to make it very easy for me to have a plethora of different AI behaviors. | |||||
| TechWins is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| My Memory Game | jazy921 | C Programming | 0 | 05-05-2003 05:13 PM |
| how do the game engine and the api interact? | Shadow12345 | Game Programming | 7 | 06-05-2002 10:06 PM |
| game design from the non programming side | Scourfish | A Brief History of Cprogramming.com | 0 | 01-29-2002 01:07 AM |
| Anyone heard of FULL SAIL GAME DESIGN DEGREE? | marCplusplus | A Brief History of Cprogramming.com | 7 | 11-30-2001 10:06 PM |
| Im a Newbie with a graphics design problem for my simple game | Robert_Ingleby | C++ Programming | 1 | 11-23-2001 06:41 PM |