View Full Version : 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 :yes: (sorry for so many questions here)
Polemists
02-15-2009, 13:46
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.
Ibn-Khaldun
02-15-2009, 14:35
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.
Polemists
02-15-2009, 14:38
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.
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?
Polemists
02-15-2009, 15:14
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.
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?
Flavius Silvanus
02-15-2009, 21:45
Look at Oklahoma when they ran the Wishbone. You knew they would run the Triple Option, but few people could actually stop it.
Greyblades
02-15-2009, 22:09
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. :2thumbsup:
Marius Dynamite
02-15-2009, 23:09
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.
Polemists
02-16-2009, 06:39
I think your right, i mean empire is already 15 gig, i'd rather not see it jump to 30.
Mailman653
02-16-2009, 07:48
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. :laugh4:
Ibn-Khaldun
02-16-2009, 09:11
I bet the TW game that comes out in 2049 will take up about 500GB. :laugh4:
I hope that NASA will allow me to use it's super-computer to play it then! :stupido2:
Marius Dynamite
02-16-2009, 11:52
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! :dizzy2:
Theodotos I
02-16-2009, 14:56
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.
Raidvvan
02-19-2009, 21:35
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.
Tellos Athenaios
02-21-2009, 22:03
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?
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.
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.
Raidvvan
02-22-2009, 06:40
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!
Polemists
02-22-2009, 06:56
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.
I bet the TW game that comes out in 2049 will take up about 500GB. :laugh4:
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.
Polemists
02-22-2009, 13:08
15360 GB of storage....
wow........i'm really going to have to upgrade then...:laugh4:
We have confirmation that there in hard coded limits for unit size.
https://img407.imageshack.us/img407/2337/holyshitlotsofpeopleu.jpg
That is the coolest thing i've EVER SEEN. :laugh4::laugh4:
Repeat after me: real-sized armies :sweatdrop:
Monsieur Alphonse
02-22-2009, 21:33
Scroll down to post number 117 and you will see: http://www.twcenter.net/forums/showthread.php?t=227327&page=6
I hope this is in the game possible aswell. I have to buy a Cray :sweatdrop:
vBulletin® v3.7.1, Copyright ©2000-2025, Jelsoft Enterprises Ltd.