Results 1 to 25 of 25

Thread: Is there a reason for Hardcoded limits?

  1. #1
    Member Allu X's Avatar
    Join Date
    Feb 2009
    Location
    England, United Kingdom
    Posts
    32

    Default Is there a reason for Hardcoded limits?

    Simply as the question says really, what is the reason that in past Total War games there have been hardcoded limits such as 199 regions + sea, or 500 units?

    How easy would it have been for CA to decide to increase the unit limit in M2:TW to say, 1000? A simple text variable?

    It just seems that seeing the fuss over the limits in the previous games for modders, wouldn't CA remove the region/unit + other caps altogether for Empire: Total War? Or have they?

    I heard that there is no region limit in Empire, which is good now because it can mean an extremely fun campaign map with a lot more to do, but what about the unit sizes and number of them?

    I was thinking maybe the reason for the limits in past Total War games and in Empire is because it causes instability?

    Anyway please discuss (sorry for so many questions here)

  2. #2
    Member Member Polemists's Avatar
    Join Date
    Sep 2006
    Location
    In the Lou
    Posts
    1,213

    Default Re: Is there a reason for Hardcoded limits?

    The reason normally would be graphcis I think, and stability issues.

    They are trying to improve AI with advanced codes now. So it's much easier to do code for a set number and test it then for a countless number of variables.

  3. #3
    Senior Member Senior Member Ibn-Khaldun's Avatar
    Join Date
    Aug 2007
    Location
    Estonia
    Posts
    5,489
    Blog Entries
    4

    Default Re: Is there a reason for Hardcoded limits?

    The engines in last TW games were not as good as this one. Also, AI played a big role in them just like Polemists pointed out.

  4. #4
    Member Member Polemists's Avatar
    Join Date
    Sep 2006
    Location
    In the Lou
    Posts
    1,213

    Default Re: Is there a reason for Hardcoded limits?

    This is espically true if you watch the tactics video.

    The AI now has a plot. So when you go at them, they say, ahh, I have this many calvary, this many infantry I am going to try and do this formation

    Then if you scatter them they are going to try and reform or try a new formation.


    For formational combat with lines and formations marching, it is rather difficult at 10,000 let alone at 20,000, 30,000, etc.

    I don't know coding but I do know science, a controlled variable is always easier to test then a variety of uncontrolled ones.

  5. #5
    Member Allu X's Avatar
    Join Date
    Feb 2009
    Location
    England, United Kingdom
    Posts
    32

    Default Re: Is there a reason for Hardcoded limits?

    Quote Originally Posted by Polemists View Post
    This is espically true if you watch the tactics video.

    The AI now has a plot. So when you go at them, they say, ahh, I have this many calvary, this many infantry I am going to try and do this formation

    Then if you scatter them they are going to try and reform or try a new formation.


    For formational combat with lines and formations marching, it is rather difficult at 10,000 let alone at 20,000, 30,000, etc.

    I don't know coding but I do know science, a controlled variable is always easier to test then a variety of uncontrolled ones.

    But won't this make the AI become too predictable and scripted?

  6. #6
    Member Member Polemists's Avatar
    Join Date
    Sep 2006
    Location
    In the Lou
    Posts
    1,213

    Default Re: Is there a reason for Hardcoded limits?

    Yes and no.

    If I give Army A 30 different formations depending on 30 different scenarios, with 30 different fall back scenarios. You've got a plethroa of options, plus the AI can constantly switch back and forth.


    In previous TW games the formula was simple. Frontal attack, flank if possible, charge calavary against either weaker units or bull rush your general.

    Now, if you do frontal attack it has maybe 30 or 50 formations to choose from. It can garrison, it can build fortifications, it can also the map. High and low terrain, certain ambush poistions, and slowly the strategies build. Not to mention this is not simple numbers, the AI may see you like to use horse charges in the flank and suddenly mid game switch it's strategy.

    Where you once had one strategy it may now have 5 different options of how to employ that strategy.

    Combine this with the fact that factions are unique and they are going off historical stratgies there could be thousands of options.

    Now if they let 30,000 troops on the board, what strategy can the AI use? Formation loses all meaning at that many numbers as it is merely a brawl. It would have to subcode, by dividing units into groups or armies, and then use those armies in formations. Which the Ai is currently not designed to do.

    The AI is designed to fight a player on the single player campaign, possibly with allies or reinforcements on either side. It is not designed to field 30,000 troops against 10,000 troops.

    Even if a pc could handle it, the AI would become confused and the combat would just be a mess of chaos.
    Last edited by Polemists; 02-15-2009 at 15:16.

  7. #7
    I Still Play Shogun Member ratbarf's Avatar
    Join Date
    Jan 2007
    Location
    Canada Baby!
    Posts
    122

    Default Re: Is there a reason for Hardcoded limits?

    I don't know, with formation AI wouldn't be easier to make the differrent groups work in tandem than if they tried to create one giant formation and then micromanage it? I thought they would have programmed to AI to deal multiple armies and splits of armies at once. I would think several small independant formations within an army would be easier to manage as all they would have to do is support eachother?
    "The man who has no sense of history, is like a man who has no ears or eyes" - Adolf Hitler

    "In the absence of orders, go find something and kill it." - Field Marshal Erwin Rommel

    Interdum feror cupidine partium magnarum Europae vincendarum
    Sometimes I get this urge to conquer large parts of Europe.

  8. #8

    Default Re: Is there a reason for Hardcoded limits?

    Look at Oklahoma when they ran the Wishbone. You knew they would run the Triple Option, but few people could actually stop it.

  9. #9
    Member Member Greyblades's Avatar
    Join Date
    Feb 2009
    Location
    UK
    Posts
    8,408
    Blog Entries
    2

    Default Re: Is there a reason for Hardcoded limits?

    Quote Originally Posted by Flavius Silvanus View Post
    Look at Oklahoma when they ran the Wishbone. You knew they would run the Triple Option, but few people could actually stop it.
    No offense intended but you may want to find a better example. I'm not totaly sure but i doubt that many people here fully understand either the Football lingo or the game you were reffering to.

    Oh and welcome to the board.
    Being better than the worst does not inherently make you good. But being better than the rest lets you brag.


    Quote Originally Posted by Strike For The South View Post
    Don't be scared that you don't freak out. Be scared when you don't care about freaking out
    Spoiler Alert, click show to read: 

  10. #10
    Member Member Marius Dynamite's Avatar
    Join Date
    Aug 2006
    Location
    Glasgow, Scotland
    Posts
    258

    Default Re: Is there a reason for Hardcoded limits?

    I think from a programming point of view its poor practice when coding not to put in limits.

    Maybe I'm wrong but if I logic it out..

    if you only want to only 4 units then you only need 2 bits worth of space for each unit..

    00 - Unit 1
    01 - Unit 2
    10 - Unit 3
    11 - Unit 4

    You only need 8 bits of storage space.

    If you want to set your limit higher then your adding on more bits. If you not going to use the extra slots you make by adding a bit, then your slowing things down and wasting space for nothing.

    000 - Unit 1
    001 - Unit 2
    010 - Unit 3
    100 - Unit 4
    110 - Empty
    101 - Empty
    111 - Empty
    011 - Empty

    To store the same 4 Units your now needing 12 bits of storage.

    I would imnagine in the actual game each unit required a much larger amount of space so the difference of adding more units, and the consequential bit length would mean a lot larger memory requirement.

    Like I say I'm not 100% sure on this stuff so maybe someone who's into programming will correct me.
    Last edited by Marius Dynamite; 02-15-2009 at 23:24.

  11. #11
    Member Member Polemists's Avatar
    Join Date
    Sep 2006
    Location
    In the Lou
    Posts
    1,213

    Default Re: Is there a reason for Hardcoded limits?

    I think your right, i mean empire is already 15 gig, i'd rather not see it jump to 30.

  12. #12
    Undercover Lurker Member Mailman653's Avatar
    Join Date
    Nov 2006
    Location
    Austin, TX
    Posts
    1,307

    Default Re: Is there a reason for Hardcoded limits?

    Quote Originally Posted by Polemists View Post
    I think your right, i mean empire is already 15 gig, i'd rather not see it jump to 30.

    I bet the TW game that comes out in 2049 will take up about 500GB.

  13. #13
    Senior Member Senior Member Ibn-Khaldun's Avatar
    Join Date
    Aug 2007
    Location
    Estonia
    Posts
    5,489
    Blog Entries
    4

    Default Re: Is there a reason for Hardcoded limits?

    Quote Originally Posted by Mailman653 View Post
    I bet the TW game that comes out in 2049 will take up about 500GB.
    I hope that NASA will allow me to use it's super-computer to play it then!
    Last edited by Ibn-Khaldun; 02-16-2009 at 09:11.

  14. #14
    Member Member Marius Dynamite's Avatar
    Join Date
    Aug 2006
    Location
    Glasgow, Scotland
    Posts
    258

    Default Re: Is there a reason for Hardcoded limits?

    I think your right, i mean empire is already 15 gig, i'd rather not see it jump to 30.
    and think of the RAM requirement!

  15. #15

    Default Re: Is there a reason for Hardcoded limits?

    I've always figured there was a good reason for them. But when they went from twenty-one to thirty-one factions, I wish they could have put both unit and province limits up by about a hundred. It would have helped modders a great deal.
    “He that is slow to anger is better than the mighty; and he that ruleth his spirit than he that taketh a city.”-Proverbs 16:32


    Read my Aedui AAR-"Across the Waters: A Story of the Migration"
    And the sequel "Sword of Albion"

  16. #16

    Default Re: Is there a reason for Hardcoded limits?

    Yes, there is a reason for hardcoded limit. No, there is no TECHNICAL reason to have 100 regions, or 16 factions, or 500 units. It is marketing.
    Technically, Marius Dynamite, you are right, but about 20 years too late :) The modern 32 bit CPUs process 4 bytes at a time, so they work with integers from 0 to 2^32-1. That is more than 4 biillion. It does not matter if you do basic operations with a number like 500 or 500,000, as long as the result is less than 2^32-1, it takes the same time. So here is a TECHNICAL limit, that makes sense to hardcode to. The memory bus is 32 bits wide, the chipsets buffers are 32 bits wide and so on.
    On the other hand, 100 regions are allowed in the first game so they can sell you an addon, and then another addon, that are raising the limits to 150, and finally 200.
    Let's say that the average computer is speed limited to a map with 200 regions. Why not making 200 regions available from the beginning, even if the game ships with a 100 regions map? Marketing. Why not hardcoding the number of regions at 1,024 and let the modders care about how many regions they want displayed and the users about their hardware? Marketing. Don't get me started on the number of units.
    15 GB? That's all graphics, maps etc. The actual compiled code cannot be more than a few MBs, maybe less than 20, if you strip the libraries etc.

  17. #17

    Default Re: Is there a reason for Hardcoded limits?

    If CA wanted to they could make a game without 'such limits' (that is: without limits you are going to bump into, I mean a limit of 2^30 units isn't going to be noticed too soon). Issue is: what benefits do hardcoded, arbitrary limits bring to you?
    1. You could implement bitmasks in the room you leave out. Those bitmasks can encode additional data, meaning you may use less resources to (until the limit is hit) the same effect.
    2. You can make more assumptions, for instance if you implement a lookup table (hashtable) the more you know about the 'domain' of the input (what goes in, how varied the input is etc.) the better you can fine tune your indexing/hashing functions. This can give you a very large performance boost because you can avoid additional complexity (less to compute means less time required). In the Real-Time components of the game this may be worth more than the loss of (theoretical) content.
    - Tellos Athenaios
    CUF tool - XIDX - PACK tool - SD tool - EVT tool - EB Install Guide - How to track down loading CTD's - EB 1.1 Maps thread


    ὁ δ᾽ ἠλίθιος ὣσπερ πρόβατον βῆ βῆ λέγων βαδίζει” – Kratinos in Dionysalexandros.

  18. #18

    Default Re: Is there a reason for Hardcoded limits?

    Tellos, I have to start saying that my experience with software is based on business software, not PC games :) and from what I've seen, in most projects speed optimization is unfortunately being done either if the project is on time or the code is so bad that the performance is unacceptable by the customer.
    The benefits of hardcoded limits are as you say. But with the limits for units, regions being so low as they are now, even increasing them 10 fold would not put any additional strain on the PC. As I said before, general CPUs do 32 bits processing at once. I think that is more than enough to have bitmasks for units, for example. You can have a mask on 2 bytes, unit type for example, and that still leaves 2 bytes for 65K units. Same for regions, 2 bytes should be enough to encode the geography of region, number of neighbours, recruitement type and so on and still leave plenty of space to encode 10,000 regions.
    As such, they can use any structures they want, hash tables, array indexes or whatever, the key here is that in my opinion no hardware limit prevents expanding, for example, the number of units to at least the above 65K.
    I can only see one drawback for such numbers for regions and units: loading times, if a modder decides to use all of them at once.
    I love EB, thank you for the best mod I ever played!

  19. #19
    Member Member Polemists's Avatar
    Join Date
    Sep 2006
    Location
    In the Lou
    Posts
    1,213

    Default Re: Is there a reason for Hardcoded limits?

    I am not a dev, or even someone who knows code. I do however see the marketing side of it. Not just the simple, they don't want to do it all side, but the side of it would not equal the other areas.

    CA/Sega whoever puts a variety of unique items into the factions they do use, extra research, individual artisits, sound actors, etc, etc. The video game industry is no longer just 8 programmers in a basement.

    Considering what we had before they have done a ton. The fact NO rebel province is just a grey "rebel" anymore is astonishing and honestly something I never thought they could do. The fact we are getting a extra area of the world is impressive. Yet they do have limits, what can, be added, will be added etc.

    CA added as much quality and material as they thought justified the cost/ expense/ and release date window for the product. I am happy with the results and the modders will unlock the rest.

    In the end CA knows what they are doing with factions, I trust them this far, TW games have always had a limited number of factions, I don't see it suddenly changing to a 1000.

  20. #20
    Member Member Daevyll's Avatar
    Join Date
    Aug 2002
    Location
    Netherlands
    Posts
    277

    Default Re: Is there a reason for Hardcoded limits?

    Quote Originally Posted by Mailman653 View Post
    I bet the TW game that comes out in 2049 will take up about 500GB.
    I expect it to be much, much more.
    According to Moore's law of exponential growth, in 40 years time computing capacity would have doubled 20 times over.
    If we take storage requirement to 'only' require half that amount of growth in keeping pace with computing capacity, we're still talking about 15360 GB of storage.

  21. #21
    Member Member Polemists's Avatar
    Join Date
    Sep 2006
    Location
    In the Lou
    Posts
    1,213

    Default Re: Is there a reason for Hardcoded limits?

    15360 GB of storage....

    wow........i'm really going to have to upgrade then...

  22. #22

    Default Re: Is there a reason for Hardcoded limits?

    We have confirmation that there in hard coded limits for unit size.

    Spoiler Alert, click show to read: 

  23. #23
    The Abominable Senior Member Hexxagon Champion Monk's Avatar
    Join Date
    Jan 2003
    Location
    YU-ESS-AY
    Posts
    6,667

    Default Re: Is there a reason for Hardcoded limits?

    That is the coolest thing i've EVER SEEN.

  24. #24
    Member Member Smeel's Avatar
    Join Date
    Feb 2008
    Location
    Sweden
    Posts
    56

    Default Re: Is there a reason for Hardcoded limits?

    Repeat after me: real-sized armies

  25. #25
    kwait nait Member Monsieur Alphonse's Avatar
    Join Date
    May 2007
    Location
    Groningen
    Posts
    928

    Default Re: Is there a reason for Hardcoded limits?

    Scroll down to post number 117 and you will see: http://www.twcenter.net/forums/showt...=227327&page=6

    I hope this is in the game possible aswell. I have to buy a Cray
    Tosa Inu

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Single Sign On provided by vBSSO