Jump to content
XCOMUFO & Xenocide

Ai Design


gangsta

Recommended Posts

Captain Charisma posted in the Member Forum (sorry stewy) the following:

 

Ok, its about time we get knee deep into AI.

 

I hate to say it, but all that AI course taught me was that coputers are poop dumb. In fact, prolog, lisp and all those other "professional expert systems" are a load of hooey when making a PRACTICAL AI. Sure, in chess they could come in handy, but in this case, AI is rather different to handle.

 

For instance, you give your characters particular attitudes, or goals to accomplish. Maybe even a priority system.

Example:

"Kill humans." Easy, the alien will scout out your team memebrs and civilians

"Run away" or "Take cover" Civilians run away from aliens, or towards agents. Hopefully both.

 

Easy enough. Now we have to give those goals a means of fulfillment. This is accomplished with specific actions ie.

Movement.

Positional changes.

Fireing weapons

Farting

etc.

 

If we break down the actions of the attitude to "Hunt Humans"

--> Movement until target aquired, Fireing at Target. When Fireing is no longer an option, Self Preservation could be an underlying goal, in which the alien would choose to take cover (further motion and positional changes.)

 

On top of that, charcters can be dispositioned to use their strengths more, and weaknesses less. Several Race modifiers could be implemented.

 

To sum up, the total process, should be as simple as possible (since graphics needs as much processor as possible). Lisp, Prolog and even top-down recursive methods of AI (in which the computer runs through endless cycles of "possible most efficent actions to take" are just TOO perplexing and unnessessary.) Albeit, the quality of which is like giving a gun to a monkey... so that we dont have to pay a soldier to do the work.

 

Thats my opinion, and Im sticking to it.

Link to comment
Share on other sites

Along the lines of two things you said (class of soldier [medic, commander, etc] and race of alien [crysalid charges, sectoid hides]) give them to some degree basic parameters (ie. with sectoid soldier; aquire target, fire as much as possible, move as close to cover as possible in that order) and do a random chance for secondary action (move half of TU's, if no target, preserve TU's for reaction shot). If it is pre-scripted it should be less intense, and there is no real deep calculations to involve (it has more to do with random numbers, which aren't really random in a computer, but what can you do?) However, with pre-scripted and random choice, there is always the chance that a sectoid will run and hide from a soldier with a pistol...
Link to comment
Share on other sites

There always should be a chance they would run, especially if they have low bravery and/or morale. Once actions are decided on and described it shouldn't be too hard to program a skeletal AI system. I have done a pretty rubbish AI for a game called senet as part of an end-of-year project. It always beats me though unless I copy it exactly.

 

EDIT: The AI for that was designed in a similar system.

1. Sort out all the possible actions it could take.

2. Sort them into a priority order.

3. Code them.

 

Doing that it was fairly easy.

Link to comment
Share on other sites

OK, moving this over from the Useless thread...what have we come up with as far as AI? I'm just wondering if we're still planning on using pre-programmed moves with a chance at either. It has also been mentioned that this system can be expanded to include some simple calculations to help find the "best" move for a turn without strategically considering the reciprocating action from that move. (ie a point system for targets so that they attempt to create the most damage at terror sites)
Link to comment
Share on other sites

FE and I were having a general chat about how I'd just attacked a fresh snakemanbase with 10 newbies in tshirts and a basic cannon tank and how I managed to get out of it alive with mucho booty with 2 guys when the topic of ai came up.

 

We discussed how an ambush by aliens when the player landed at a crash site. I thought tt could be linked to how the player approach the crash site or landed ufo. Basically if the Ufo has landed, the aliens will take time to react to you because they weren't expecting to be shot at. So for a couple of turns the alien AI could 're-group' and go from harvesting mode to battle mode.

 

But if the player shoots a ufo down the aliens that survive the crash would be really hostile and fight back a lot harder "You humans shot us down, grr"

*Deimos manages not to swear*

 

FE said that if the player lands pretty much straight after the Ufo was shot down IE Avenger, they'd be confused and no organized oposition. I think a couple of turns would work.

 

The longer the craft is left without being investigated, the higher the likelyhood the aliens will be prepared for you.

For instance the player shoots down a terror ship (any ship will do the terror ship is just an example and a good one too :)) with Interceptors and it takes the player a day to get to the crash site with the Skyranger. The aliens should be in perfect ambush postions and should fight like demons to evade capture or being killed.

 

