RE: When? (Full Version)

All Forums >> [New Releases from Matrix Games] >> World in Flames



Message


Joseignacio -> RE: When? (11/17/2009 7:09:00 AM)

http://www.priceminister.es/offer/buy/49646705/Commander-s-Tactical-Handbook-Libro.html

http://www.priceminister.es/offer/buy/49702463/Leading-Marines-Libro.html

http://www.priceminister.es/offer/buy/49726262/Warfighting-Libro.html

but there are some much older:

http://www.clausewitz.com/readings/Principles/

http://www.icollector.com/Military-Tactics-Book-1861-40-Illustrations-_i8702773

http://en.wikipedia.org/wiki/The_Book_of_Five_Rings

http://en.wikipedia.org/wiki/The_Art_of_War

are the first tactics and strategy books that come to my head. Maybe you can get some hints...[8|]




Sarge -> RE: When? (11/17/2009 12:53:07 PM)

Well some of us actually have practical real experience in the field, some play video games and read Art Of War and think they have some insight.

My advice is move on straw man you'll get your AI when its done try to relax its just a game ...........[>:]





DCWhitworth -> RE: When? (11/17/2009 1:02:36 PM)

quote:

ORIGINAL: Sarge
Well some of us actually have practical real experience in the field, some play video games and read Art Of War and think they have some insight.

My advice is move on straw man you'll get your AI when its done try to relax its just a game ...........[>:]


Granted there is no substitute for practical experience but there are other ways to acquire knowledge on the subject.




Sarge -> RE: When? (11/17/2009 1:11:35 PM)


quote:

ORIGINAL: DCWhitworth
Granted there is no substitute for practical experience but there are other ways to acquire knowledge on the subject.


Don’t let straw man above confuse my original point....[;)]


quote:

ORIGINAL: Sarge

lol

For thousands of years military collages from every conceivable civilization armed with immeasurable accumulative knowledge have utterly failed in producing a simplistic AI temp plate : if this happens do this!

So …………what’s the hold up ?





DCWhitworth -> RE: When? (11/17/2009 1:24:10 PM)

quote:

ORIGINAL: Sarge
lol

For thousands of years military collages from every conceivable civilization armed with immeasurable accumulative knowledge have utterly failed in producing a simplistic AI temp plate : if this happens do this!

So …………what’s the hold up ?


I think the issue is that real life is an immeasurably boundless and complex thing wheras computer programs have relatively limited horizons and certainly can't *think* outside the box. A further issue is that computers do not think like humans so trying to get them to behave like them is doubly hard.

But actually you'd hit similar issues if you gave a list of written instructions/advice to a human who applied them literally and without initiative.




Joseignacio -> RE: When? (11/17/2009 1:30:21 PM)

First, I have been a soldier, reaching the graduation of Cabo Primero, don't know the translation but it would be like "first class corporal", the higher level in our army under sargent, however, I have not been professional, that I must admit.

Anyway, that has nothing to do with what we are writing about. I think that most of the generals who were the High Commands in the II WW had probably never been in a real front.

This is a simulation, and we are armchair generals, maybe any of us could be as good as Montgomery, Auchinleck or Rommel, but most wont. If the books were good to learn tactics and strategy for romans (Cursus Honorum included them if I am not wrong) ,

http://en.wikipedia.org/wiki/Cursus_honorum
http://en.wikipedia.org/wiki/Tribune#Roman_military_officers

cartaginese and chinese officers among others, I think they must be valuabe no matter that, as Moltke said "No plan of operations extends with certainty beyond the first encounter with the enemy's main strength (no plan survives contact with the enemy).",

http://en.wikipedia.org/wiki/Helmuth_von_Moltke_the_Elder

the course of action has to be decided before, and the better the planification, the possible alternatives coverture and setting of reserves and retreat coverture measures, the better the result will be if something results wrong.

Surely you don-t believe, Alexander, Hannibal, Julius Caesar, ..., just imagined their tactics or lost enough legions till they learnt that it was not good to cross a river and leave it behind in the presence of the enemy. They were taught, with senior officers or their writings in books.

Hey guys, Steve doesn't like to mix everything up in this thread, I will copy paste all this in a new one and we can leave this for the "When?" matter, Ok?




mavraamides -> RE: When? (11/17/2009 8:25:37 PM)


quote:

ORIGINAL: Sarge


For thousands of years military collages from every conceivable civilization armed with immeasurable accumulative knowledge have utterly failed in producing a simplistic AI temp plate : if this happens do this!

So …………what’s the hold up ?




The problem with that sort of simple template is you would need too many rules to be practical. Even for a simple game like chess you would be talking about appx 10^40 rules for a 40 move game.

In the case of WIF, you could multiply that by at least 1,000,000. That's why some sort of hierarchical generalization is needed. Or a learning engine that can observe / play 1,000's of games and infer generalized rules.

Humans have an innate ability to recognize patterns of play or positions and generalize rules that can then be applied to them. Taking chess again for example, you may have:

1) If my opponent neglected his king's safety, launch an attack against the king side.
2) If I am ahead in pawns, trade off pieces and head to an end game.
3) If under attack on the wing, launch a counter attack in the center
...
etc.

We can take these generalized rules, recognize the patterns as they evolve from a game, and use them to narrow our move choices. This is the idea of heuristics (guided search) first introduced by the great genius Alan Turing. Perhaps if he hadn't taken his own life at the tender age of 42, AI would be years ahead of where it is now.

People who have never written an AI tend to vastly underestimate just how much thinking is going on behind the scenes by a human mind in making even the simplest tactical decision. Nothing will make you appreciate the power of your mind like trying to write a program that mimics it!




winky51 -> RE: When? (11/17/2009 10:47:35 PM)


quote:

People who have never written an AI tend to vastly underestimate just how much thinking is going on behind the scenes by a human mind in making even the simplest tactical decision. Nothing will make you appreciate the power of your mind like trying to write a program that mimics it!


I have written AI and yes its way more complicated than people think.

Computers have linear memory in directions forward and back.

humans have dynamic memory where 1 cell can attach to numerous cells forming synapses. Way more complicated.

I made my own AI space game a long time ago (pascal) and it works. I also write AI for my scenarios for SC2. Its no easy task.




Sarge -> RE: When? (11/18/2009 12:33:45 AM)


quote:

ORIGINAL: Joseignacio
Hey guys, Steve doesn't like to mix everything up in this thread, I will copy paste all this in a new one and we can leave this for the "When?" matter, Ok?



Agreed ,
I’m certain if Matrix is stating the release will have AI then I have no reason to be suspect .


I don’t venture down to the WIF forum often so I my be guilty of missing Matrix statements on the contrary ?.




Kham -> RE: When? (11/18/2009 8:12:23 PM)

No statements to the contrary.

It's just gonna take time and its hard on the patience - especially if you apply a realistic expectation of how good it can become :)




Triboga -> RE: When? (11/18/2009 10:42:29 PM)

But, finally, with or without high AI, have any new release date?




wworld7 -> RE: When? (11/18/2009 11:27:23 PM)


quote:

ORIGINAL: Triboga

But, finally, with or without high AI, have any new release date?


Not yet.

Perhaps with the Dec 1, 2009 update we will hear something.




micheljq -> RE: When? (11/19/2009 1:35:59 PM)

From my personal point of view the dev should never give a release date unless the product is really finished and ready to go to the market. In the industry they give vague answers like Q2. 2010 for example, this way they are not pressured to release an unfinished product.




Joseignacio -> RE: When? (11/19/2009 1:38:21 PM)


quote:

ORIGINAL: micheljq

From my personal point of view the dev should never give a release date unless the product is really finished and ready to go to the market. In the industry they give vague answers like Q2. 2010 for example, this way they are not pressured to release an unfinished product.


I think he made the dates public to have an extra push to meet them, since all the fans would know them.

And I think now he doesn't (by now) because the time to dedicate to the bugs is unpredictable.




micheljq -> RE: When? (11/19/2009 1:44:05 PM)


quote:

ORIGINAL: Joseignacio

I think he made the dates public to have an extra push to meet them, since all the fans would know them.

And I think now he doesn't (by now) because the time to dedicate to the bugs is unpredictable.


I agree with that, but I mean there is unpredictable bugs happening in the development of all PC games anyway. So they never know when the product will be finished until it is. It is like that in all the industry, MWiF is not an exception. [:)]




SamuraiProgrmmr -> RE: When? (11/19/2009 2:36:23 PM)


quote:

ORIGINAL: micheljq

From my personal point of view the dev should never give a release date unless the product is really finished and ready to go to the market. In the industry they give vague answers like Q2. 2010 for example, this way they are not pressured to release an unfinished product.



I would just like to say that we (as a group) have been granted more transparency into this project than any other computer game project in history (correct me if I am wrong).

The benefits of that transparency are of immense value. Experienced players of the game have had the chance to influence decisions. Inexperienced players of the game have had a chance to point out the pieces that needed more explaination or information on screens. This has, IMO, made this a much better product.

So what if we were given a PROJECTED date (or dates) that were not met.

What is more disappointing... a missed target date or an inferior product?

To Reiterate : Matrix Games NEVER said "This is going gold on xx/xx/xxxx".

We were given the privilege of seeing behind the scenes as this was built.

Please don't make them regret that. I wish more companies would adopt this transparency.






micheljq -> RE: When? (11/19/2009 2:50:19 PM)

Transparency does not mean they are obliged to give an early exact release date, anyway they will do what they feel is better to do.

That's being too much of a nice guy, I personally think.




Caquineur -> RE: When? (11/19/2009 2:58:31 PM)

quote:

ORIGINAL: SamuraiProgrammer
quote:

ORIGINAL: micheljq
From my personal point of view the dev should never give a release date unless the product is really finished and ready to go to the market. In the industry they give vague answers like Q2. 2010 for example, this way they are not pressured to release an unfinished product.

I would just like to say that we (as a group) have been granted more transparency into this project than any other computer game project in history (correct me if I am wrong).

The benefits of that transparency are of immense value. Experienced players of the game have had the chance to influence decisions. Inexperienced players of the game have had a chance to point out the pieces that needed more explaination or information on screens. This has, IMO, made this a much better product.

So what if we were given a PROJECTED date (or dates) that were not met.

What is more disappointing... a missed target date or an inferior product?

To Reiterate : Matrix Games NEVER said "This is going gold on xx/xx/xxxx".

We were given the privilege of seeing behind the scenes as this was built.

Please don't make them regret that. I wish more companies would adopt this transparency.


SamuraiProgrammer, I agree 99,99% with what you just said.
The 0,01% missing is about the part I put in bold. In fact, in at least one monthly report, Steve said :

quote:

ORIGINAL: Shannon V. OKeets
April 1, 2009 Status Report for Matrix Games’ MWIF Forum

Accomplishments of March

