Infinite number of units
Hi,
I was just having lunch, and suddenly i wondered about "how to make an array of units(strategy games e.g) that limitless if possible". :)
For example, red alert series. You can produce units as more as you can. There is no population cap like age of empires series.
Any suggestions?
One day, a monk went to see his master, and asked:
The old master pondered and answered:
And the monk was enlightened.
My mainframe has limited memory, and cannot store enough polygons to render a forest of spheres. Pray tell, sensei, how can I work around this?
The old master pondered and answered:
Polygons need to be drawn, not stored.
And the monk was enlightened.
The Red Alert series does have a limit. It is just high enough that you wouldn't normally encounter it.
Red Alert has other limits before that. In particular, there is something like a 50-unit limit on the amount of units that can be selected at any given time.
Look in to using the STL: if you use a vector or a deque to store your units, you can keep pushing back elements on to the array until you run out of memory.
Quote:Original post by ToohrVyk
One day, a monk went to see his master, and asked:
My mainframe has limited memory, and cannot store enough polygons to render a forest of spheres. Pray tell, sensei, how can I work around this?
The old master pondered and answered:
Polygons need to be drawn, not stored.
And the monk was enlightened.
Hmm, so red alert first checks if there is an unit in tile and if so, select it?
Quote:Original post by ToohrVyk
One day, a monk went to see his master, and asked:
My mainframe has limited memory, and cannot store enough polygons to render a forest of spheres. Pray tell, sensei, how can I work around this?
The old master pondered and answered:
Polygons need to be drawn, not stored.
And the monk was enlightened.
that is beautiful :D
did you make that up or find it somewhere? i'm totally putting that on my facebook ^^
@justin: made that up.
@by: polygons are units, spheres are groups of units. You need to display polygons/units when a group/sphere appears on the screen. However, when they are not on the screen, you only need to memorize the group/sphere size and position, which drastically reduces the memory requirements.
This means that you'd need to store the ~100 units appearing on the screen, and 1/100th of other units (which would be assembled in groups of average size 100).
Using as much memory as Total Annihilation (200 units), you could store 100 + 100*100 = 10100 units.
However, Red Alert is still much within reasonable limits on unit count, so I don't see why it would use special technology to store its units (probably a resizable array, that's all).
@by: polygons are units, spheres are groups of units. You need to display polygons/units when a group/sphere appears on the screen. However, when they are not on the screen, you only need to memorize the group/sphere size and position, which drastically reduces the memory requirements.
This means that you'd need to store the ~100 units appearing on the screen, and 1/100th of other units (which would be assembled in groups of average size 100).
Using as much memory as Total Annihilation (200 units), you could store 100 + 100*100 = 10100 units.
However, Red Alert is still much within reasonable limits on unit count, so I don't see why it would use special technology to store its units (probably a resizable array, that's all).
i am fairly certain that the Command & Conquer: Generals series does not have a limit. I guess one solution to this would be that once you get 100 guys you could combine them into 10 really strong guys. Then all you would have to do is increment their firepower, which I would assume would be a number and will not likely reach its max for a VERY LONG time. (you could repeat this process everytime you got 10 of a certine until but the actuall gameplay aspects would varry)
for example
100 foot soliders
become
10 super soliders
power of super solider 1 = [0-9].power
power of super solider 2 = [10-19].power
you could even do mixed unit strengths this way and even subclassify units based on their power.
char buf [10];
sprintf(buf, "%d", Solider.power / 10);
Solider.Name = "Solider Level " + buf;
something of that nature
EDIT: On the idea of infinity and computers: Computers will always have a finite amount of memory and processing power so if your truly talking about inifite units. You can't
Hmm so if we do the math...
100 lvl 1 = 10 lvl 2
1000 lvl 1 = 100 lvl 2 = 10 lvl 3
10000 lvl 1 = 1000 lvl 2 = 100 lvl 3 = 10 lvl 4
power of each lvl 4: 5000 (EASILY within the bounds of a simple int)
10000 units is insane, and you could get higher then that and not max out an int but if your curious as to the cealing go on ahead
for example
100 foot soliders
become
10 super soliders
power of super solider 1 = [0-9].power
power of super solider 2 = [10-19].power
you could even do mixed unit strengths this way and even subclassify units based on their power.
char buf [10];
sprintf(buf, "%d", Solider.power / 10);
Solider.Name = "Solider Level " + buf;
something of that nature
EDIT: On the idea of infinity and computers: Computers will always have a finite amount of memory and processing power so if your truly talking about inifite units. You can't
Hmm so if we do the math...
100 lvl 1 = 10 lvl 2
1000 lvl 1 = 100 lvl 2 = 10 lvl 3
10000 lvl 1 = 1000 lvl 2 = 100 lvl 3 = 10 lvl 4
power of each lvl 4: 5000 (EASILY within the bounds of a simple int)
10000 units is insane, and you could get higher then that and not max out an int but if your curious as to the cealing go on ahead
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement