Jump to content

Dune II: Version Discussion


Recommended Posts

Posted

To skip launchers tech (and only this), it should be: si->upgradeCampaign[2] > g_scenarioID

Maybe it's only a typo if for Amiga and Sega this line it's changed.

No, that's not right. To skip launcher tech it should be

    si->upgradeCampaign[2] > g_camaignID + 1
g_campaignID is the mission number/tech level, i.e. 0..8.

g_scenarioID is the file name number to load, i.e. 1..22.

 

But here the other thing, no one answered me that yet here with code, or whatever:

 

Siege tanks in L5 with Atreides by taking over the Ordos Heavy Factory.

I succeeded in it again.

Because Atreides can upgrade any heavy factory they own twice in level 5, and

an heavy factory created by Ordos can build siege tanks after 2 upgrades.

In Structure_GetBuildable:

    if (unitType == UNIT_SIEGE_TANK && s->creatorHouseID == HOUSE_ORDOS) upgradeLevelRequired--;

bearing in mind that AI doesn't need to upgrades:

/* AIs get the full upgrade immediately */    if (houseID != g_playerHouseID) {        while (true) {            if (!Structure_IsUpgradable(s)) break;            s->upgradeLevel++;        }        s->upgradeTimeLeft = 0;    }
then if you play as Ordos and take over Heavy Factory on Mission 5th against Atreides, you'll get a Heavy Factory with existing 2 upgrades (regular default for the mission);
When you capture the factory, the Ordos heavy factory has only

been upgraded once (tested in OpenDUNE). Otherwise the AI would

be able to build siege tanks throughout the level.

 

but if Ordos has the exception:

/* Ordos Heavy Vehicle gets the last upgrade for free */if (s->o.houseID == HOUSE_ORDOS && s->o.type == STRUCTURE_HEAVY_VEHICLE && s->upgradeLevel == 2) s->upgradeLevel = 3;
explains how the second upgrade that gave launchers to Atreides offering instead siege tanks to Ordos. ;)
There's a difference between a structure's creatorHouseID and houseID,

houseID is the current owner. This line bumps up the structure's

upgrade level when it is currently owned by Ordos so that

(1) the Ordos player doesn't get useless a third upgrade, and

(2) when someone captures a twice upgraded Ordos factory, they too can build siege tanks.

  • Upvote 2
Posted

@drnovice

That explanation goes for V1.0

The one that I played. Thanks.

 

@dynasty

Opendune has V1.07

So that code has been changed.

I asked for the code in V1.0 :)

Which drnovice supplied.

 

I tested the capturing on both versions.

V1.0, siege tanks in A5.

V1.07, no siege tanks in A5.

 


 

I once had that self destruct. In V1.0. It was a Silo.

I think, the structure gets captured and damaged at the same time due to a bug. Resulting in a loss of a structure for the player. And as an extra, in V1.0, buildings where slowly degrading in health. Perhaps that worked too.

Posted

I have split this topic from the harvester replacement question. This has got very interesting BTW :)

Do you know what about "self-destruct" structures mentioned by the Manual?

At first it seems like an error in the manual (similar to what it says about spice blooms, mentioning the Special blooms that were left out), however I can tell you I observed once some very weird behaviour in v1.0. I loaded an old savegame that I had, and IIRC a structure that I had captured (this was something like mission 4 playing as AT vs HK), which was actually a Heavy Factory, exploded right after loading the mission for no reason.

This might be an unrelated bug though, because once I also loaded a mission on v1.0 when playing as HK, and my Construction Yard (this was the start of the mission) also blew up for no reason.

And as an extra, in V1.0, buildings where slowly degrading in health. Perhaps that worked too.

This happens in v1.07 as well, however structures never go below 50% HP that way (same with damage caused by power shortage).
Posted

Ow, but in the android version, the automatic damage has been removed. No damage at all to the buildings just like in level 1 and 2.

 

With power shortage however, your buildings eventually even die.

I used this against the AI.

 

I think there are some major differences between open dune and the android version.

Posted

With power shortage however, your buildings eventually even die.

I used this against the AI.

This is what happens when game balance is played with recklessly. There are plenty scenarios late in the game when the AI does not have sufficient windtraps to power its base. In the last mission, the AI players are lucky to have at least one windtrap, if any at all. In the original game, this is no problem as buildings slowly decay to 50% HP, at which point the AI automatically repairs them.
Posted