Project Management
Firm release date for MWIF product 1 is July 27th, 2009.


But it's, IMO, a minor point, as I totally agree with the fact that a superior product is better than a "not-missed" target date, at least in the case of MWiF.

Alain




Triboga -> RE: When? (11/19/2009 3:36:17 PM)

To be honest I prefer have a released date, but doesn’t care if finally didn’t arrive to it. Is just another milestone to know where the game’s development is. Personally, I appreciate this effort, and the fact of give a date and try to reach it.

Playing board game is easy to notice how many variables you have to be aware, and (as far as I know I’m not developer[:'(]) can’t imagine how many of them must be in a “decision tree” of this kind of game. But in my opinion (well is a fouled opinion of a person who wants to boost the game release [:D]), even with the best AI, this kind of game is not the kind of you enjoy playing against a evil machine, it’s a huge approach of WWII and –always for me- is an approach which need the human factor, we’re not talking about a battle or even a WWII game designed for PC, thought it was not a game developed for PC but for board game




bo -> RE: When? (11/20/2009 12:08:47 AM)


quote:

ORIGINAL: micheljq


quote:

ORIGINAL: Joseignacio

I think he made the dates public to have an extra push to meet them, since all the fans would know them.

And I think now he doesn't (by now) because the time to dedicate to the bugs is unpredictable.

Mich I have always respected yours and Joses opinions, always, but this bug thing annoys me to no end, if the code is written right in the first place why is there so many so called bugs, I trully dont get it. I have not posted because I will end up saying the wrong thing but I do read the posts every 2 weeks or so.

BO
I agree with that, but I mean there is unpredictable bugs happening in the development of all PC games anyway. So they never know when the product will be finished until it is. It is like that in all the industry, MWiF is not an exception. [:)]





Shannon V. OKeets -> RE: When? (11/20/2009 2:31:36 AM)


quote:

ORIGINAL: bo


quote:

ORIGINAL: micheljq


quote:

ORIGINAL: Joseignacio

I think he made the dates public to have an extra push to meet them, since all the fans would know them.

And I think now he doesn't (by now) because the time to dedicate to the bugs is unpredictable.

Mich I have always respected yours and Joses opinions, always, but this bug thing annoys me to no end, if the code is written right in the first place why is there so many so called bugs, I trully dont get it. I have not posted because I will end up saying the wrong thing but I do read the posts every 2 weeks or so.

BO
I agree with that, but I mean there is unpredictable bugs happening in the development of all PC games anyway. So they never know when the product will be finished until it is. It is like that in all the industry, MWiF is not an exception. [:)]



"... the code is written right in the first place ..." made me chuckle.[:D]

You might examine the '2' sentences you wrote for spelling and grammar mistakes. And then think about writing 300,000 sentences where zero mistakes are permitted. Indeed, simply count to 300,000 while pondering the elusiveness of perfection in all things human.[;)]




TemKarl -> RE: When? (11/20/2009 5:31:18 AM)

".. the code is written right in the first place ..."

Of course ... is there any other way??




wworld7 -> RE: When? (11/20/2009 6:23:06 AM)


quote:

ORIGINAL: Shannon V. OKeets

And then think about writing 300,000 sentences where zero mistakes are permitted. Indeed, simply count to 300,000 while pondering the elusiveness of perfection in all things human.[;)]


Is this a job:

For Superman...no
For Batman.......no
For an Irishman........HELL YES!!!




BallyJ -> RE: When? (11/20/2009 10:49:42 AM)

Just have to say:
1. Love this game. Played it long time!!
2. Love this forum. Read it every day!!!
Don't agree with every decision that has been made, but willing to live with itTry in vain to once again past a smiley???
[image][/image][image][/image]???????
Keep up the good work.[:)]
Finally got it right???




bo -> RE: When? (11/20/2009 4:00:45 PM)


quote:

ORIGINAL: Shannon V. OKeets


quote:

ORIGINAL: bo


quote:

ORIGINAL: micheljq


quote:

ORIGINAL: Joseignacio

I think he made the dates public to have an extra push to meet them, since all the fans would know them.

And I think now he doesn't (by now) because the time to dedicate to the bugs is unpredictable.

Mich I have always respected yours and Joses opinions, always, but this bug thing annoys me to no end, if the code is written right in the first place why is there so many so called bugs, I trully dont get it. I have not posted because I will end up saying the wrong thing but I do read the posts every 2 weeks or so.

BO
I agree with that, but I mean there is unpredictable bugs happening in the development of all PC games anyway. So they never know when the product will be finished until it is. It is like that in all the industry, MWiF is not an exception. [:)]



"... the code is written right in the first place ..." made me chuckle.[:D]

You might examine the '2' sentences you wrote for spelling and grammar mistakes. And then think about writing 300,000 sentences where zero mistakes are permitted. Indeed, simply count to 300,000 while pondering the elusiveness of perfection in all things human.[;)]

Mistakes where, I dont understand about bugs, I am not a programmer, but if you are a trained programmer with a lot of experience at programming why isnt the code written right in the first place I am not being smart just inquisitive after reading some of the posts since last month, I mean wouldnt it save you a lot of trouble then having to go back over it time and time again which has delayed this endeavour for years not months, I know [meaning me] go back where you came from, how dare you challenge the powers that be.[:-] I hope you posters have other lives then just hanging around her for a couple more years of frustration[&:]


Bo




bo -> RE: When? (11/20/2009 4:02:45 PM)


quote:

ORIGINAL: flipperwasirish