This way it would make sense to get to a mission early as there should be fewer concious and co-ordinated aliens to deal with. As FE said if it takes the player at least 2 hours to get there. The aliens are all fully concious and cognative and p*ssed at the player for shooting them down.

 

Then I had the idea that alien ai should be completley different to human ai. Normally when a player shoots an alien, the rest drop in morale, just like the player's soldiers. So I thought how about the opposite for the aliens. They go mental and fight like demons. It would be funny to see an alien run away and be really scared of a particular weapon say something innocous to the player like a flare for sectoids and stun rods for floaters, because of what it does to them.

Link to comment
Share on other sites

MOVED FROM: Wishlist

POSTED BY: Maverick

 

I've been thinking and are we gonna try the % chance vs. pre-programmed moves AI? (there are problems with that like the chance a muton soldier will shoot an unarmed person behind him instead of the soldier in front of him or that all the aliens will act like reapers "run away!") just wonderin where we are on that...

Link to comment
Share on other sites

MOVED FROM: Wishlist

POSTED BY: Fatal_Error

 

% is a very bad way imo. i would suggest we pre-valueate all possible moves and then make the ai calculate the best moves. eg:

 

kill civilian: 250pt

kill agent: 1000pt (or whatever the max is)

blow smth up: 100pt

move: 10pt

 

then if tha alien sees eg 2 civilians and one agent then its gonna try to kill the agent but if it sees eg 5 civilians and an agent then it tryes to kill all the civilians with a grenade (the logical mass destruction device)

 

well anyways this is just a rough draft and the final should be much mo complicated taking into account many mo aspects. this is what i have learned in school well something like that anyway :)

Link to comment
Share on other sites

MOVED FROM: Wishlist

POSTED BY: Maverick

 

One of the earlier concerns was that we can't have it run too many calculations in game...so as i understand it we were leaning toward pre-programmed moves with basic calculations like you stated.

 

(civilian 250 pts...sounds like when I'm driving my car....)

Link to comment
Share on other sites

I for one think that using %chance moves combined with pre-programmed attitudes is the way to go.

Calculating all possible moves "brute force" is very possible, and in fact very cool if the game were purely turn based "chess". But then all aliens would have the same thought process, and in trun become predictable. In real time, you could give the aliens their own processing thread for AI, altough i think it would reduce their reaction time. With purely pre-programmed reactions in an attitude system, the aliens are even more predicatable, but the AI would probably function smoother, espessially in real time. For %chance movements.. the aliens will be bumping into walls.

 

Inevitably, there has to be a combinatoin of all three.

Therefore i propose that we do in fact draw up a simple calculator for the AI without calculating all possible moves, but only the moves that follow a specific priority system based on the attitude.

 

As far as the "alien preparation prior to landing is concerned" that is a very cool idea. But it does not have to be complicated. All that has to be done is that the spread of aliens becomes more refined to fall under particular scenarios where the aliens are in the process of

z) unprepared - random placement around ufo

a) abandonment. spreading away from the ufo

B) securing the ufo, if it can be repaired

c) establishing an alien comm center outside the ufo to call for reinfocements

d) ambush the xcom craft (great idea Deimos)

e) terroizing humans if landing in city or populated area.

f) examining livestock

g) more ideas anyone?

 

 

I cant wait till they start working on Battlescape... id would love to get my hands dirty with AI

 

