View Page Source

Revision (current)
Last Updated by adelikat on 1/2/2022 8:16 PM
Back to Page

The source used as reference for this page is at https://github.com/OpenDUNE/OpenDUNE

!!!Unit stats

||Unit||Cost||Buildtime||Hitpoints||Range||Damage||Rearm||DPS||Speed||Turn||Movement type
|Carry-All|800|64|100|N/A|N/A|N/A|N/A|200|3|Winged
|Combat Tank|300|64|200|4|25|80|31.25|25|1|Tracked
|Devastator|800|104|400|5|2x40|100|80.00|10|1|Tracked
|Deviator|750|80|120|7|N/A|180|N/A|30|1|Tracked
|Harvester|300|64|150|N/A|N/A|N/A|N/A|20|1|Tracked
|Infantry|100|32|50|2|2x3|45|13.33|5|3|Foot
|MCV|900|80|150|N/A|N/A|N/A|N/A|20|1|Wheeled
|Missile Tank|450|72|100|9|2x75|120|125.00|30|1|Tracked
|Ornithopter|600|96|25|50|2x37|50|148.00|150|2|Winged
|Quad|200|48|130|3|2x7|50|28.00|40|2|Wheeled
|Raider Trike|150|40|80|3|2x5|50|20.00|60|2|Wheeled
|Saboteur|N/A|N/A|10|N/A|N/A|N/A|N/A|40|3|Foot
|Sandworm|N/A|N/A|1000|N/A|N/A|20|N/A|35|3|Slither
|Siege Tank|600|96|300|5|2x30|90|66.67|20|1|Tracked
|Soldier|60|32|20|2|3|45|6.67|8|3|Foot
|Sonic Tank|600|104|110|8|60 base damage|80|?|30|1|Tracked
|Trike|150|40|100|3|2x5|50|20.00|45|2|Wheeled
|Trooper|100|56|45|2 (bullets)%%%5 (rockets)|5 (bullets)%%%4 (rockets)|50|10.00 (bullets)%%%8.00 (rockets)|15|3|Foot
|Troopers|200|56|110|2 (bullets)%%%5 (rockets)|2x5 (bullets)%%%2x4 (rockets)|50|20.00 (bullets)%%%16.00 (rockets)|10|3|Foot

Source: src/table/unitinfo.c

Source for Troopers and Ornithopters: src/script/unit.c, line 628 and 658

* All wheeled and tracked units can be picked up for repair.
* All wheeled and tracked units have a 25% chance to spawn a soldier when dying, except Harvester, which has 50% chance.
* All tracked units can run over and crush units on foot.

Sandworms:

* Sandworms die when losing half their hitpoints.
** In version 1.00 to 1.06, a sandworm will disappear if it devours 4 units.
** In version 1.07 and above, it will disappear after it devours 3 units.

Troopers/Soldiers:

* Infantry and Troopers die when losing half their hitpoints. Infantry turns into Soldier and Troopers into Trooper.

Entering structures:

* Saboteurs deal 500 damage to any structure they enter. This is enough to destroy all structures except for Palaces.
* Soldier/Infantry/Trooper/Troopers can enter and try to take over structures except Barracks, WOR, Outpost, House of IX and Palace.
** If the structure has <25% health, it will be taken over.
** If the structure has >=25% health, it will receive damage: double the health of the entering unit, or half the structure's remaining health, whichever is smaller.

Source: src/unit.c, line 2230

Sonic Tanks:

* Sonic Tanks are immune to Sonic Blasts.
* Sonic Blasts work differently from all other attacks. They deal damage during their move function, not their impact. The blast starts with 60 hitpoints, and loses one hitpoint every gametic. Every gametic the blast is in contact with a unit or structure, it receives blast_hitpoints / 4 + 1 damage.
** The closer a unit/structure is to the Sonic Tank, the more damage it gets.
** The larger a structure is, the more damage it gets, since the blast is in contact longer.
 
Source: src/unit.c, line 1360

!!! Building stats

