project-navigation
Personal tools

Author Topic: the AI discussion  (Read 68383 times)

Offline nonickch

  • Rookie
  • ***
  • Posts: 36
    • View Profile
Re: the AI discussion
« Reply #60 on: August 01, 2010, 04:38:07 pm »
Here's the svn diff of my current status

Not much has changed since the last diff.
I've switched the damage estimation to the mixed model (mock for gravity/splash, math for the rest). This leads to normal execution times (as long as there aren't many such weapons being held on the field).
Ofc since I did squat of a progress on the math estimations, some of it's "features" are still there (e.g I just had aliens try to shoot through walls. In my defence my squaddie was getting non-0 hitchances too).
Enable the commented-out "#define MOCK_ESTIMATION_ONLY" if you want to see the difference of mixed estimation vs mock-only.
You do get interesting things happening with mock-only in the rivertown map (see bug report).

It's possible that you will get an unreferenced function error at compile time, include the appropriate .c file. Somehow my linker has no issues with it (probably because I used to have it included sometime in the past?).

You may/may not decide to commit this to the trunk. The problem is I won't be around till the 18th to fix any broken bits that come up.
« Last Edit: August 01, 2010, 04:42:32 pm by nonickch »

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: the AI discussion
« Reply #61 on: August 01, 2010, 07:17:20 pm »
i think we'll wait with commiting then ;)

having someone who can answer my questions would be good when it comes to bugfixing.

Offline dodon

  • Rookie
  • ***
  • Posts: 48
    • View Profile
Re: the AI discussion
« Reply #62 on: August 05, 2010, 09:12:01 pm »
I tried the new ai code. The aliens are  now thougher (at least with MOCK_ESTIMATION_ONLY).
Only the behaviour of the bloodspiders lacks. I think we need different GUETE-values for melee only units.

To compile the code with C::B on windows I had to remove some "error messages" from tracing.c

From the description of G_ClientShoot: @return qtrue if everything went ok (i.e. the shot(s) where fired ok), otherwise qfalse.
That means if  G_ClientShoot returns false you can't shoot that target. So this optimization of the AI_CalculateDamageMock reduces the time for the alien turn noticably (a similar break is in the mock shot of the reaction fire):

Code: [Select]
/**
 * @brief Estimate the damage of a shot (given firedef and shoottype) by making mock shots with G_ClientShoot. This function properly calculates for
 * gravity & splash-based weapons while being the most accurate. This comes at a heavy processor cost though and should only be used where really needed
 * @sa G_ClientShoot
 * @param[in] ent_player the player who's actor will try to shoot
 * @param[in] ent AI actor that is trying to shoot
 * @param[in] The target we're shooting at
 * @param[in] The shooting type we're using
 * @param[in] The firedefinition index we're using
 * @param[in] The firedef we're using. Redundant because of fdIdx and used only for minimizing sampled shots.
 * @param[out] the damage expected from the shot
 */
static int AI_CalculateDamageMock(const player_t * ent_player, edict_t * ent, const edict_t * check, shoot_types_t shootType, fireDefIndex_t fdIdx, const fireDef_t *fd)
{

int mockShotDmg = 0;
int j;
const int samples = 10; /** Try to make only this many G_ShootSingle shots in order to keep CPU usage to a minimum */

/* Sample 5 mock shots through the proper G_ClientShoot to see what kind of damage we can deal with our current settings */
/** @todo OPTIMIZE, we're really having a HUGE bite into the cpu over here */
/** @todo: is the z-align value of 0 correct? */
/** @todo: allow mock.allowSelf=1? */

/** If the firedef is already shooting many times, divide by fd->shots so we get about 10 samples only */
const int iterations = ((int)(samples/fd->shots))?samples/fd->shots:1;

/** Only aliens are pleased in damaging civilians */
const int shootCivilians = (ent->team == TEAM_ALIEN);
float civilianPenalty = 1.0f;

for (j = 0; j < iterations; j++) {
shot_mock_t mock;
memset(&mock, 0, sizeof(mock));
if (G_ClientShoot(ent_player, ent, check->pos, shootType, fdIdx, &mock, qfalse, 0)) {
/* Add the total damage expected */
mockShotDmg += mock.damage;
/* Remove the fraction of the damage that is done to us/our team and civilians (if we're not aliens)*/
mockShotDmg -= ((mock.friendCount + mock.self) / (mock.enemyCount ? mock.enemyCount : 1)) * mock.damage;
civilianPenalty = shootCivilians? 1 : mock.civilian/(mock.enemyCount? mock.enemyCount : 1.0f);
mockShotDmg *= civilianPenalty;
} else {
break;
}
}
mockShotDmg /= iterations;

return mockShotDmg;
}

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: the AI discussion
« Reply #63 on: August 07, 2010, 07:28:10 am »
i've updated the patch tracker at https://sourceforge.net/tracker/?func=detail&aid=3037926&group_id=157793&atid=805244 with a new version (applied coding guidelines, added some todos and cleanup)