BTW gangsta, i am knee deep in exams (med school) at the momment, so i am not in the best mindset to work out all the attitudes in detail. BUt ill get on it as oon as i can, i promise.

 

-CC

Link to comment
Share on other sites

You can think about a multilevel aproach... where the activities you mention are interpreted as group activities... but they can be overtaken by individual actions like XCom spotting reactions... not to mention it could be cool if the AI dont cheat....

 

Greetings

Red Knight

Link to comment
Share on other sites

  • 3 months later...
Guest Jim69

I see some ppl sayin that the calcs for AI should be low for graphics sake, I don't know bout u, but that pretty much what has p*ssed me off about games in the last 3-4 years, all graphics and no actual game (btw, i am not insinuating that there will be no actual game).

 

I for one would sacrifice graphics for some badboy mega tough alien AI :devillaugh:

 

I know that somethings can be preprogrammed in AI, but if the choice comes down to a good AI script that uses more processor cycles or use a preprogrammed one that doesn't work as well, then use the better one. You can always have an option to turn the graphical detail down.

Link to comment
Share on other sites

i agree with jim 100%, look at today's games and you will see beautiful graphics, but no storyline, no character development, nothing. one good example is Command and Conquer: Generals, great graphics, sucks at multiplayer because of all the hacks and single player is a joke....

 

another one is Master Of Orion 3... OUTSTANDING GAME, but a bit too hard to understand how everything works, AI that controls planets are stupid as heck, graphics suck, i dont know what they put their processor speed into, but there sure as heck are a lot of menus and buttons to play around with....

Link to comment
Share on other sites

Would there really be any CPU contention between graphics and AI? How much CPU gets used versus video memory, and wouldn't most of the graphic-intense stuff happen during your movement, while the intense AI load occurs when you're not moving the screen? It's true that the alien models will move during their turn, but how much power would that take? Could one alien unit's actions be calculated while the previous unit is moving to reduce any delay while calculations are made?

 

The various stats that are used in the game reminds me of what I read about the Massive system used for making the battles in the Lord of the Rings movies. I'm sure the CPU usage for that is also massive, but could such a system work for this? One thing I'd like to see is an alien picking up a significantly better weapon from a fallen unit.

Link to comment
Share on other sites

Guest drewid

Just wondering - how did you all rate the AI in the original?

 

EDIT Oh BTW I reckon Breunor is right. There shouldn't be much contention between AI and Graphics.

The turn based play should really be a big big advantage for us.

Edited by drewid
Link to comment
Share on other sites

The last time I read a survey about AI percentage versus Graphics Percentage it was on this line: 20% AI, 80% Graphics and general housekeeping... :LOL:

 

The original AI Sucks (now)... but for the year it was developed, in my opinion it was state of the art.

 

I agree AI is very important, who would want to kill stupid aliens.

 

By the way a system like the used in LOTR (even though i dont know it) would have to do movement calculations and other things too, it is way off the scope of the kind of system we need...

 

Greetings

Red Knight

Link to comment
Share on other sites

Guest drewid

OK just to say there wasn't really any AI in the original. just routing points and randomness IIRC. But people assigned all kinds of behaviour to it that just wasn't there.

 

Here's another story.

Bullfrog did a wipeout clone using their magic carpet engine.

They did it very quickly (six weeks).

There were a range of craft you could choose from, and they screens listed different properties for them, the website got emails from people saying how they thought craft B sucked, or C was better round corners, or d had a better turbo.

Here's the thing...The flight model was identical for all the craft, there were NO differences.

 

I guess what I'm saying is keep it simple, too many games try to use "real" AI techinques and they don't work. home computers are way too dumb and slow, and real AI is not advanced enough yet. Smoke and mirrors gentlemen smoke and mirrors. We just need to figure the fastest simplest way to get the behaviour we want.

Link to comment
Share on other sites

Okay, how about I just throw out this idea...a simple state machine.

 