quote:

ORIGINAL: Shannon V. OKeets

And then think about writing 300,000 sentences where zero mistakes are permitted. Indeed, simply count to 300,000 while pondering the elusiveness of perfection in all things human.[;)]


Is this a job:

For Superman...no
For Batman.......no
For an Irishman........HELL YES!!!


Yeah if he can stay sober[:D]

Bo




SamuraiProgrmmr -> RE: When? (11/20/2009 4:05:11 PM)


quote:

ORIGINAL: Shannon V. OKeets

You might examine the '2' sentences you wrote for spelling and grammar mistakes. And then think about writing 300,000 sentences where zero mistakes are permitted. Indeed, simply count to 300,000 while pondering the elusiveness of perfection in all things human.[;)]


HEAR HEAR!!!!!!




SamuraiProgrmmr -> RE: When? (11/20/2009 4:57:46 PM)


quote:

ORIGINAL: bo

Mistakes where, I dont understand about bugs, I am not a programmer, but if you are a trained programmer with a lot of experience at programming why isnt the code written right in the first place



Bo,

None of this is directed at you in a bad way. You asked a question in good faith and deserve an answer. The problem is that for the people who are capable of delivery of an answer backed by experience, this top is inflammatory.

I am not trying to be too sarcastic or mean. Please do not be offended. Part of this is intended to be humorous. This is, however, a subject near and dear to my heart.



Consider a program that takes two numbers as input and outputs the average of those two numbers.

Things that must be considered....(for code to be written right)

1) The mathematical relationship between the 3 numbers
2) The visual display of each number (how many decimal places, font size, negative values, etc.)
3) The data entry of the two numbers (how do you handle when someone puts a letter in when it should be a number, etc.)
4) When does the math get done (do you do it immediately when a number changes, do you give them a button to control the execution, etc.)
5) Are there special circumstances that will affect any of the decisions that you have already made? (Do we need to be able to cut and paste info from another program, do we need to link behind the scenes to another program, etc.)
6) Who will use the program and what is their level of expertise? (Is it for accountants or is it for 3rd graders to check their homework, etc.) How will that affect #2

I could go on... and admittedly this is a bit of overkill, but you would be surprised at how each of those items can be a failure point.

Now multiply the situation by Thousands of variables and Thousands of operations.
Now multiply the situation by Mulitple methods of display that are often graphical.

Very quickly the problem is large enough that it makes sense to modularize it.

Now the trick becomes to keep these millions (yes millions - do the math) of relationships in your mind so that when you change one thing, you make sure that everything else that it affects is changed if needed.

Trust me on this one... HOPE THE PHONE DOESN'T RING AT EXACTLY THE WRONG MOMENT.. you will 'drop' the cloud of quickie tasks floating in your head and likely not pick them all back up when you resume.

NOW

Consider the idea that many of these tasks are complicated. They are not simple averages of two numbers. They are events that must gather data from multiple locations and perform dozens of steps to be accomplished.

NOW consider this analogy....


When was the last time that you got lost driving somewhere you have never been before. Consider that - Really.

You had a map. You studied it ahead of time. You consulted Mapquest. You followed the path as good as you could, but you just couldn't find the spot.

Oh, you got there eventually - maybe even quickly ... but DID YOU DO IT CORRECTLY THE VERY FIRST TIME?

And then, what if when you did not drive directly to the destination, it had the potential to disrupt any other trips that you are about to take OR have taken previously.

Furthermore, if you suspect that a previously taken route may have been affected, now you have to retrace it EXACTLY and alter it if needed.

Meanwhile.... you are being paid based on how many trips you make.

Meanwhile... everyone believes they are the best navigator in the world and consider you a failure if you choose (for reasons they may have never considered) a path that they would not have chosen.

And it has to work even if the streets have potholes (bad drivers, hardware problems, etc.)

And it needs to work for cities where the speed limit is low (old machines)

And it needs to work well enough that at the end of the day, people feel that it *almost* made as good of choices as they would have (i.e. the AI needs to be a challenge but can be beat - otherwise everyone will accuse it of being stupid or cheating)


SUMMARY

Writing large computer programs is a very challenging task that involves keeping up with huge amounts of detail and tying ALL of the loose ends together in a nice package.

POST SCRIPT

Even though there are theorists and university types that will sing the praises of TOP DOWN STRUCTURED PROGRAMMING or OBJECT ORIENTED PROGRAMMING as if they are the second coming and will prevent any systemic and endemic problems from occurring...

Experience has shown that they are full of $#|T

This rant has not been directed at anyone in general.

I feel better.

Thanks for enduring it.





Shannon V. OKeets -> RE: When? (11/20/2009 6:43:41 PM)


quote:

ORIGINAL: bo


quote:

ORIGINAL: Shannon V. OKeets


quote:

ORIGINAL: bo


quote:

ORIGINAL: micheljq


quote:

ORIGINAL: Joseignacio

I think he made the dates public to have an extra push to meet them, since all the fans would know them.

And I think now he doesn't (by now) because the time to dedicate to the bugs is unpredictable.

Mich I have always respected yours and Joses opinions, always, but this bug thing annoys me to no end, if the code is written right in the first place why is there so many so called bugs, I trully dont get it. I have not posted because I will end up saying the wrong thing but I do read the posts every 2 weeks or so.

BO
I agree with that, but I mean there is unpredictable bugs happening in the development of all PC games anyway. So they never know when the product will be finished until it is. It is like that in all the industry, MWiF is not an exception. [:)]



