Development > Newbie Coding
Artificial Intelligence
krilain:
--- Quote from: geever on May 23, 2012, 07:28:55 pm ---Patches are welcome, as always...
-geever
--- End quote ---
Hi all, hi geevers,
I downloaded the code or I'm missing something (as usual). There's a lot of scripting, I think quake2 scripting. That's fine but is that all the code? I mean, playing around with the scripts will cover all comportements in the game? Is that this part about which you are talking when you ask for patches? Or did I miss some code. I didn't find files I excepted to find, as .h, .cpp, ..etc. even if some Eclipse editor parameters were included in xml style.
I'm not really a programmer, so feel free not to answer me too much precisely if you think it would be a waste of detals. Whatever I can distinguish between scripting code and C or other langages classical code.
I know too that AI is generally coded in the script part, but not necessarily. My interest on AI comes from the problem of alien trying to fire through the walls, or impossible position. That's could be limited in my opinion by making alien able not to repeat twice a failed fire. Here is my interest on AI for now.
geever:
We have 2 AIs, the scripted you may see base/ufos/ai is not in use because it is not finished (could be activated in game with some cvar IIRC). The current working AI is coded in C, look for g_ai.cpp, but from there it is quite much like programming.... :)
Patch == Contributed changeset in "unified diff" format.
-geever
krilain:
--- Quote from: geever on November 20, 2012, 05:20:57 pm ---We have 2 AIs, the scripted you may see base/ufos/ai is not in use because it is not finished (could be activated in game with some cvar IIRC). The current working AI is coded in C, look for g_ai.cpp, but from there it is quite much like programming.... :)
Patch == Contributed changeset in "unified diff" format.
-geever
--- End quote ---
Ok :)
I'm getting into it slowly. Thanks again.
Leviathan:
Good evening,
This is a great game and I am already greatly enjoying it, however as many others have noted boosting the AI would be a great improvement to the experience.
Some suggestions from my experience so far…
Disclaimer – I have not yet cracked open the C code. I wanted to give it a top down look without assumptions about what is there. That may mean some of my suggestions do not mesh well with the existent code body. In particular, I am assuming an object-oriented programming structure.
1. Some of my underlying ideas come from a book that discusses how extremely simple processors (like a hunting spider’s tiny brain) parse environmental data to create the appearance of cunning thought. http://www.amazon.com/Beyond-Brain-Environment-Shape-Animal/dp/0691126445
2. One could create the illusion of complexity, and even some team effort, if you implemented a “personality object†for each alien. By that I mean a set of flags and weights that influence the rules governing each alien’s basic decisions so that certain types of alien, and even individual aliens exhibit different hunting patterns.
3. Using the spider as a model I can envision a simple process for generating an alien’s turn. Each turn the alien makes three basic choices: destination, path to destination and whether to attack along the way. If I understand the current code correctly, this is already the general structure. It could be as simple as; choose a path toward cover that brings you closer to your target and attack when in range.
4. To add complexity and challenge you could add the concepts of “hunting†and “senses†to the first decision.
a. Hunting – An alien will choose a destination that brings it closer to a target it is aware of. A set of flags determine if an alien hunts for specific prey. Weights determine how aggressively it pursues prey. Flags can be set to lock on a target, once chosen.
b. Senses – Aliens can have awareness of targets beyond line of sight, determined by flags.
5. Examples:
a. Eager – The alien moves in the direction of the most recent hostile gunshot. This could also be extended to include a chance to perceive and move toward those lumbering in heavy armor.
b. Heightened senses – Line of sight is determined only by a distance. Walls and obstructions do not prevent the alien from perceiving the chosen prey. Groups of aliens sharing this flag would appear to swarm on a scout who overextends.
c. Bloodhound – The alien chooses a path to bring it closer to a wounded enemy. If flagged to lock on a target, this gives the illusion of a “pittbull†mindset that chooses a target and tracks its blood-trail. Multiple aliens in close proximity with this flag set give the illusion of working together to concentrate fire. If allowed to track wounded without direct line of sight it gives the illusion of an enemy tracking by scent or blood trail.
d. Kill Stealer – If there is a wounded soldier available the alien piles on, if not the alien moves closer to another alien. Multiple of these quickly give the impression of a formation working together to form up and focus fire, particularly if they fall in to file behind an alien hunting by one of the other senses.
e. Sniper – The alien hunts a target based upon highest (or lowest) rank. Highest rank appears to be an alien coordinating fire to pick off those in command of the unit. Lowest rank appears to be singling out rookies to deliberately target the weakest first. Flagging for this without line of sight would indicate aliens intercepting radio traffic (or even thoughts) to zero in on who does what.
f. Tactical – Alien prefers to hunt for a particular high stat or equipped weapon. This would allow for the creation of an alien squad that focuses fire to eliminate long range snipers or heavy weapons specialists as a first priority.
g. Scalp hunter – The alien hunts the teams best (highest average stats) or most notorious (highest kill count) elite soldier.
h. Territorial – The alien does not hunt, but instead chooses a destination such that it patrols in a tight loop and aggressively defends a small area.
i. Butcher – Prefers to hunt available civilian targets over available soldiers.
j. Randomized – A random personality for each alien would at least give variety in behavior from battle to battle and alien to alien. This would approximate a recently crashed UFO, where the commanding officer of the alien force were killed on impact.
k. Templates – assigning a personality template, perhaps with random variance within a species band, would make Ortnoks feel like Ortnoks and Tamans feel like Tamans. This would approximate a crash with minor damage, allowing the aliens to begin to regroup.
One of the advantages of such a scheme, in my opinion, is the ability to start simply and expand in terms of complexity as the code evolves.
Duke:
Great ideas to extend the AI. But before extending it, we should imho implement the missing basics.
So may I direct your thoughts towards this:
--- Quote ---...choose a path toward cover...
--- End quote ---
The current AI does not really know about 'cover'. It merely selects a place with no LoS to all enemies. That's why they try to hide behind your soldiers.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version