The aliens have different states they can be in: Long-Range Attack, Short-Range Attack, Ambush and Panic. (Let me know if I missed any. ;) )

 

At the beginning of the turn, you calculate a score for each state based on things that have happened: Lots of targets to shoot at, a high LRAttack score; or other aliens being killed, a Panic score. Then you skew those scores with values individual to each alien. (Sectoids have high Long-Range Attack; Chrysalids have NO Long-Range Attack and very high Short-Range Attack.) Then, based on the probabilities, you randomly choose a state for the alien to be in.

 

Then you just have a different function for each action. For example, a Long-Range Attacking alien will shoot at any targets in range, get closer to targets out of range, or wander around trying to find a target if none are visible. A Short-Range Attacking alien will charge the nearest target. A Panicked alien, well, you get the idea. :D

 

The real meat of the algorithm, of course, is in the "attack scripts". That's where you get to do the searches and stuff, have the alien stay near cover, maybe do some tactical analysis to have the aliens group together and go after lone soldiers. So there's still a lot of work, but this might be a good "road map" to get started. :)

Link to comment
Share on other sites

AI for this game really breaks into a few categories; the first being actions taken and the second being movement algo's. Since our environment is going to be entirely 3d (as opposed to the original game which gave the illusion of 3d by adding multiple 2d levels onto it) our job with AI becomes more difficult; the movement AI also applies to the player controlled units, because they have to decide which path to take to get to their destination (the original obviously used the straight line approach, which may not be the best to use.) There are well known algorithms for all movement types, we just have to find the one that suits our purpose the best.

As for the actions taken category, there are well known systems that exist for this. For quite a while I had hoped to identify a groundbreaking AI script that would set xenocide apart, however, not being an AI wizzard, and based on the difficulty involved in this approach in general, we're much better off coming up with a system that just works. We have the advantage of not needing real time calculations (the joys of turn based) and if you remember correctly and play the old game again on the target machines, it takes quite a while for the computer to make its moves. No one will complain if the aliens take their time a bit during their turn to make their moves.

A couple things to note that are very important: 1. it is very hard to create an AI system where the computer does not cheat; this means that it is very hard to hide your units from the aliens. If they don't cheat they are much more likely to miss moves, or make bad moves. (one example would be sneaking up on an alien because he didn't turn around for 15 turns straight....he wasn't programmed to) 2. computers only do what they're told to do, nothing more. If we do go with a rule based (very similar to the state based AI mentioned above) then it will be very important for the playtesters not only to determine what the AI is doing that it shouldn't, but also to recognize what they aren't doing that they should.

I'm still researching AI because it interests me a lot, but at this point (without true expertise in the field mind you) my bet is that rule (or paramater, or state) based AI will prevail for us in both categories of AI.

 

-Mav

Link to comment
Share on other sites

Guest Jim69
Would it be possible to justify the computer cheating? I mean, if the aliens weren't that tough, would the regular armies be dealing with it themselves? Probably, so if the computer seems to cheat, as long as the missions are only made harder not impossible it should be alright. So things like not being able to creep up behind aliens should be included, since some have psionic powers, they would know when someone is behind them, surely?
Link to comment
Share on other sites

Guest drewid

I would think an approaching enemy would be more likely to alert you as he gets closer. If he's moving slowly then he'll make less noise.

 

Anyhow, I agree with Maverick, the computer will have to cheat I think, but that's not a problem as long as it's fun to play and not obvious that it's cheating.

 

I would guess that the best approach would be to write a full-on superhuman ninja ai, then dumb it down till it works in play.

 

Like the state machine idea too.

Link to comment
Share on other sites

A couple of things. First, the playfield is going to be divided into discrete sections, right? What I mean is that there will be "tiles" and such? You can't just have the players and aliens at any random floating-point position?...I'm asking because, if so, then you can just use the standard A* algorithm for movement paths. You can also weight it to obtain different effects; I'm mulling over weighting the algorithm so that moving aliens stay under cover more often.

 