"... the code is written right in the first place ..." made me chuckle.[:D]

You might examine the '2' sentences you wrote for spelling and grammar mistakes. And then think about writing 300,000 sentences where zero mistakes are permitted. Indeed, simply count to 300,000 while pondering the elusiveness of perfection in all things human.[;)]

Mistakes where, I dont understand about bugs, I am not a programmer, but if you are a trained programmer with a lot of experience at programming why isnt the code written right in the first place I am not being smart just inquisitive after reading some of the posts since last month, I mean wouldnt it save you a lot of trouble then having to go back over it time and time again which has delayed this endeavour for years not months, I know [meaning me] go back where you came from, how dare you challenge the powers that be.[:-] I hope you posters have other lives then just hanging around her for a couple more years of frustration[&:]


Bo

Bo,

Here is an example of the world I work in every day. This is a little over 500 lines of code that determine the odds column for a land combat. It does not roll the die/dice, nor does it "look up" the result within the column once the die/dice is/are rolled. I have revised this code quite a lot over the past 2-3 months to maintain fractions during its calculations and leave the decision about whether to use rounded numbers or not to the calling/external routines. Notice all the reference to optional rules, in particular, the dual logic paths for 1D10 and 2D10. There are 12 parameters for this routine which have to be set prior to its execution, and the routine is called from 26 different places in the code. Just setting the parameters correctly for this one routine offers 312 opportunites for typos. Any changes to the routine requires examining the 26 places this routine is called, to make sure the changes for one of them does not cause problems for any of the others.

By the way, while most of the MWIF is written using "object oriented" code, this is a stand-alone routine and merely "grouped with" the object Land_Combat_Hex.
===
// ****************************************************************************
function LandCombatColumn(
  const IsAssault: Boolean; // Set to False for testing overruns.
        A, D: Extended;     // A = Attack & D = Defend factors are input.
	out DRMRounded: Integer;  // Returned die roll modifier for 2D10.
  out DRM: Extended;        // Same as DRMRounded, but not rounded.
  const ColMod: Extended;   // Shifts due to Fractional Odds and 1D10 HQ support.
  out TableCol: Byte;       // Returned value for 1D10: between 0 and 9.
  const Hex: TSmallPoint;   // Used to find TLandCombatHex.
        AUseSnowUnits, DUseSnowUnits: Boolean;
  const FractionBonus: Boolean;
  const ForceInvading: Boolean = False): Boolean;
// ****************************************************************************
// LandCombatColumn does not roll dice to determine the odds.  The aspects of
// land combat resolution that require die rolls to determine odds are performed
// prior to the call to LandCombatColumn.  These are for 1D10 HQ Support and
// fractional odds.  These are the input parameters ColMod and FractionBonus.
// ****************************************************************************
var
	CRatio: Extended;
  Inverse: Integer;
	AnyInvading: Boolean;
	Index: Longint;
  CR: TLandCombatHex;
	Counter: Integer;
  WorkCol: Integer;
	ColShifts: Integer;
  IsCombatHex: Boolean;
  LCTerrain: TTerrainTypes;
  LCWeather: TWeatherTypes;
  InCity: Boolean;
  AttackingStack: TUnitStack;
  DefendingStack: TUnitStack;
  AHasArmor: Boolean;
  CityDRM: Extended;

  procedure GetHQBonus;
  begin     // If there is HQ Support, it is automatic when using the 2D10 CRT.
    if OptRules.TwoD10LandCRT and IsCombatHex then
    begin   // HQ's provide half their Reorganization value as a modifier.
      if CR.HQA <> nil then DRM := DRM + (CR.HQA.Reorg / 2);

      if CR.HQD <> nil then DRM := DRM - (CR.HQD.Reorg / 2);
    end;
  end;

  procedure AddAttacker(var U: TUnit);
  begin
    if U.Side = Game.PhasingSide then AttackingStack.Add(U);
  end;

  procedure DoubleAntiTankUnits(var U: TUnit);
  begin     // Defending units only.
    if U.UnitType in AntiTankSet then D := D + TLandUnit(U).CurrDefenseArmor;
  end;

  procedure DoubleRedAntiTankUnits(var U: TUnit);
  begin     // Attacking units only.
    if (U.UnitType in AntiTankSet) and (TLandUnit(U).AntiTank = latAttDef) then
       A := A + TLandUnit(U).CurrAttackArmor;
  end;

  function AttackModifier(const U: TUnit): Integer;
  var      // Calculate the die roll modifier.
    AttackHex: TSmallPoint;
  begin
    AttackHex := AttackLocation(U);
// ****************************************************************************
// Set the attack modifier (divisor) from AttackHex through Hexside.  This
// accounts for straits, all-sea hexsides, alpine hexsides, and forts
// (cumulative).  A result of 0 means no attack is possible.  Invasions never
// have any modifier (i.e., the divisor is 1).
// ****************************************************************************
    if Map.Terrain[AttackHex.X, AttackHex.Y] = teSea then Result := 1
    else Result := TLandUnit(U).HexsideAttackModifier(AttackHex,
                   THexArea.ConnectingHexsideRange(AttackHex, Hex), True);
  end;

  procedure AttackingUnitsDRM(var U: TUnit);
