Advertisement

Graphics Memory limited

Started by March 28, 2000 09:22 AM
8 comments, last by BeanDog 24 years, 11 months ago
How do you store all those sprites in memory at once? For instance, in StarCraft, there must be about 3 dozen different types of units with dozens of pics per. How do they manage to store all that efficiently enough not to use up all the system resources? I am working on making a large game, and how am I going to store all the graphics? ~BenDilts( void );
Actually, often times not all sprites are stored in video memory. System memory is perfectly acceptable (although a bit slower).

--TheGoop
Advertisement
Isn''t the "usual" ram faster than video memory?

/. Muzzafarath
I'm reminded of the day my daughter came in, looked over my shoulder at some Perl 4 code, and said, "What is that, swearing?" - Larry Wall
Defenetly not. VRam is quite faster than System RAM.

However, you might think of using the VRam as a DDSurface cache, where with an intelligent manager you might manage to speed up things a bit, though i don''t think it will change anything dramaticly, and it defenetly doesn''t worth the time devoted to it. Still i find it quite some intresting challenge .

c ''ya.
... LEMMINGS ... LEMMINGS ... LEMMINGS ... LEM..... SpLaSh!...Could this be what we stand like before the mighty One?Are we LeMmIngS or WhAt!? ;)
No, the "usual" RAM, system memory, is not faster then Video Memory when it comes to graphics. What you see on the screen exists in Video Memory, so moving from Video Memory to Video Memory is the fastest way. This is one reason why gfx cards comes with loads of MBs nodays!

/Mr K
I''m not sure if video memory is faster then internal memory. The reason why you should try to keep as much of the sprites in your video mem, is becouse the downloading from internal mem to video mem is "slow". The computer has to use the PCI or AGP bus for it. Every modern video card has a hardware memory copier that works from video memory to video memory. DirectX hide it from you becouse the implementation is different on every card.

For managing the sprites you could make a list of most used sprites, and only load these into your video mem. You could optimize it every frame (or every 2, 3 4 etc. frames).

Yhdz
Advertisement
just a note. if your using the cpu to do all the bitbliting its fast to store you images in sys ram and not in vram. but it is faster if you use the gfx hardware to do the bliting...

using the cpu and vram to vram blit the cpu pulls the data from the card(through the exp. bus)then sends it to the new location in vram(through the bus again)

hardware vram to vram is the fastest way because the bus is not used and the bliter on the card is specialized to move a lot of data very fast.

sys ram to vram... eather cpu or hardware... data only is moved through the bus once so fast than the second one but slower than the first.

I''d recomend puting the images in vram starting with the most used to the least. then when out of vram then put them in sys ram.

Great Milenko

Words Of Wisdom:
"Never Stick A Pretzel In Your Butt It Might Break Off In There."


http://www.crosswinds.net/~milenko
http://www.crosswinds.net/~pirotech

The Great Milenko"Don't stick a pretzel up your ass, it might get stuck in there.""Computer Programming is findding the right wrench to hammer in the correct screw."
I stand corrected

/. Muzzafarath
I'm reminded of the day my daughter came in, looked over my shoulder at some Perl 4 code, and said, "What is that, swearing?" - Larry Wall
Yeah, StarCraft for one thing is 640x480, and I believe it is also 256 colours, even if it isn''t. Those imagesa are SMALL, you can probably fit them all into 1 mb of VRAM. in case you don''t know, 1 MB is actually quite a lot of memory.
If they don''t have enough, they will put it in system memory, so most are in VRAM, and the extras aren''t


Rock on,
- Tom
Rock on,- Tom
I believe that atleast some games use some kind of surface caching, quite like D3D manages textures, using different kinds of methods to download the most used surfaces into video memory.

I''ve actually pondered using a LRU/MRU (Least Recently Used/Most Recently Used) method to store surfaces. Every surface then has a LRU or MRU variable that is calculated when drawing the scene and about every 5 seconds or something, it download as much surfaces as possible into VRAM starting with the highest MRU value.

"you can probably fit them all into 1 mb of VRAM" - 1 MB RAM isn''t that much either. Do some calculations:

SurfaceWidth * SurfaceHeight * BPP / 8

Then you''ll realize that it fills up pretty fast, even if it is 8 bitdepth. Count in Starcraft''s interface + races and you''ve got yourself quite a heap of data.

============================
Daniel Netz, Sentinel Design
"I'm not stupid, I'm from Sweden" - Unknown
============================Daniel Netz, Sentinel Design"I'm not stupid, I'm from Sweden" - Unknown

This topic is closed to new replies.

Advertisement