Jump to content
  • Advertisement
Sign in to follow this  
by

Infinite number of units

This topic is 4606 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
The Red Alert series does have a limit. It is just high enough that you wouldn't normally encounter it.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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 ^^

Share this post


Link to post
Share on other sites
@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).

Share this post


Link to post
Share on other sites
Thank you, i am absolutely interested in this subject :)

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!