// ****************************************************************************
// Only used by 2D10 CRT & BlitzBonus.  Modify DRM due to individual attacking
// units.
// ****************************************************************************
  var
    HS: THexsideRange;
    HSAM: Integer;
    AttackHex: TSmallPoint;
  begin
    AttackHex := AttackLocation(U); // Hex where attacker started.

   	if (U is TLandUnit) and
       (not TLandUnit(U).Invading) and
       (Map.Terrain[AttackHex.X, AttackHex.Y] <> teSea) then
    begin
      THexArea.ConnectingHexsideRange(AttackHex, Hex, HS); // This sets HS.
      HSAM := AttackModifier(U);

      if HSAM > 0 then
      begin
// ****************************************************************************
// Include jungle benefit for some elite marines and infantry.
// ****************************************************************************
        if (LCTerrain = teJungle) and
           TLandUnit(U).Elite and
           ((U.Country = Japan.ID) or
            (U.Country = Australia.ID) or
            ((U.Country = UnitedStates.ID) and
             (U.UnitType in MarineSet))) then
          DRM := DRM + (1 / HSAM);     // Hexside may affect modifier.
// ****************************************************************************
// Include armor bonus for attacker.
// ****************************************************************************
        if (not IsAssault) and
           (U.UnitType in ArmoredSet) and
           (not InCity) and
           (LCTerrain in [teClear, teDesert]) and  // I.e., not jungle.
           (LCWeather = wFine) and                 // Forts negate this bonus.
           (Map.HexsideTerrainSet[U.Column, U.Row, HS] * FortHexsideSet = []) then
        begin                          // Hexside may affect modifier.
          if OptRules.BlitzBonus then
          begin
// ****************************************************************************
// BlitzBonus: Add 1 to the die roll for each two attacking ARM, MECH, HQ-A
// units conducting a blitz attack against a clear or desert (non-city) hex in
// fine weather.
// ****************************************************************************
            if U.Small then DRM := DRM + (0.25 / HSAM) // 1/4 for a division.
            else DRM := DRM + (0.5 / HSAM);            // 2 full corps = 1.
          end
          else
          begin    // 2D10 modifiers is twice that of BlitzBonus.
            if U.Small then DRM := DRM + (0.5 / HSAM)  // Half for a division.
            else DRM := DRM + (1 / HSAM);
          end;
        end;
// ****************************************************************************
// Include bonus for attacking with winterized units.
// ****************************************************************************
        if AUseSnowUnits and TLandUnit(U).SnowUnit then
          DRM := DRM + (1 / HSAM);     // Hexside may affect modifier.
      end;
    end;
// ****************************************************************************
// Include bonus for paradrop.
// ****************************************************************************
    if (U is TLandUnit) and TLandUnit(U).Paradropping then
    begin
      if U.Small then DRM := DRM + 0.5      // Half for a division.
      else DRM := DRM + 1;
    end;
  end;

  procedure DefendingUnitsDRM(var U: TUnit);
// ****************************************************************************
// Used by both 1D10 and 2D10 CRTs.  Modify DRM due to individual defending
// units.
// ****************************************************************************
  var
    LU: TLandUnit;
  begin
   	if U is TLandUnit then
    begin
      LU := TLandUnit(U);
// ****************************************************************************
// Increment die roll for disorganized units.
// ****************************************************************************
      if U.Disrupted then
      begin
        if OptRules.TwoD10LandCRT then
        begin
          if LU.Small then DRM := DRM + 1    // Half for a division.
          else DRM := DRM + 2;
        end
        else DRM := DRM + 1;                 // 1D10 CRT.
      end;
// ****************************************************************************
// Benefit for winterized defenders (TwoD10LandCRT only).
// ****************************************************************************
      if OptRules.TwoD10LandCRT or OptRules.BlitzBonus then
      begin
        if OptRules.TwoD10LandCRT and
           DUseSnowUnits and
           LU.SnowUnit then
          DRM := DRM - 2;
// ****************************************************************************
// Benefit for anti-tank defenders (TwoD10LandCRT only).
// ****************************************************************************
        if OptRules.TwoD10LandCRT and
           AHasArmor and
           (U.UnitType in AntiTankSet) then
          DRM := DRM - 1;
// ****************************************************************************
// Benefit for armored defenders, regardless of CRT chosen.
// ****************************************************************************
        if (U.UnitType in ArmoredSet) and
           (not InCity) and
           (LCTerrain in [teClear, teDesert]) and
           (LCWeather = wFine) then
        begin
          if OptRules.BlitzBonus then
          begin
// ****************************************************************************
// BlitzBonus: Subtract 1 from the die roll for each defending ARM, MECH, HQ-A
// unit in a clear or desert (non-city) hex in fine weather.
// ****************************************************************************
            if U.Small then DRM := DRM - 0.5      // Half for a division.
            else DRM := DRM - 1;
          end
          else
          begin    // OptRules.TwoD10LandCRT.
            if U.Small then DRM := DRM - 1        // Half for a division.
            else DRM := DRM - 2;
          end;
        end;
      end;
    end;
  end;

  procedure CheckEngineerD(var U: TUnit);
  var       // Hexside terrain may double this modifier.
    LU: TLandUnit;
  begin
    LU := TLandUnit(U);

    if LU.UnitType in EngineerSet then
      CityDRM := CityDRM - (LU.Combat * LU.DefenseTerrainModifier);
  end;

  procedure CheckEngineerA(var U: TUnit);
  var       // Hexside terrain may reduce this modifier.
    LU: TLandUnit;
  begin
    LU := TLandUnit(U);

    if LU.UnitType in EngineerSet then
      CityDRM := CityDRM + (LU.Combat / AttackModifier(U));
  end;

  procedure IsHQ(var U: TUnit);
  begin     // Hexside terrain may reduce this modifier.
    if U.UnitType in HeadquartersSet then
      CityDRM := CityDRM + (1 / AttackModifier(U));
  end;