Very curious the Manual:

The yellow part is to try to explain the bug showed above, but the red part is fool (?!?) :blink:

I still find it ridiculous that they foresaw the fact you could capture special weapons, and still made the Deviator just change things to the Ordos house :P
Posted

I still find it ridiculous that they foresaw the fact you could capture special weapons, and still made the Deviator just change things to the Ordos house :P

Maybe it's because the Deviator was coded later on in the development cycle, or they didn't do any proper testing. It might very well be the case that the Deviator logic for other Houses is simply broken rather than absent. I remember that when I was plying around with the original Super Dune 2 missions, where you have Deviators when playing as the "new sides" sometimes, I tried using such a Deviator on my own units while playing as the Sardaukar. It changed to the Ordos side, however the subtitles showed the message, Sardaukar approaching (I was playing with digitized sound off). Also I'm not sure but maybe this deviated unit did not trigger the "discovery" of the AI by the player and the subsequent enemy attack (this was the start of mission 9, so activating the AI would result in immediate Palace superweapon use by AI players). However I am not 100% sure about that.
Posted

All 3 special tanks where experimental at that time.

I am sure that they never intended the Sonic Tank to be so OP once placed in a larger group.

The same goes for the super weapons.

 

I think that, the very last thing they coded was the deviator and the saboteur. They also forgot to remove the glitch that you could use once an enemy unit becomes an enemy again.

 

Ever tried the deviator amass? It is fun to watch the enemy never reaching your base and simply kill each other. That too is OP. I even noticed how some enemies kept fighting each other after returning back to normal. Although, killing the enemy base is still up to your own Rocket Launchers or Siege Tanks.

Posted

I am sure that they never intended the Sonic Tank to be so OP once placed in a larger group.

Sure they did. Otherwise it wouldn't have that specific immunity to is own weapon. That clearly shows they were meant to be used in groups.
  • Upvote 1
Posted

I thought they added immunity because the Sonic Tank shock wave starts in the location of the Sonic Tank. It hits every location unlike other projectiles. Thus the Sonic Tank itself gets hit as well. They didn't know the way around back then like letting the blast start one square further without a start misdirection. So instead, they gave the Sonic Tank immunity to the shock wave. And thus it didn't damage itself any more.

 

In Dune2000 and EBFD they do damage their own kind. The wave simply starts damaging at a later time. If you edit the speed of the sonic tank. And move forward into the wave. The tank gets hit by its own wave.

  • Upvote 1
Posted

I thought they added immunity because the Sonic Tank shock wave starts in the location of the Sonic Tank. It hits every location unlike other projectiles. Thus the Sonic Tank itself gets hit as well.

That can be easily tested by removing the immunity through Nyer's editor and checking if the Sonic Tank damages itself upon firing.
Posted

Tested Sonic Tanks without sonic immunity, in original Atreides Mission 9 (you have 2 of them) and it isn't as X3M told: if they shoot don't damage themselves.

In original game they make a combo to defensive maneuvers, since you can put them in columns and enemy units never change the target due the sonic attacks.

In a skirmish game (as DuneLegacy) they create a very strategic particular exception that neutralizes them in case "sonic VS sonic". :)

 

@MrFlibble: when I have more time I would like to show the code about how works the Deviator. ;)

  • Upvote 1
Posted

Maybe it's because the Deviator was coded later on in the development cycle, or they didn't do any proper testing. It might very well be the case that the Deviator logic for other Houses is simply broken rather than absent. I remember that when I was plying around with the original Super Dune 2 missions, where you have Deviators when playing as the "new sides" sometimes, I tried using such a Deviator on my own units while playing as the Sardaukar. It changed to the Ordos side, however the subtitles showed the message, Sardaukar approaching (I was playing with digitized sound off). Also I'm not sure but maybe this deviated unit did not trigger the "discovery" of the AI by the player and the subsequent enemy attack (this was the start of mission 9, so activating the AI would result in immediate Palace superweapon use by AI players). However I am not 100% sure about that.

I guess it's was coded later, maybe when had to be released, and developers couldn't do appropriate testing.