||Building||Cost||Buildtime||Hitpoints||Power usage||Size||Requirements|| First Mission
|Construction Yard|N/A|N/A|400|0|2x2|N/A|Never
|Slab|5|16|20|0|1x1|None|1
|4 Slabs|20|16|20|0|2x2|None|4
|Windtrap|300|48|200|-100|2x2|None|1
|Refinery|400|80|450|30|3x2|Windtrap|1
|(Radar) Outpost|400|80|500|30|2x2|Windtrap|2
|Spice Silo|150|48|150|5|2x2|Windtrap, Refinery|2
|Light Factory|400|96|350|20|2x2|Windtrap, Refinery|2[#1]
|Starport|500|120|500|50|3x3|Windtrap, Refinery|6
|House of Ix|500|120|400|40|2x2|Windtrap, Refinery, Starport|7
|Palace|999|130|1000|80|3x3|Starport|8
|Wall|50|40|50|0|1x1|Windtrap, Outpost|4
|Turret|125|64|200|10|1x1|Windtrap, Outpost|5
|Rocket Turret|250|96|200|25|1x1|Windtrap, Outpost|6
|Barracks|300|72|300|10|2x2|Windtrap, Outpost|2
|WOR|400|104|400|20|2x2|Windtrap, Outpost, Barracks[#2]|5[#3]
|Heavy Factory|600|144|200|35|3x2|Windtrap, Outpost, Light Factory|4
|Hi-Tech|500|120|400|35|3x2|Windtrap, Outpost, Light Factory|5
|Repair Facility|700|80|200|20|3x2|Windtrap, Outpost, Light Factory|5

Source: src/table/structureinfo.c

[1]: Available in mission 3 by house Harkonnen.%%%
[2]: Barracks not needed by house Harkonnen.%%%
[3]: Available in mission 2 by house Harkonnen.

Source: src/structure.c, line 1895

Turrets:
* Regular turrets have damage 20 and the same firing rate as combat tank. Range unknown.
* Rocket turrets have damage 30 and the same firing rate as missile tank. Range unknown.
** If the enemy unit is 3 tiles away or less, the rocket turret fires a bullet like the regular turret, with the same stats.

Source: src/script/structure.c, function Script_Structure_Fire.

Open questions:
* What is the normal range of the turret and missile turret?

!!! House stats

||House||Mental weakness||Tank degrade chance||Building degrade amount||Special tank||Palace weapon||Palace recharge time
|Atreides|77/256 (30%)|0/256 (0%)|1|Sonic Tank|Fremen (Small group of Troopers)|300 seconds
|Ordos|128/256 (50%)|10/256 (4%)|2|Deviator|Saboteur (Utterly useless in some versions)|300 seconds
|Harkonnen|200/256 (78%)|85/256 (33%)|3|Devastator|Death Hand (Missile)|600 seconds
|Sardaukar|10/256(4%)|0/256 (0%)|1|N/A|Death Hand (Missile)|600 seconds
|Fremen|10/256(4%)|N/A|N/A|N/A|N/A|N/A

* Mental weakness determines both units' likelihood to defect to Ordos when hit by Deviator and units' likelihood to retreat when going from Troopers to Trooper or Infantry to Soldier.
* Tank degrade chance is the risk that a tracked unit (except Harvesters) will be given degrading status when created.
* Building degrade amount determines how much wear buildings take per time unit. See degrade info below.

!! Mission Credits

Regardless of which house you are fighting with, there are 9 missions to complete. Each begin with a preset amount of credits.

||Mission||Atreides||Ordos||Harkonnen
|1|1000|1000|1000
|2|1200|1200|1200
|3|1500|1500|1500
|4|1500|1500|1500
|5|1500|1500|1500
|6|1700|1700|1700
|7|2000|2000|1800
|8|2000|2000|2000
|9|2500|2000|2500

!!! Degrade behavior

!! Weather wear

All structures degrade (lose hitpoints over time due to wear), regardless if they were built on concrete or not. This is possibly an oversight, because the mentats in game say otherwise. Additionally, different Houses suffer different amounts of weather wear per unit of time. See table above.

Buildings will only degrade down to half health. Weather wear does not occur in the first two missions.

!! Power outage wear

When more power is required than is produced, all structures (excluding slabs and walls, but including Construction yards even though they have 0 power usage) lose hitpoints per units of time. The amount lost is always 1.

The wear stops when reaching the same percentage as the power deficit. For example, if total power output is 150 and total power usage is 200, buildings will degrade to 150/200=75% health.

As with weather wear, buildings will not degrade below half health regardless of how low power is.

Source: src/structure.c, function Structure_CalculateHitpointsMax

!! Unit wear

Tanks (all tracked units except Harvesters) can also have a degrade flag. The likelihood that the flag will be set when creating a tank varies per House.

Every time the unit completes a move command, there is a 25% chance it will receive 1 point of damage. This deterioration does not stop at half health.

Source: src/unit.c, line 440 and 1458

!!! Health behavior

!! Power output

Between 50% and 100% health, the Windtrap will deliver power proportionally to its health. Unlike what the GUI says however, the Windtrap will never deliver less than 50 power, not even when it is below 50% health.

Source: src/house.c, line 509

!! Spice unload speed

The spice unload from the harvester to the refinery is affected by the refinery's health, but not the harvester's.

1, 2 or 3 spice percentage points can be unloaded every 6 gametics, with each spice percentage point being worth 7 credits. The formula for how many spice percentage points to unload is as follows:
 uint16 harvesterStep = (s->o.hitpoints * 256 / si->o.hitpoints) * 3 / 256;
 if (u->amount != 0 && harvesterStep < 1) harvesterStep = 1;

The formula only returns 3 when Refinery is at full health (450). It returns 2 above two thirds health (300). Below that it returns 1.

Source: src/script/structure.c, line 125, function Script_Structure_RefineSpice

!! Build speed

The build speed is directly proportional to the health of the building. That is, 39% health means 39% build speed. This applies to Construction yards and all unit producing buildings.

Source: src/structure.c, line 174

(The Repair facility does not have the factory flag set and does not enter this block, even though there seems to be code to handle it.)

!! Unit repair speed and cost

Unit repair speed is also proportional to the health of the Repair facility. However, the unit repair cost is not lowered (as building cost is for Construction yards and factories), so repairing a unit at low Repair facility health is not only slower, it is also more expensive.

Source: src/structure.c, line 272

!! Unit move and attack speed

All units which can fire twice (2x in the table above) only do so when above half health, otherwise they fire once.

All units, except those with Winged movement type, move 25% slower when under half health.

Source: src/unit.c, line 1103

!! Other functions

The speeds of Palace recharge, Building self repair, and Factory upgrades are not affected by building health.

Source: src/structure.c, lines 105, 125, 145

Passive buildings, such as Outposts, House of Ix, and Silos are not affected by health and can be built without concrete to save time and money.

Open question:
* Is anything else, such as Turret attack speed, Starport order time, etc. affected by building health?

!!! Starport

The Starport is highly useful, since it
* Can order units at a cheaper price than normally
* Can order several units at once without worrying about building time
* Can order units even when you are at max allowed units from factories ("Unable to create more")
* Can order units your House may not be able to build
* Can order units before to the prerequisite structures and upgrades are set up

!! Prices

Prices in Starport are random, following the formula:

 credits = (credits / 10) * 4 + (credits / 10) * (Tools_RandomLCG_Range(0, 6) + Tools_RandomLCG_Range(0, 6) );
 return min(credits, 999);

Tools_RandomLCG_Range returns a random integer. This means that a starport price can be between 40% and 160% of the normal price. For example, a harvester which normally costs 300 can cost between 120 and 480, in steps of 30, but the lowest and highest prices are less likely.

Source: src/gui/gui.c - function GUI_FactoryWindow_CalculateStarportPrice

Open questions:
* How often are prices recalculated?

!! Quantities

Every 1800 gametics, the Starport increases the available quantity of a random unit by 1. If the unit is not available in the Starport, the quantity is lost. If the unit is already at max quantity (9) the quantity is lost. The available quantities seem to increase regardless of whether you currently have a Starport or not.

Source: src/house.c, line 89 and 101

The available units and their starting quantities in the Starport are defined per scenario, in the file scenario.pak, under the tag [[CHOAM]]. They are the same for all houses.

|  || Mission 6 || Mission 7 || Mission 8 || Mission 9
|| Trike | 5 | 5 | 5 | 5
|| Quad | 5 | 5 | 5 | 5
|| Combat Tank | 4 | 5 | 5 | 6
|| Missile Tank | 3 | 4 | 4 | 5
|| Siege Tank |  | 3 | 4 | 6
|| Harvester | 2 | 2 | 2 | 4
|| MCV | 2 | 2 | 2 | 2
|| Carry-All | 2 | 2 | 2 | 2
A definition for Ornithopters is also included, but due to a spelling mistake, it is not read by the game.

Source, src/scenario.c, function Scenario_Load_Choam

!!! Reduced attack damage

Basically all attacks (except sonic blasts) do their damage via an explosion. The damage is shifted right (halved and rounded down) for every distance unit between the explosion and the unit taking damage. For example, the Quad deals 7/2 = 3.5 -> 3 damage when slightly missing.

By having the unit in motion while it is being attacked, damage can be significantly reduced, to 50% or even 25%.

At higher game speeds, projectiles from bullet attacks move too fast and sometimes pass the center of the intended target before detonating, even when both attacker and target are stationary. This depends on the position of the attacker relative to the target (T). This chart shows if full or half damage is dealt, and applies to all attackers with bullet weapons: Soldiers, Troopers at close range, Trikes, Quads, Combat Tanks, Siege Tanks and Devastators.

|  || -5 || -4 || -3 || -2 || -1 || 0 || 1 || 2 || 3 || 4 || 5
|| -5 |  |  |  |  |  | 1 |  |  |  |  |  |
|| -4 |  |  |  | ½ | 1 | 1 | 1 | ½ |  |  |  |
|| -3 |  |  | ½ | ½ | 1 | 1 | 1 | ½ | ½ |  |  |
|| -2 |  | ½ | ½ | ½ | 1 | 1 | 1 | ½ | ½ | ½ |  |
|| -1 |  | ½ | 1 | ½ | 1 | 1 | 1 | ½ | 1 | ½ |  |
|| 0 | ½ | ½ | ½ | ½ | ½ | T | ½ | ½ | ½ | ½ | ½
|| 1 |  | ½ | ½ | ½ | ½ | 1 | ½ | ½ | ½ | ½ |  |
|| 2 |  | ½ | ½ | ½ | ½ | 1 | ½ | ½ | ½ | ½ |  |
|| 3 |  |  | 1 | ½ | ½ | 1 | ½ | ½ | 1 |  |  |
|| 4 |  |  |  | ½ | ½ | 1 | ½ | ½ |  |  |  |
|| 5 |  |  |  |  |  | 1 |  |  |  |  |  |

As you can see, the chart is symmetric east/west, but not north/south, and favors an attacker from the north.

Source: scr/map.c, function Map_MakeExplosion

Open questions:
* How big is a distance unit in this case? 2 pixels?

!!! Exploitable game bugs

!! Combat

* In most versions of the game (TODO: determine which version patch fixes this), when a Carry-All lands a combat unit close to enemies, it is ignored by the AI until it uses a projectile to fire on enemy units.
** Sonic tanks since they do not use projectile attacks are then indefinitely ignored by the AI and can be used to single handedly demolish an entire enemy base without the AI retaliating.
*** However if you use the actual Attack command on a unit, the AI will know. Instead attack by shooting in a unit's direction instead of explicitly letting the game know you want to attack it.
** Buildings can be attacked without the AI noticing.
** Vehicles carrying explosives can thus be invisibly driven right up to key infrastructure.
** You can force a Carry-All to land a combat unit close to enemies by building a repair factory, surrounding it, then firing on your own unit somewhere till it starts smoking. The Carry-All will take it to be repaired, then fly it back to where it was when done, since the unit cannot exit the repair factory on its own.
* In some versions of the game, when clicking on an enemy turret, it will turn its gun immediately to the left. Using this bug, one can drive by on the right of enemy turrets and click on them to make then face the other way and unable to fire on your units.
* In versions 1.00 to 1.06 of the game, enemy turrets do not fire on Fremen troops when playing as Atreides. Your own turrets always fire on Fremen when not playing as Atreides.
* When there are many units on the map, units outside the current screen (except Carry-Alls, Ornithopters, Saboteurs, Harvesters and Sand worms) move slower than those off the screen. Look at your own key units to make them move faster, and do not view enemy units so they move more slowly.
* Sonic tanks shoot farther on faster game speeds.
* The range of turrets depends on direction of fire and angle the target is at. Extra distance is allowed upwards/leftwards but not downwards/rightwards. This is because attack distance calculations are performed on the top left corner of turrets, instead of their center. Units do not appear to be affected by this bug. Source: src/script/structure.c, line 321
** As part of exploiting this, between multiple map choices when selecting the next level, select the one where the base locations offer a greater advantage to yourself.
* Enemy units with bullet-type weapons (all except Ornithopter, Sonic Tank, Missile Tanks and Trooper/s at long range) will happily fire upon their own building if they are in line of fire when attacking your own units. Sonic Tanks do this as well, but then your units also take damage.
* Deviated units continue to carry out their last given order even after the effects of deviation wear off.
** It is possible to order the deviated unit to attack its own structures, and it will do so until the building falls. Other enemy units and turrets will not attack it while it does this.
** It is possible to order the deviated unit to attack ground in a remote corner of the map, taking it out of combat permanently.
** It is possible to order Harkonnen Devastators to self destruct.

!! Harvesting

* Credits (money/spice) is stored in a signed 16 bit integer and can be overflowed. At this point, you can start building for free till you overflow again.
* The spice cap (refineries + silos) is only calculated for the House which built the latest structure. It is therefore possible to go over spice cap.
** The spice cap also includes structures that are built but not yet placed.
* This one is more like an oversight. An exploded harvester disperses more spice than it actually contains.
** If you only have one harvester and it explodes (or is deviated), you get a new one for free.
*** If you have little spice near your base, you can let the harvester fill mostly up, blow it up, then get a new free harvester which can harvest a lot more spice close to your base.
* The first harvester is delivered by Carry-All when the first refinery is built. Normally this Carry-All then leaves, but in version 1.00 to 1.06 if you place your refinery close enough to a spice patch, and order the harvester to return as soon as it has harvested a little bit of spice, the Carry-All will airlift it back and then stay, gaining you a free Carry-All.
* Enemy Harvesters which run over a unit on foot stop harvesting permanently.

!! Other

* Due to rounding errors in version 1.07 and above, repair cost is incorrectly calculated. Palaces can be repaired for free.
* Not so much a bug, but Carry-Alls become more active if you have more RAM.