begin
// ****************************************************************************
// LandCombatColumn.
// ****************************************************************************
  AttackingStack := TUnitStack.Create;
  DefendingStack := TUnitStack.Create;

  try
    LCTerrain := Map.Terrain[Hex.X, Hex.Y];     // Attacked hex terrain.
    LCWeather := Map.HexWeather[Hex.X, Hex.Y];  // Attacked hex weather.
    InCity := Map.City[Hex.X, Hex.Y] <> cyNone; // Whether a city is in the hex.
// ****************************************************************************
// Negate the use of snow units if the weather is wrong.
// ****************************************************************************
    if AUseSnowUnits then AUseSnowUnits := LCWeather in SnowWeather;

    if DUseSnowUnits then DUseSnowUnits := LCWeather in SnowWeather;
// ****************************************************************************
// Round off attack and defense strength if not using Fractional Odds.
// ****************************************************************************
    if not OptRules.FractionalOdds then
    begin
      A := Util.Round(A);
      D := Util.Round(D);
    end;
// ****************************************************************************
// See if the hex is already in the list of declared land combat hexes.  If so,
// set the value of CR.  Both IsCombatHex and DRM are used by GetHQBonus.
// ****************************************************************************
    IsCombatHex := LandCombatHexes.Search(Hex, Index, CR); // Sets CR.
    DRM := 0;                                 // Initialized to zero.
// ****************************************************************************
// Check for whether any units are attacking the hex.
// ****************************************************************************
    if (A = 0) and                            // No attack strength.
       ((D > 0) or                            // Some defense strength, or
        ((Game.Phase <> pHQSupportD) and      // not in these 2 phases.
         (not Game.AdvanceSubphase))) then
    begin
      TableCol := 0;
      GetHQBonus;          // If zero attack strength only HQ Support applies .
      Result := False;
      Exit;
    end;
// ****************************************************************************
// Place attacking units in AttackingStack.  CR contains units previously
// committed to the attack - they are not in MovingStack.
// ****************************************************************************
    if IsCombatHex then CR.CombatHexUnits.ForEach(@AddAttacker);

    if (not (Game.Phase in [pHQSupportD, pHQSupportA, pShoreBombardmentD])) and
       ((Game.Phase <> pGroundSupport) or
        ((Game.AirSubPhase = aspFlyA) and
         MovingStack.HasLandUnit)) then
      AttackingStack.AddStack(MovingStack);
// ****************************************************************************
// Set flags based on the armor units attacking & defending, and units invading.
// ****************************************************************************
    AHasArmor := AttackingStack.HasUnit(UFilterArmoredUnit);
    AnyInvading := ForceInvading or AttackingStack.HasUnit(UFilterInvading);
// ****************************************************************************
// Place defending land units in DefendingStack.  Filter removes notional units.
// ****************************************************************************
    DefendingStack.AddStack(MapStacks[Hex.X, Hex.Y], UFilterLandUnitNotInvading);
// ****************************************************************************
// Place defensive ground support (artillery) units in DefendingStack.
// ****************************************************************************
    if (Game.Phase = pGroundSupport) and
       (Game.AirSubPhase = aspFlyD) and
       MovingStack.HasLandUnit then
      DefendingStack.AddStack(MovingStack);
// ****************************************************************************
// Now calculate the Die Roll Modifier (DRM).
// ****************************************************************************
// Loss of attack effectiveness when multiple major powers are attacking.
// ****************************************************************************
    if OptRules.AlliedCombatFriction then
      DRM := DRM - Pred(MajorCountryCount(AttackingStack.MajorPowersInStack));
// ****************************************************************************
// Invasion against a notional unit benefits the attacker.
// ****************************************************************************
    if AnyInvading and
       ((not IsCombatHex) or
        (not CR.IgnoreNotional)) then
      DRM := DRM + 1;
// ****************************************************************************
// -2 for all attacking units being territorials and at least 1 defending unit
// being a non-territoiral land unit.
// ****************************************************************************
    if AttackingStack.HasAllUnit(UFilterTerritorialUnit) and
       DefendingStack.HasLandUnit and
       (DefendingStack.HasUnit(UFilterNotTerritorialUnitDefending)) then
    begin
      if OptRules.TwoD10LandCRT then DRM := DRM - 2
      else DRM := DRM - 1;     // 1D10.
    end;
// ****************************************************************************
// +2 for all defending units being territorials and at least 1 attacking unit
// being a non-territoiral land unit.
// ****************************************************************************
    if DefendingStack.HasAllUnit(UFilterTerritorialUnit) and
       AttackingStack.HasLandUnit and
       (AttackingStack.HasUnit(UFilterNotTerritorialUnitAttacking)) then
    begin
      if OptRules.TwoD10LandCRT then DRM := DRM + 2
      else DRM := DRM + 1;    // 1D10.
    end;
// ****************************************************************************
//
// Final calculations for 2D10 CRT.
//
// ****************************************************************************
    if OptRules.TwoD10LandCRT then
    begin
      if D = 0 then DRM := AutoVictoryModifier // Automatic land combat victory.
      else
      begin
// ****************************************************************************
// Modify the die roll modifier due to individual units.
// ****************************************************************************
        AttackingStack.ForEach(@AttackingUnitsDRM); // Includes armor shifts.
        DefendingStack.ForEach(@DefendingUnitsDRM); // Includes armor shifts.
        GetHQBonus;   // Include HQ support for both sides.