In original Dune 2 code (see OpenDune release 0.7  -> http://binaries.opendune.org/releases/0.7/ ) functions about "deviating events" have deviant HouseID hardcoded as 02, so fixed as House Ordos.

 

STEP 1/2

How I shown some time ago: https://github.com/OpenDUNE/OpenDUNE/pull/176  (Deviator Patch)

it refered on opendune release 0.7, as more faithful reconstruction of original 16bit code (DUNE2.EXE), where is assumed to include a "deviant HouseID parameter" (House that controls the Deviator) into functions related to deviating events:

https://github.com/AndO3131/OpenDUNE/commit/f863a0df4b4f0b35727eb37507d7aa95122a3574

 

wangds suggested to create a new variable to keep this deviant HouseID: "deviationHouse"

You can introduce a new variable into the unit structure these days (please call it "deviationHouse"), instead of dividing the existing deviated variable up like that. This can be saved into the ODUN section. This would also have better compatability when loading games from Dune II.

and whenever it makes a check to return HouseID of an existing Unit into Scenario level (Unit_GetHouseID function), if u->deviated (the variable that set the "available time to use deviated unit") isn't zero, then unit is successful deviated and new owner is set:

https://github.com/AndO3131/OpenDUNE/commit/d6d8cd3ea5f52c7ca617ac18b918d20cf043b0d2

 

A recap of changes between OpenDune release 0.7 and release 0.8

 

OpenDune release 0.7 shows more faithful as original DUNE2.EXE 16bit:

/**

 * Make a deviator missile explosion on the given position, of a certain type. All units in the

 *  given radius may become deviated.

 * @param type The type of explosion.

 * @param position The position of the explosion.

 * @param radius The radius.

 */

void Map_DeviateArea(uint16 type, tile32 position, uint16 radius)

{

    PoolFindStruct find;

    Explosion_Start(type, position);

    find.type    = 0xFFFF;

    find.index   = 0xFFFF;

    find.houseID = HOUSE_INVALID;

    while (true) {

        Unit *u;

        u = Unit_Find(&find);

        if (u == NULL) break;

        if (Tile_GetDistance(position, u->o.position) / 16 >= radius) continue;

        Unit_Deviate(u, 0);

    }

}

[...]

/**

 * Deviate the given unit.

 *

 * @param unit The Unit to deviate.

 * @param probability The probability for deviation to succeed.

 * @return True if and only if the unit beacame deviated.

 */

bool Unit_Deviate(Unit *unit, uint16 probability)

{

    const UnitInfo *ui;

    if (unit == NULL) return false;

    ui = &g_table_unitInfo[unit->o.type];

    if (!ui->flags.isNormalUnit) return false;

    if (unit->deviated != 0) return false;

    if (ui->flags.isNotDeviatable) return false;

    if (probability == 0) probability = g_table_houseInfo[unit->o.houseID].toughness;

    if (unit->o.houseID != g_playerHouseID) {

        probability -= probability / 8;

    }

    if (Tools_Random_256() >= probability) return false;

    unit->deviated = 0x78;

    Unit_UpdateMap(2, unit);

    if (g_playerHouseID == HOUSE_ORDOS) {

        Unit_SetAction(unit, ui->o.actionsPlayer[3]);

    } else {

        Unit_SetAction(unit, ui->actionAI);

    }

    Unit_UntargetMe(unit);

    return true;

}

[...]

/**

 * Get the HouseID of a unit. This is not always u->o.houseID, as a unit can be

 *  deviated by the Ordos.

 *

 * @param u Unit to get the HouseID of.

 * @return The HouseID of the unit, which might be deviated.

 */

uint8 Unit_GetHouseID(Unit *u)

{

    if (u->deviated != 0) return HOUSE_ORDOS;

    return u->o.houseID;

}

and OpenDune release 0.8 already has by default this change so we can see functions including "uint8 houseID" parameter:

/**

 * Make a deviator missile explosion on the given position, of a certain type. All units in the

 *  given radius may become deviated.

 * @param type The type of explosion.

 * @param position The position of the explosion.

 * @param radius The radius.

 * @param houseID House controlling the deviator.

 */

void Map_DeviateArea(uint16 type, tile32 position, uint16 radius, uint8 houseID)

{

    PoolFindStruct find;

    Explosion_Start(type, position);

    find.type    = 0xFFFF;

    find.index   = 0xFFFF;

    find.houseID = HOUSE_INVALID;

    while (true) {

        Unit *u;

        u = Unit_Find(&find);

        if (u == NULL) break;

        if (Tile_GetDistance(position, u->o.position) / 16 >= radius) continue;

        Unit_Deviate(u, 0, houseID);

    }

}

[...]

/**

 * Deviate the given unit.

 *

 * @param unit The Unit to deviate.

 * @param probability The probability for deviation to succeed.

 * @param houseID House controlling the deviator.

 * @return True if and only if the unit beacame deviated.

 */

bool Unit_Deviate(Unit *unit, uint16 probability, uint8 houseID)

{

    const UnitInfo *ui;

    if (unit == NULL) return false;

    ui = &g_table_unitInfo[unit->o.type];

    if (!ui->flags.isNormalUnit) return false;

    if (unit->deviated != 0) return false;

    if (ui->flags.isNotDeviatable) return false;

    if (probability == 0) probability = g_table_houseInfo[unit->o.houseID].toughness;

    if (unit->o.houseID != g_playerHouseID) {

        probability -= probability / 8;

    }

    if (Tools_Random_256() >= probability) return false;

    unit->deviated = 120;

    unit->deviatedHouse = houseID;

    Unit_UpdateMap(2, unit);

    if (g_playerHouseID == unit->deviatedHouse) {

        Unit_SetAction(unit, ui->o.actionsPlayer[3]);

    } else {

        Unit_SetAction(unit, ui->actionAI);

    }

    Unit_UntargetMe(unit);

    unit->targetAttack = 0;

    unit->targetMove = 0;

    return true;

}

[...]

 

/**

 * Get the HouseID of a unit. This is not always u->o.houseID, as a unit can be

 *  deviated by the Ordos.

 *

 * @param u Unit to get the HouseID of.

 * @return The HouseID of the unit, which might be deviated.

 */

uint8 Unit_GetHouseID(Unit *u)

{

    if (u->deviated != 0) {

        /* ENHANCEMENT -- Deviated units always belong to Ordos, no matter who did the deviating. */

        if (g_dune2_enhanced) return u->deviatedHouse;

        return HOUSE_ORDOS;

    }

    return u->o.houseID;

}

step 2/2 on next post...

  • Upvote 1
Posted

Now talking about u->deviated variable and how it is managed:

 

STEP 2/2

When an Unit is successful deviated, u->deviated is set to 120 (0x78), but why?

It depends to operation makes on deviated Unit, just search about call to Unit_Deviation_Decrease function to know that:

1) whenever player clicks on a command button of Unit Commands Menu u->deviated is decreased to 5

