Surrender

Post ALL Public Beta feedback here!

Moderators: Gil R., ericbabe

Post Reply
Viking67
Posts: 608
Joined: Wed May 05, 2004 5:45 pm

Surrender

Post by Viking67 »

At night, when my units morale falls below zero and they are in an enemy ZOC, they surrender. However, when the AI's units experience the same situation, they do not surrender, they retreat. Is this intential?
Killer B
Walloc
Posts: 3143
Joined: Mon Oct 30, 2006 1:04 am
Location: Denmark

RE: Surrender

Post by Walloc »

A quick questions that might be the cause or just its me on a wild goose chase.
Was the unit in question an artillery brigade?

Surrender rules for Artillery brigades are different than all other units both at day and night, why i ask. It could possibly answer it, else im /boggled too.

Kind regards,

Rasmus
Viking67
Posts: 608
Joined: Wed May 05, 2004 5:45 pm

RE: Surrender

Post by Viking67 »

No. This is infrantry.
Killer B
User avatar
ericbabe
Posts: 11852
Joined: Wed Mar 23, 2005 3:57 am
Contact:

RE: Surrender

Post by ericbabe »

Units surrender if they have nowhere to go on their move that brings them closer to their side of the map.  The code that controls this doesn't distinguish between AI and human-controlled units:

void CHexWar::DoRoutMove(int h)
{
    TBat* pBat = &Bat[h];
    // nearest to edge, and move there
    int best = 99999;
    int bestX = -1;
    int bestY = -1;
    int edge;        // dist to edge
    int score;
// if we're surrendered, stand fast
    if (pBat->bSurrendered)
        return;
// if we're tangled artillery just surrender instead
    if (MasterPieces[pBat->type].IsArtillery() &&
        pBat->bFatigue)
    {
        int hNear = FindNearestEnemy(Bat[h].hPlayer, Bat[h].x, Bat[h].y);
        if (hNear && Dist(Bat[h].x, Bat[h].y, Bat[hNear].x, Bat[hNear].y)==1)
            PTGame->Send_ServerOrClient_Do_X_Command(HW_Surrender_ServerCommand, h);
        else
            pBat->bFatigue = false;
        return;
    }

// if we're at the edge of the map right now, remove from map
    edge = min(min(pBat->x,pBat->y), min(HexMapSize-pBat->x, HexMapSize-pBat->y));
&nbsp;&nbsp;&nbsp; if (edge<=1)
&nbsp;&nbsp;&nbsp; {
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; RetreatPiece(h);
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return;
&nbsp;&nbsp;&nbsp; }

&nbsp;&nbsp;&nbsp; bool bNowhereToRun = true;

&nbsp;&nbsp;&nbsp; for (int x=0; x<HexMapSize; x++)
&nbsp;&nbsp;&nbsp; {
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; for (int y=0; y<HexMapSize; y++)
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (Move[x][y]>0 && !hBat[x][y])
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // get nearest visible enemy
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // get dist to edge
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (pBat->team==0)
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; score = y;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; score = HexMapSize-y;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (score<best)
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; bNowhereToRun = false;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; best = score;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; bestX = x;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; bestY = y;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }
&nbsp;&nbsp;&nbsp; }
&nbsp;&nbsp;&nbsp; if (bestX>-1 && bestY>-1)
&nbsp;&nbsp;&nbsp; {
&nbsp;&nbsp;&nbsp; // move
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Do_HW_Move_ServerCommand(h, bestX, bestY, 1);
&nbsp;&nbsp;&nbsp; }
&nbsp;&nbsp;&nbsp; else if ((bNowhereToRun) ||
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;(pBat->Name[0]=='*' && IsFort(Map[pBat->x][pBat->y])))
&nbsp;&nbsp;&nbsp; {
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; int hNear = FindNearestEnemy(Bat[h].hPlayer, Bat[h].x, Bat[h].y);
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (hNear && Dist(Bat[h].x, Bat[h].y, Bat[hNear].x, Bat[hNear].y)==1)
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; PTGame->Send_ServerOrClient_Do_X_Command(HW_Surrender_ServerCommand, h);
&nbsp;&nbsp;&nbsp; }
}


Image
Viking67
Posts: 608
Joined: Wed May 05, 2004 5:45 pm

RE: Surrender

Post by Viking67 »

Ok. I now understand what was happening.

My units which surrendered at night were usually dug in on a hill side, with rocks. When their morale fell below zero, they did not have enough movement points to move, and thus surrendered.

The AI units in question were on flat, clear ground, and had at least enough movement points to move one space at night.

Thank you.
Killer B
User avatar
Gil R.
Posts: 10820
Joined: Fri Apr 01, 2005 4:22 am

RE: Surrender

Post by Gil R. »

You should have bought them a military band! A military band might have saved them! (As well as tipped off the enemy to their location.) (Definition: "10%_chance_to_rally_a_unit_with_negative_morale."
Michael Jordan plays ball. Charles Manson kills people. I torment eager potential customers by not sharing screenshots of "Brother Against Brother." Everyone has a talent.
Post Reply

Return to “Public Beta Feedback”