// ****************************************************************************
// Calculate the effect of a city on DRM.
// ****************************************************************************
        if InCity then
        begin         // CityDRM can never be more than 0.
          CityDRM := -1;
          CityDRM := CityDRM - Map.FactoryList.PrintedFactory[Hex.X, Hex.Y];
          DefendingStack.ForEach(@CheckEngineerD); // Decrements CityDRM.
          AttackingStack.ForEach(@CheckEngineerA); // Increments CityDRM.
          AttackingStack.ForEach(@IsHQ);           // Increments CityDRM.
          DRM := DRM + MinExtended([0, CityDRM]);  // Never a positive effect.
        end;
// ****************************************************************************
// Jungle benefit.
// ****************************************************************************
        if LCTerrain = teJungle then DRM := DRM - 4;
// ****************************************************************************
// Include the effect of weather on the die roll modifier.
// ****************************************************************************
        DRM := DRM - (Map.HexWeatherCombatMod[Hex.X, Hex.Y] * 2);
        CRatio := A / D;        // Raw odds ratio.
        TableCol := 0;          // Default value.
// ****************************************************************************
// Determine the CRT column based on the raw odds ratio.
// ****************************************************************************
        for Counter := 16 downto 0 do
        begin
          if CRatio >= OddsColumnFraction[Counter] then
          begin
            TableCol := Counter;
            Break;
          end;
        end;
// ****************************************************************************
// Take into consideration fractional odds.
// ****************************************************************************
        if OptRules.FractionalOdds then
        begin       // ColMod was set using ComputeFractionalOdds.
          if CRatio >= 1 then DRM := DRM + ColMod + (CRatio * 2)
          else DRM := DRM + ColMod + 4 - ((1/CRatio) * 2);
        end
        else
        begin  // Without fractional odds, the given ColMod is applied directly.
          TableCol := Range(TableCol + Round(ColMod), 0, 16);
          DRM := DRM + OddsModifier[TableCol];
        end;
      end;
    end
    else
// ****************************************************************************
//
// Final calculations for 1D10 CRT.
//
// ****************************************************************************
    begin
// ****************************************************************************
// Modify the die roll modifier due to individual units.
// ****************************************************************************
      if OptRules.BlitzBonus then
      begin
        AttackingStack.ForEach(@AttackingUnitsDRM); // Armor benefit.
// ****************************************************************************
// Include penalty for attacking a city with 2 or 3 printed factories.
// ****************************************************************************
        if Map.FactoryList.PrintedFactory[Hex.X, Hex.Y] > 1 then DRM := DRM - 1;
      end;

      DefendingStack.ForEach(@DefendingUnitsDRM);

      if D = 0 then TableCol := AutoVictoryColumn // Automatic combat victory.
      else
      begin
        CRatio := A / D;      // Raw odds ratio.
// ****************************************************************************
// ColMod includes 1D10 HQ support shifts.  The 1D10 CRT only has the attacking
// snow bonus, and it's a two column shift.  FractionBonus is the fractional
// odds shift that was passed as a parameter; it's value was calculated using
// ComputeFractionalOdds.
// ****************************************************************************
        ColShifts := Round(ColMod) +
                     (Ord(AUseSnowUnits) * 2) +
                     Ord(FractionBonus) -
                     Map.HexWeatherCombatMod[Hex.X, Hex.Y];

        WorkCol := 0;

        for Counter := 8 downto 0 do
        begin
          if IsAssault then
          begin     //	(0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 5.0, 7.0, 10.0);
            if CRatio >= AssaultColumnRatios[Counter] then
            begin
              WorkCol := Counter;
              Break;
            end;
          end
          else      // Blitzkrieg table.
          begin     //	(0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0);
            if CRatio >= BlitzkriegColumnRatios[Counter] then
            begin
              WorkCol := Counter;
              Break;
            end;
          end;
        end;
// ****************************************************************************
//  Give an extra column shift for every odds ratio lower than 1:2.
// ****************************************************************************
        if CRatio < 0.5 then
        begin                       // Ord(False) = 0; Ord(True) = -1.
          Inverse := Trunc(D / A) - Ord(Frac(D / A) > 0); // +1 if remainder > 0.
          ColShifts := ColShifts - Inverse;
        end;

        WorkCol := WorkCol + ColShifts;  // This may be negative.

        if WorkCol < 0 then
        begin     // Add to die roll modifier for shifts below 1:2.
          TableCol := 0;
          DRM := DRM - WorkCol;
        end       // WorkCol is > 0.
        else TableCol := Min([WorkCol, 8]);
      end;
    end;

    Result := True;
  finally
    AttackingStack.Clear;
    DefendingStack.Clear;
    AttackingStack.Free;
    DefendingStack.Free;

    if OptRules.TwoD10LandCRT then DRMRounded := Range(Util.Round(DRM), -21, 21)
    else DRMRounded := Util.Round(DRM);
  end;
end;




WIF_Killzone -> RE: When? (11/20/2009 6:44:21 PM)

Glad you feel better Samurai, well said. Writing code is a b!tch. I once wrote a parser-compiler for own custom programming language and it almost broke my brain. Don't think I have been the same since but it was bug free-NOT!

Back to the topic at hand, do we have a resised albiet estimated date of release?




Page: <<   < prev  49 50 [51] 52 53   next >   >>

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
1.421875