2) whenever the deviated Unit fires u->deviated is decreased to 20 (if it fires twice is -40)

3) whenever the deviated Unit reach a destination u->deviated is decreased to 10

4) every 60 ticks (1second) u->deviated is decreased to 1, even if deviated Unit do nothing

 

Now we undestand why 120 is initial value, which corresponds to 2 minutes if nothing is done with deviated Unit. More things are done with this Unit, less time it remains deviated.

 

This is the function that decrease the time of deviation:

 

/**
 * Decrease deviation counter for the given unit.
 *
 * @param unit The Unit to decrease counter for.
 * @param amount The amount to decrease.
 * @return True if and only if the unit lost deviation.
 */

bool Unit_Deviation_Decrease(Unit *unit, uint16 amount)
{
    const UnitInfo *ui;

    if (unit == NULL || unit->deviated == 0) return false;

    ui = &g_table_unitInfo[unit->o.type];

    if (!ui->flags.isNormalUnit) return false;

    if (amount == 0) {
        
amount = g_table_houseInfo[unit->o.houseID].toughness;
    }

    if (unit->deviated > amount) {
        unit->deviated -= amount;
        return false;
    }

    unit->deviated = 0;

    unit->o.flags.s.bulletIsBig = true;
    Unit_UpdateMap(2, unit);
    unit->o.flags.s.bulletIsBig = false;

    if (unit->o.houseID == g_playerHouseID) {
        Unit_SetAction(unit, ui->o.actionsPlayer[3]);
    } else {
        Unit_SetAction(unit, ui->actionAI);
    }

    Unit_UntargetMe(unit);
    Unit_SetTarget(unit, 0);
    Unit_SetDestination(unit, 0);

    return true;
}

 

Moreover, if deviated Unit is hit by another unit, Unit_Deviation_Decrease is called with amout=0 so the amout becomes the House toughness on deviating, that for original sides is:

  • Harkonnen 200/256 (78%)
  • Atreides 77/256 (30%)
  • Ordos 128/256 (50%)