Second...I don't know about "cheating". However, every alien should know what every other alien sees. Why? Because every human soldier knows what every other human soldier sees--since they're all controlled by the player. ;) If you want the aliens to be clever, then you can create an overarching AI...kinda like the human player is playing against the computer in a game of chess, moving around various pieces on the board. (With guns and stuff. Yeah.) Then you could have: Alien 1 explores a bit, sees a human, runs back. Alien 2, without directly having a line of sight to the human, throws a grenade where the human is.

 

Perhaps it would be useful to create such an AI anyway, for tactics. Like, what I do when I play X-COM, is I send my soldiers out to explore in different directions, fanning out and searching every area. The computer could do the same thing.

 

When you think about it, though, the AI has a huge automatic advantage over humans: Patience. Imagine this scenario: Alien ship lands on some mission. Human ship intercepts it. Aliens fan out and set ambushes. Humans fan out and set ambushes.

 

...Who do you think gets tired of waiting first? ;) So...the "tactical AI" could take considerations like that into account.

 

I wonder if it's possible to do flocking stuff and make the behavior emergent...

Link to comment
Share on other sites

RK once stated that the game will not have tiles. That is that each unit will be positioned in free coordinate system and not just in some fixed nodes.

 

Second, I have discussed some Xenocide stuff with STJONES today and he has great ideas about AI. Even more, he has code written that does that. Probably we need to ask him to discuss this in more details here.

Link to comment
Share on other sites

#1, the A* algo may still apply despite our severe lacking of a tile system because we still have a coordinate system (we can either define the center of a map as (0,0,0) or any corner of the map as the origin; for that matter any point on the map can be the origin, ah the beauties of free coordinate planes)

 

#2, state machines may work for our purposes as far as the alien controlled units, but fuzzy logic may also provide our answer (it allows the computer to express its "inclinations" in a % towards different actions -- which is pretty much what we were looking for.) what it will come down to is what Scott feels like doing with the AI and what will work best with our needs.

 

I'm getting in contact with Scott about the AI and when school is out (two more weeks) you can expect a full-fledged design doc for our AI plans. Of course, it won't be able to be tested and implemented until we have an alpha battlescape out of course, but i think with his experience we'll have a real good idea of what will work long before that is finished.

 

-Mav

Link to comment
Share on other sites

When you think about it, though, the AI has a huge automatic advantage over humans: Patience. Imagine this scenario: Alien ship lands on some mission. Human ship intercepts it. Aliens fan out and set ambushes. Humans fan out and set ambushes.

 

Hey -

 

So should different alien ships/missions have a base AI strategy. For instance, I would expect MUCH different tactics from aliens on a terror mission, then those from a harvester I just shot down...

 

Gold

Link to comment
Share on other sites

...no tiles, huh? Ouch. That makes things a lot harder.

 

But, fortunately, not impossible. ^_^;

You'd think so, huh? I don't know anything about programming, though. How are time units going to be spent, then? I mean, it IS going to be turn based, so does one time unit just move you 1.00 feet in any direction on flat ground and .60 feet uphill? Or is there going to be another system entirely?

 

As for AI, I'd think making a dumb AI smarter would be easier than scaling down a genius AI, but once again, I'm not that experienced with this stuff.

Link to comment
Share on other sites

I just had a GREAT conversation with Scott Jones about the AI we should use and I think just about everything is worked out already! AI is gonna be a lot easier (in concept at least) than even I thought. He has a great pathfinding idea for the bots, and as he expressed in a different thread, i think (he convinced me pretty easily) that an expert system will be the best way to go. In reality we could have the AI working before a battlescape alpha is even finished. I'll explain everything in the AI design document to come in a few weeks.

 

-Mav

Link to comment
Share on other sites

×
×
  • Create New...