please use this patch for basing further patches on

Offline Kobold

  • Rookie
  • ***
  • Posts: 95
    • View Profile
Re: the AI discussion
« Reply #64 on: August 07, 2010, 07:36:47 pm »
the AI changes available for 2.3 branch or only for 2.4dev?

Offline Legendman3

  • Sergeant
  • *****
  • Posts: 306
    • View Profile
Re: the AI discussion
« Reply #65 on: August 14, 2010, 05:08:52 pm »
Only for 2.4dev. Does anyone mind if I give it a try and make a lua file for soilder AI? Just want to see if anyone minds What Im trying.

Offline Legendman3

  • Sergeant
  • *****
  • Posts: 306
    • View Profile
Re: the AI discussion
« Reply #66 on: August 25, 2010, 04:12:38 am »
Its been 10 days... no reply... here you go its a cobination of the civilian and alien lua files

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: the AI discussion
« Reply #67 on: August 25, 2010, 07:57:17 am »
thanks a lot - i will have a look

Offline nonickch

  • Rookie
  • ***
  • Posts: 36
    • View Profile
Re: the AI discussion
« Reply #68 on: August 28, 2010, 09:54:22 pm »
back, I just couldn't stay on that island for just 12 days...

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: the AI discussion
« Reply #69 on: August 29, 2010, 03:58:00 pm »
welcome back nonickch

Offline Kobold

  • Rookie
  • ***
  • Posts: 95
    • View Profile
Re: the AI discussion
« Reply #70 on: August 30, 2010, 04:58:58 pm »
is that possible to paste the AI changes for 2.3 too?

Offline bayo

  • Professional loser
  • Project Coder
  • Captain
  • ***
  • Posts: 733
    • View Profile
Re: the AI discussion
« Reply #71 on: August 30, 2010, 07:43:05 pm »
I dont think so.

Offline nonickch

  • Rookie
  • ***
  • Posts: 36
    • View Profile
Re: the AI discussion
« Reply #72 on: August 31, 2010, 01:30:38 am »
kobold: if you're willing to test this extensively with 2.3 and the campaign, I can most definitely produce a patch for 2.3 so you can try it out.
Most of the changes are in the ai file itself.

On the subject, what's wrong with the bloodspiders (I haven't really played since I came back)?

Offline Kobold

  • Rookie
  • ***
  • Posts: 95
    • View Profile
Re: the AI discussion
« Reply #73 on: September 01, 2010, 11:50:18 am »
kobold: if you're willing to test this extensively with 2.3 and the campaign, I can most definitely produce a patch for 2.3 so you can try it out.
Most of the changes are in the ai file itself.

On the subject, what's wrong with the bloodspiders (I haven't really played since I came back)?

that sounds good, yeah i would try it. if you could upload this patch/file would be cool. thanks

Offline jerikojerk

  • Squad Leader
  • ****
  • Posts: 149
    • View Profile
Re: the AI discussion
« Reply #74 on: September 03, 2010, 11:52:06 pm »
on the theme of alien cheaty vision. i don't care if you remove it. As a alien, i just follow my nose 'cause you human stinks.