For Harkonnen and Ordos tough value is greater than initial u->deviated setting (120), so when a deviated Unit of this Houses is hit once, it returns immediately to original House owner. For Atreides it have to be hit twice (77 * 2) to overcome 120.

 

 

 

P.S. @MrFlibble: Yes when you deviate even its unit with hardcodes Ordos 02 deviant HouseID if you don't play as Ordos, since it becomes an Ordos unit, the alert informs enemy presence, but it's read original HouseID owner, and not new changed owner!

  • Upvote 1
Posted

I thought they added immunity because the Sonic Tank shock wave starts in the location of the Sonic Tank.

That seems very unlikely, since in the C&C engine (as it's used in C&C1 and RA1 anyway, not sure about the later ones), it's actually completely impossible for anything to get damaged by a weapon fired by itself. I found this out by giving some infantry unit the Napalm weapon, which spawned a bomb above it, falling down and exploding on itself. It only damaged the surrounding units. In a fun twist of this, you can use the ion cannon on your own Advanced Com Center and it won't get any damage, since technically the weapon is fired by that building.

(note that this doesn't apply to the nuke because it has a 2-stage launch process)

In Dune II, the same thing applies, which can be tested by giving a tank an attack command on a cell it already started moving onto. You'll see the bizarre effect of a tank firing on itself, and as with the Sonic Tank, it'll take no damage from this.

 

P.S. @MrFlibble: Yes when you deviate even its unit with hardcodes Ordos 02 deviant HouseID if you don't play as Ordos, since it becomes an Ordos unit, the alert informs enemy presence, but it's read original HouseID owner, and not new changed owner!

Seems like another thing to patch then, heh.
  • Upvote 2
Posted

That seems very unlikely, since in the C&C engine (as it's used in C&C1 and RA1 anyway, not sure about the later ones), it's actually completely impossible for anything to get damaged by a weapon fired by itself. I found this out by giving some infantry unit the Napalm weapon, which spawned a bomb above it, falling down and exploding on itself. It onyl damaged the surrounding units. In a fun twist of this, you can use the ion cannon on your own Advanced Com Center and it won't get any damage, since technically the weapon is fired by that building.

In Dune II, the same thing aplies, which can be tested by giving a tank an attack command on a cell it already started moving onto. You'll see the bizarre effect of a tank firing on itself, and as with the Sonic Tank, it'll take no damage from this.

Very interesting. By the way, by testing Sonic Tanks with sonic immunity disabled, they take damage as well.

Seems like another thing to patch then, heh.

It shouldn't be really necessary since when you use a Deviator to deviate an enemy unit, you should deviate into own House side, not another different side... ;)
Posted

Tested Sonic Tanks without sonic immunity, in original Atreides Mission 9 (you have 2 of them) and it isn't as X3M told: if they shoot don't damage themselves.

 

By the way, by testing Sonic Tanks with sonic immunity disabled, they take damage as well.

 

Ok, now I am confused.

So they don't damage themselves. But they do damage other Sonic Tanks after immunity is removed?

Posted

Both the posts are referred to removed sonic immunity flag: they don't damage themselves when shot, but other sonic tanks take damage by that hit.

 

You can test by yourself. ;)

Posted

Very interesting. By the way, by testing Sonic Tanks with sonic immunity disabled, they take damage as well.

Obviously. That's what the options DOES. That's how I identified it in the first place :)

 

It shouldn't be really necessary since when you use a Deviator to deviate an enemy unit, you should deviate into own House side, not another different side... ;)

Well, not really. It's not related to the other bug, really. If you send a tank to an Ordos base, and it gets deviated and is then sent back to attack you, the message will warn you about a unit of your own side approaching instead of an Ordos one. Even if the always-deviate-to-Ordos bug is fixed, and the unit was deviated by a different side than Ordos, this doesn't change the fact that the message is wrong; it IS the side that deviated the unit that is attacking you with it, technically.
  • Upvote 1
Posted

If you send a tank to an Ordos base, and it gets deviated and is then sent back to attack you, the message will warn you about a unit of your own side approaching instead of an Ordos one. Even if the always-deviate-to-Ordos bug is fixed, and the unit was deviated by a different side than Ordos, this doesn't change the fact that the message is wrong; it IS the side that deviated the unit that is attacking you with it, technically.

Actually, it makes sense to me that if your unit is deviated and attacks your base, it should be announced as your own side - at the very least, to inform the player of a deviated unit that can be changed back to normal.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.