MrFlibble Posted October 6, 2009 Author Share Posted October 6, 2009 I've been browsing through old posts in the Dune II forum, and found that some people mention the AI is harder in The Building of A Dynasty than in The Battle for Arrakis:I were playing Dune2 Battle for arrakis then and when i download the game from the internet i get Dune2 a building of a dinasty. Is it the update or what??I noticed that ai got better and sand worms eat more then 2 units.On battle for arrakis sandworms eat 2 units and then dissapair.On building of a dinesty sandworms eat more then 2 units. On battle for arrakis AI even worse. When i used my tactics on buuilding of a dinesy they allmost killed me and believe me i am not a noob at dune2.but everyone says that ai is better in dynastiOf course, these people could have been talking about the The Building of A Dynasty v1.0 included with the original Super Dune 2 release, which has the "instant build" hack, thus making the AI more difficult. But I also got the impression that with the team bug fixed, the AI is harder in v1.0 than in v1.07: it builds more units and/or sends out attack teams more often.I thought it could be due to money management: in v1.07, the AI spends some of its spice on rebuilding structures, whereas it might not do so in v1.0. Would be nice to know if this is true or not, but I don't have time for testing ATM.Also, here's another topic of interest: http://forum.dune2k.com/index.php?topic=21421.0EDIT: I decided not to post once more, since this is related to what I said previously. Remember out discussion of the LemonFactor variable?Perhaps it's the chance a unit will be manufactured to act defensively - i.e. sit around like a lemon? Harkonnen are very defensive, Ordos slightly, Atreides not at all, and Fremen and Sardaukar always attack once they spawn.I don't know if this has to do with the LemonFactor (probably not, after all), but it seems to me that the AI behavior is different depending on the Human player's House. Remember Daelin said that each playable House represents a difficulty level (Harkonnens=Easy, Atreides=Medium, Ordos=Hard)? I think the AI is less aggressive when you play the Harkonnens as compared to the Ordos for example. Still, more testing is needed to confirm this. Quote Link to comment Share on other sites More sharing options...
Nyerguds Posted October 9, 2009 Share Posted October 9, 2009 Remember Daelin said that each playable House represents a difficulty level (Harkonnens=Easy, Atreides=Medium, Ordos=Hard)?This doesn't relate to the LemonFactor though. LemonFactor goes from low to high in the order Atreides, Ordos, Harkonnen. Atreides even has 0 there. Quote Link to comment Share on other sites More sharing options...
MrFlibble Posted October 10, 2009 Author Share Posted October 10, 2009 It does not, as it seems, but it has to do with some AI behavior though:hahah, just to make things really interesting...LemonFactor only seems to be used within the UnitCreate function, and only if MovementType == 1its compared against a value from the mapSeedRandomGet function, still not sure what this is does exactly...but, it sets the 0x400 in the EMCDATA field... hmmseg031:0A91 26 83 7F 3C 01 cmp es:[bx+_unitData.MovementType], 1...seg031:0A98 9A 0E 00 B8 39 call mapSeedRandomGetseg031:0A9D 50 push ax...seg031:0AA8 58 pop axseg031:0AA9 3B 87 F2 37 cmp ax, houseData.LemonFactor[bx]seg031:0AAD 73 09 jnb short loc_28E18seg031:0ABD C4 5E F8 les bx, [bp+unitDataPtr]seg031:0AB2 26 81 4F 04 00 04 or word ptr es:[bx+_unitGame.emcData], 400hAnyhow, it would be nice to find answers to all those questions though. Quote Link to comment Share on other sites More sharing options...
Daelin Posted October 10, 2009 Share Posted October 10, 2009 Remember Daelin said that each playable House represents a difficulty level (Harkonnens=Easy, Atreides=Medium, Ordos=Hard)? I think the AI is less aggressive when you play the Harkonnens as compared to the Ordos for example. Still, more testing is needed to confirm this.Actually this observation was related to techtree limitations and nothing more. The computer is just as stupid when playing harkonnen, ordos or atreides. I wonder if that Lemon Factor was actually implemented in the game. If modifying its values heavily does nothing then it's probably unused. Segra and his assembly magic may help here more. -Daelin Quote Link to comment Share on other sites More sharing options...
segra Posted October 11, 2009 Share Posted October 11, 2009 this is how it works, during unit creationif( MovementType == _UnitMovement_Tracked ) { word ax = seedRandomGet(); if( ax < LemonFactor) _state |= _objectState_400; // turn on state400}later in one of the unitmovement functions, once the unit is within 16 pixels of the destination tile,it checks for '_UnitOpts2_ExplodeAtDestination' flag, if the flag is NOT on,if( dataGet()->optsFitW & _UnitOpts2_ChangeOrders ) { < other unrelated junk cut > if( _state & _objectState_400 ) { if( !(seedRandomGet() & 3)) objectDamageTake( 1, 0 );}(thats 1 point of dmg, only if the seed value doesnt contain the bits for '3')also just noticed (not sure if we've discussed this before?) but the weakness value in the housedata, when the unit is trooper/infantry is the chance of a unit retreating (when sustaining damage).this value is also compared against when a unit is 'deviated' Quote Link to comment Share on other sites More sharing options...
MrFlibble Posted October 11, 2009 Author Share Posted October 11, 2009 Thanks a lot, segra :) So it has to do with the units retreating from danger, eh? I found this particular behavior very annoying when I found out how to activate the attack teams (e.g. when a group of Siege Tanks or even Devastators comes close to your defenses, then the AI decides not to attack, all the while those units get beaten by Missile Turrets' fire).also just noticed (not sure if we've discussed this before?) but the weakness value in the housedata, when the unit is trooper/infantry is the chance of a unit retreating (when sustaining damage).this value is also compared against when a unit is 'deviated'Hm, I know single soldiers and Troopers that emerge when a squad is beaten below 50% hp retreat from their position, and so do soldiers that come out of destroyed buildings. But I did not know it's connected to the weakness value, which defines the susceptibility to deviation. Perhaps it is responsible for more global unit behavior, then?Actually this observation was related to techtree limitations and nothing more. The computer is just as stupid when playing harkonnen, ordos or atreides.Well, I had that impression that the AI behaves differently in each campaign. Maybe it really has something to do with each House's AI settings, and maybe it's just me :)BTW, I think the AI could be made more dangerous if the "threat value" for turrets was increased (currently it's ridiculously low). For example, in Starcraft, the AI always goes for defenses first, and then proceeds to finish off the rest of the base.Here's a threat rating comparison table for reference:[pre]Structure Cost HP Threat valueConst Yard 400 400 300Concrete 5 20 5Concrete4 20 20 10Windtrap 300 200 300Refinery 400 450 300Outpost 400 500 275Spice Silos 150 150 150Light Factory 400 350 200Heavy Factory 600 200 600Barracks 300 300 100WOR 400 400 175Wall 50 50 30Turret 125 200 150R-Turret 250 200 75Repair Facility 700 200 600Hi-Tech Factory 500 400 200Starport 500 500 250IX 500 400 100Palace 999 1000 400[/pre] Quote Link to comment Share on other sites More sharing options...
Nyerguds Posted October 11, 2009 Share Posted October 11, 2009 it's odd how the normal turret has a higher rating than the rocket turret... maybe to balance out the fact they prefer attacking targets that are attacking them, which would lead them to the rocket turret sooner? Quote Link to comment Share on other sites More sharing options...
MrFlibble Posted October 12, 2009 Author Share Posted October 12, 2009 I think the developers might have done that on purpose, making the AI's units concentrate on critical structures of the players base. The thing is, the turrets can be really devastating to an enemy army if ignored, and the Heavy Factory and Repair Facility aren't really the most critical structures at all.I'd suggest the following order of priority: R-Turrets -> Turrets -> Refineries -> (Const. Yard ->) Heavy Factory, Starport -> Light Factory -> everything elsePerhaps with some modifications, but that would surely be more effective, because on later levels, the AI amasses teams of units large enough to take out at least some of the turrets the player may position around the base. Besides, turrets are more vulnerable in the sense that most of them are in the base's perimeter, while the Heavy Factory and other structures of default priority are behind the defensive lines, and therefore more difficult to get to. Same with Refineries, which tend to be positioned close to the rock edge, i.e. outside the base defenses. Another thing worth trying is making a higher priority for Harvesters.If changing priority levels works, this would mean that the AI in Dune II is customizable to a great degree, as orders of attack could be planned in detail (e.g. after destroying the turrets, the AI may attempt to destroy the Outpost to prevent the player from immediately rebuilding the defenses, and so on). Quote Link to comment Share on other sites More sharing options...
Nyerguds Posted October 12, 2009 Share Posted October 12, 2009 The AI doesn't work that way. They do raids against weak but expensive/important buildings while ignoring the defenses. I've often had enemy raids that succeeded in destroying my heavy factory or repair facility. It's a really effective tactic for sabotaging a player. Quote Link to comment Share on other sites More sharing options...
MrFlibble Posted October 13, 2009 Author Share Posted October 13, 2009 The AI doesn't work that way. They do raids against weak but expensive/important buildings while ignoring the defenses.Isn't that because those "weak but expensive" structures have the highest priority rating (600 for both Repair Facility and Heavy Factory)? If the threat value of other structures is changed, the AI will target the structures we want it to.I've often had enemy raids that succeeded in destroying my heavy factory or repair facility. It's a really effective tactic for sabotaging a player.Well, it's actually a pretty lame tactic. First, if the AI ignores the defenses, chances are high that none of the units will reach the target structure intact. The turrets will continue to fire upon the enemy units that are already attacking their target too. Secondly, the Heavy Factory and the Repair Facility are, although important, not the critical structures after all. A Heavy Factory can be replaced fairly easily if spice production and the construction facility are intact. Also, the AI's Launchers have a greater chance of getting within range of the player's turrets if they go for the Heavy Factory or Repair Facility first.My point is that such a strategy results in little more than the player having to occasionally rebuild his Heavy Factory or Repair Facility. If the AI attacked the turrets first, the chance of success (i.e. destroying a turret) would be greater because the turrets are usually positioned around the base and not inside, so it's easier to approach them. Besides, Launchers and Sonic Tanks can out-range turrets, thus actually making full advantage of their long-range attack. After the turrets, the reasonable targets would be either Refineries or Construction Yards, which are far more important than any factory, even though they're also more difficult to knock out. That should cause a lot more trouble to the player. Quote Link to comment Share on other sites More sharing options...
Nyerguds Posted October 13, 2009 Share Posted October 13, 2009 Heavy Factory is a bitch to replace. You lose tons of money on upgrades every time. Quote Link to comment Share on other sites More sharing options...
MrFlibble Posted October 14, 2009 Author Share Posted October 14, 2009 I'm not denying that, but 1) it's still not a huge problem if your spice production is well established (with a considerable cache of credits it's only a matter of time; plus, if you have a Starport, the Heavy Factory is used mostly to produce House special tanks, which require no upgrades) and 2) ignoring the turrets is generally a very bad idea for all the reasons I listed above. If the AI concentrates on destroying the turrets, its chances of success will increase to some extent. And even if it doesn't go further than destroying a couple of turrets, it still remains a factor in harassing the player.BTW, I think I know why the turrets have such a low threat rating. They do not count in the win/lose conditions, meaning that if you have no structures left but turrets, you still lose. So the developers probably thought the AI shouldn't bother messing with turrets and destroy all the critical structures as quickly as possible to defeat the player. The problem is that the turrets usually make sure the AI's units never get the chance to inflict any considerable damage to the player's base. Quote Link to comment Share on other sites More sharing options...
Nyerguds Posted October 14, 2009 Share Posted October 14, 2009 I hope your changes won't mean the AI will systematically kill all my R-turrets with 'thopters though... they're the only good defense against those things. Quote Link to comment Share on other sites More sharing options...
Will Posted October 15, 2009 Share Posted October 15, 2009 I hope your changes won't mean the AI will systematically kill all my R-turrets with 'thopters though... they're the only good defense against those things.Good point. In my campaign I avoid giving too many AI opponents Hi-Tech factories, or they swarm you. If they also attack your rocket turrets, it will be impossible to destroy them with a cluster of turrets. You'll have to really space them out, because the turret will shoot at the approaching 'thopter, miss, then SLOWLY turn while the 'thopter flies over it, never getting a chance to shoot again. Ouch. Quote Link to comment Share on other sites More sharing options...
Daelin Posted October 16, 2009 Share Posted October 16, 2009 I hope your changes won't mean the AI will systematically kill all my R-turrets with 'thopters though... they're the only good defense against those things.Actually they will.... both your ornithopters and the opponent's go for the turrets. Quote Link to comment Share on other sites More sharing options...
MrFlibble Posted October 17, 2009 Author Share Posted October 17, 2009 The 'thopters attack turrets, but alone they are not enough to destroy them (unless you forget to repair the turrets in time, that is). besides, I think a turret has a bit better chance of hitting a 'thopter when it's flying straight into it to deliver its missile. I haven't had any specific trouble with 'thopters during tests yet (at least, nothing was more complicated compared to the original Dune II).However, AI's ground assaults have become way more effective (and troublesome for the player ;)) Quote Link to comment Share on other sites More sharing options...
segra Posted October 18, 2009 Share Posted October 18, 2009 I'm not sure, but the way the AI picks its targets seems to depend in part on their position on the map, like in Command & Conquer does.It depends on -which- units you're talking about, units loaded from scen.ini are set with 0x200 at the start which prevents the 'team' scripts from using them, any units which are delivered during the game are set like this as well (starport delivery, carryalls, harvesters)but for any units constructed, the use of the team scripts is controlled from the scenario files[TEAMS]1=Ordos,Kamikaze,Foot,4,65=Harkonnen,Normal,Foot,3,5numbers on the end represent minimum (target minimum anyway) and max number of units to use in this 'team', and the Kamikaze/Normal represent the script to use inside team.emcfrom the team script disassembly, Execute sub_2503A... cut compared number of units in team to 0 ...Execute FindUnitForTeam Execute scriptObjectTargetGet PushOp 0Negate 0IfNotGoto l30Execute sub_2533D l30:Execute Actionstart these are fairly accurate descriptions of what these functions do:sub_2503A: Search through all units in this 'team' and find a rendezvous point (averages out the units x/y points) for the team.FindUnitForTeam: Search and find units which have no team script, and no state 0x200, are not saboteurs and the movement type matches the movement type defined in the scen.ini. add them to the teamscriptObjectTargetGet: Get the 'team' target, if it doesnt have one, call sub_2533Dsub_2533D: Loop through all units which are in this 'team' and find a target, there is some harcoding here, where 'team kamikaze' attempts to target a structure first, whereas the others target units first. this 'team' target is updated after each pass until a target is found which matches the previous target, or all units are looped(essentially this finds the best target for the team)Actionstart: if dont have a 'team' target do guard. if there is a target compare the distance to the units weapon distance, and either start the unit script (units.emc) again with the move action or the attack action Quote Link to comment Share on other sites More sharing options...
Nyerguds Posted October 19, 2009 Share Posted October 19, 2009 hm... I've seen similar stuff in RA1's rules. All commands have a setting "Recruitable", meaning that the command given to a unit determines if it can be put inside a team. For example, units set on the map as Guard could be recruited, but units on Area Guard couldn't. Quote Link to comment Share on other sites More sharing options...
MrFlibble Posted October 19, 2009 Author Share Posted October 19, 2009 Whew, after some screw-ups I managed to successfully move this branch of discussion to the DUNE2.EXE Editing Thread. I hope you people don't mind this - I did it so that people interested in Dune II modding can follow the discussion regarding different aspects of it more easily. Now back on topic ;)Wow segra, thanks for such a detailed explanation of the AI team behavior :)there is some harcoding here, where 'team kamikaze' attempts to target a structure first, whereas the others target units first. this 'team' target is updated after each pass until a target is found which matches the previous target, or all units are looped(essentially this finds the best target for the team)That's a very valuable addition to the Dune II knowledge base. I thought Normal and Kamikaze teams are different in that the former can retreat, while the latter can't. BTW, do you know that there are two other team types that are never used in the game scenarios: Staging and Flee. I've tried testing them a while ago, with some mixed results (check it out here). Would be nice to know how those function, too :)hm... I've seen similar stuff in RA1's rules. All commands have a setting "Recruitable", meaning that the command given to a unit determines if it can be put inside a team. For example, units set on the map as Guard could be recruited, but units on Area Guard couldn't.Maybe there's such a feature in Dune II too? This can be checked with your editor :) Quote Link to comment Share on other sites More sharing options...
Nyerguds Posted October 19, 2009 Share Posted October 19, 2009 The commands sure don't seem to have something like that. Everything except for the weird increasing number at the start has been identified. And as Segra said, it seems to depend on how they arrive on the battlefield. Quote Link to comment Share on other sites More sharing options...
MrFlibble Posted October 20, 2009 Author Share Posted October 20, 2009 And as Segra said, it seems to depend on how they arrive on the battlefield.Most pre-placed AI-controlled units on the map have either the Area Guard or Ambush command, and none are set on Guard so I thought it could have been like in Red Alert. Quote Link to comment Share on other sites More sharing options...
Skrilax_CZ Posted October 20, 2009 Share Posted October 20, 2009 Ad the Turrets priority:Well when there are ornithopters in the game you also put some R-Turrents around the base including the opposite direction than the AI units arrive. Therefore if your front turrets are killed and at the moment you got only some in back the units will hunt them down prior and get killed (and the defensive launchers in the back will do more damage to the base cause of thier aimless on close targets :P ) Quote Link to comment Share on other sites More sharing options...
Nyerguds Posted October 20, 2009 Share Posted October 20, 2009 Most pre-placed AI-controlled units on the map have either the Area Guard or Ambush command, and none are set on Guard so I thought it could have been like in Red Alert.Segra literally said that all units loaded from the scenario were given a status value that prevents adding them to teams. If it was related to the commands he would've said so.units loaded from scen.ini are set with 0x200 at the start which prevents the 'team' scripts from using them Quote Link to comment Share on other sites More sharing options...
MrFlibble Posted October 21, 2009 Author Share Posted October 21, 2009 Come on give me a break :) I'm not that well versed in coding to grasp such ideas quickly :P Quote Link to comment Share on other sites More sharing options...
Skrilax_CZ Posted October 22, 2009 Share Posted October 22, 2009 Is it possible to adjust to total unit/building limit in the dune2.exe? I get annoyed by this in 8 and 9 th mission (both unit and building, until I smash one opponent down). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.