@shaunc311, i read you say here are/was up to 10000 possible moves. i don't understand why. if each alien go 30 TU they have max 2*15*2*15=900 new possible positions each (in fact less cause here are corner that are too far away) on void map. I think you can prune many of this possibility.


I read the most of the wall discussion, so i will explain how true alien plays.
about moving alien

That's a basic in military alien, there are secured places and unsecured places. At the beginning, it's impossible to find human in a harvester. If we lose the advantage of god-vision (that was not god vision, that's alien advanced detection), you should make some map marking of where human bastards can be found and where they can't. it's just some probability... over a box. With that aliens will not have to look forward at each turn. Here should not be many level, to start with. 0% is i'm sure where is no enemy, cause i see i or cause i control all the access to go in (that's the funny thing to program), but it can be realy easy cause we alien arrive first so all the map could be set at 0%, then we see your dropship.  it makes noise, heat and it stinks. Next round you put a 50% in all human accessible position. You force 0 in position where you see human are not, 100% where they stand.


We aliens have observed that if we loose, it's because human go at us.. so this is a good guess to improve (unvisible) human estimation by saying human are most likely to come at us than to go in opposite direction. Even an Ortnok beast understand this.

about fire

When we alien open fire, we have a goal. There a to kind of goal: to wound (*** the medikit) or to kill. The wound kind of fire should be used when reenforcement are available (so to say there is a living alien how can be here in 1 round).

There are optimized place to fire. before moving a alien you can make a map crossing number of fire, hit probability (staying and crouched, current AI ignore the fact that we can fire crouched) It's hard to teach an Ortnok that the more it walks, the less it fires. If we are on a hit and run fire, with that system you could go to quit cove, walk to get higher success rate, and retake cover.

If we are on suicidal mission, we can go to the best place to fire the best shot and praying not to be shot back.

I you allow us plan next round... we may do more sophisticate things.

about team playing
There is a fantastic pun in french how says "team's spirit, it's one spirit for one team". It explains how good  French football team is. Alien can mimic this. And it's military basic too. alien associate when they are less than 5 boxes away AND  whith a maximum number of participant (3 aliens/groups sounds good).

how work a group? (it remains me my military classes), the speed of the group is the speed of the slowest, the group try to move together. There is one leader with chose the targets and the (2) others shot at it until the human die. The good new it that those two alien will not have to call the think() function, computer friendly idee. The will just obey the order. And for us, Alien, orders are absolute.  it remains me my military classes, i said.

As a cheat, it could be usefull for alien to see how wealthy are the human. it could allow us not to keep our own record of the number on damages needed to kill one human and how much the human already get. i know, medikit are human way of cheating.

i explain one other point, i previously said that some other alien could request support. My idee on the point is to alert a group of alien not to far, which are not engage in fight, to come quickly. To avoid human get used to set up traps, the alerted alien should refuse the support from time to time, or chose if he gets two alert from two distinct groups.

on sheevar
i just noticed someone say, hoho givind god-view to sheevar is ok. Don't forget that, we alien have hive spirit (not shure of translation). What one alien knows, all the aliens on all the galaxies know. If one Sheevar gets god view, we all get it.


on spides
Bloody AI makers, robots are expensive. as of rev 32055, spiders are fearless and run right in front of human, but don't attak cause they have no more TU. Now all the human rebels have plasma swords. The very first they do, is to destroy them, it costs them 2+7 TU. They can all keep on shooting. There are two solutions, first you give more TU to spiders or you don't send them as long as they can't make one attack.


on human learning technics
There are few things that can make alien adapts to the player. I think there are two kind of players, there are players how allow causalty and players how don't. if we can look in the savegame how much dead soldiers there have been (the count, the average and maybe the standard deviation ) we can guess if we have a player who will get frustred if aliens kill too much soldiers and restart the game. In this case, aliens should prefer suicide mission.

On the other hand, alien can spy human activity and politics. I think there are cases where trying to game over the player with a too much civilian loss is relevant. (i never get this, i just see it in translation strings).

--
i'm just giving ideas, don't know what the api is capable of.