Maxing out 2mb VRAM
That''s the system video ram requirement I forced on myself.
I''m using a resolution of 640x480 at a depth of 16bpp.
30fps Is Absolute Min
Tiles, primary surface, back buffer, sprites, and objects easily eat past the 2mb mark(not to mention if windows is using any of the vram).I have ways, but Im wondering how some of you would approach this.
Would you keep some stuff in system ram?
Not use buffering?
Use precompiled sprites and tiles to write directly to a surface?Keep levels small?
Etc...
I''m having problems choosing speed or quality.
Thanks for your time,
Are you using DirectX?
If so, it handles all of that for you. Switching things in and out of memory. 30FPS isn''t dependant on how much stuff you have in ram. With DDraw it''s dependant on the speed of your processor and how much you''re putting on the screen each frame.
There are all kinds of optimization tricks you can use.
Ben
http://therabbithole.redback.inficad.com
If so, it handles all of that for you. Switching things in and out of memory. 30FPS isn''t dependant on how much stuff you have in ram. With DDraw it''s dependant on the speed of your processor and how much you''re putting on the screen each frame.
There are all kinds of optimization tricks you can use.
Ben
http://therabbithole.redback.inficad.com
I wasn''t aware that DirectX manages that for you. In fact, I''ve seen many people state the opposite. After all, if you put one surface in system memory and the back buffer in video memory, it goes much more slowly, no matter if you have video memory free.
Anyway, my sole recommendation is to use as few surfaces as possible to store your graphics on. That way, you don''t risk losing as much memory to the potential width/pitch discrepancy.
Anyway, my sole recommendation is to use as few surfaces as possible to store your graphics on. That way, you don''t risk losing as much memory to the potential width/pitch discrepancy.
Direct3D has it''s own texture manager, which AFAIK handles stuff like this for you. I''m using DirectDraw, so I had to build my own cache system (caches sysmem surfaces in vidmem). Was quite easy to implement and works fine, also solves the ''lost surfaces'' problem: sysmem surfaces can''t get lost, so I can just invalidate the vidmem cache and everything updates itself automagically.
As Kylotan says using power of 2 surface dimensions is also a good idea. One reason is alignment (width<->pitch) the other is easier handling in caches etc.
regards,
BuschnicK
As Kylotan says using power of 2 surface dimensions is also a good idea. One reason is alignment (width<->pitch) the other is easier handling in caches etc.
regards,
BuschnicK
Life would be much easier if I had the source code.blackfish.sourceforge.net
Hmm, if I were making a 2D game, I''d have EVERYTHING run in system memory and do loads of low-level manipulation. Then, for every frame, do ONE System to Videomem blit. That works perfectly, even on 1024x768x16bit on a 2MB card. (you don''t have a backbuffer in video memory)
- JQ
Infiltration: Losing Ground
"Simpson, eh?" -Mr. Burns
"Excellent!" -the above
- JQ
Infiltration: Losing Ground
"Simpson, eh?" -Mr. Burns
"Excellent!" -the above
~phil
Manages are far as not being limited in memory.
For my own project I don''t specify video or system memory. I ran into problems doing so. DDraw just puts it where it fits as it''s loaded.
Ben
http://therabbithole.redback.inficad.com
For my own project I don''t specify video or system memory. I ran into problems doing so. DDraw just puts it where it fits as it''s loaded.
Ben
http://therabbithole.redback.inficad.com
Direct3D does manage memory if you let it, and does a good job too. For example, in the project I am working on, I have a texture for every tile, and that uses up alot of memory, more then my video card can hold, but it doesnt slow down my rendering. I have a voodoo3 with 16megs of vram, but I can have upto 100megs of textures, but when I am looking at the map (which is only a small portion of the map), there is only about 1meg of textures on screen at any time, when I scroll around, it slows down a little, but with no scrolling it already has the textures its using in video memory, and thus renders at the same speed as if I only had 1 meg of texture memory total. Direct3D will put keeps surfaces in video memory based on when they were last used, it flushes ones not used out to system memory.
Also, 2mb of vram is rediculous. Look at almost any game comming out now and they all require atleast 8mb of vram on a 3D card. There is no excuse to be using a non-3d accelerator with only 2mb, lol. Go get an older video card like a voodoo3 or something, they only cost $30. If you look, you can find a decent card with 16megs of ram for $40 or less. And should be able to get a cheap Geforce2 for not much more.
Possibility
Also, 2mb of vram is rediculous. Look at almost any game comming out now and they all require atleast 8mb of vram on a 3D card. There is no excuse to be using a non-3d accelerator with only 2mb, lol. Go get an older video card like a voodoo3 or something, they only cost $30. If you look, you can find a decent card with 16megs of ram for $40 or less. And should be able to get a cheap Geforce2 for not much more.
Possibility
The original post implied that he wants to make this game available to the majority of computer users, who are people who didn''t buy their PCs in the last 2 years, and who wouldn''t know how to upgrade a graphics card if detailed instructions came in the box

Well, guessing that it''s 2D and tile based... Tripple Buffering would take 1.76 MB at that resolution and colour depth, no? so that''s no point really. If you use 1 back buffer, that''s 1.17 MB... ignoring windows you have about 0.8 MB left :D That in theory can hold... about 420 tiles of 32x32 and those 420 must make up the entire map and sprites etc.
Doesn''t sound too bad for a generic simple 2D game, does it. Even half that (200 tiles) can do quite a bit in one map. So you can shove the whole graphics in 2 MB if you do well.
If you want to make it complex and with loads of stuff in one map, then hell, 2MB is too little
You could put most frequently used tiles in VRAM and the rest in system RAM I guess.
As for memory management with direct draw, if you don''t set DDSCAPS_SYSTEMMEMORY when making a surface, I *THINK* it attempts to create the surface in VRAM first then if it fails (if it doesn''t find enough memory) then it goes into system RAM.
By the way, how much does Windows (anything other than your application/game) eat up on VRAM when you use fullscreen exclusive mode, does anyone know?
Doesn''t sound too bad for a generic simple 2D game, does it. Even half that (200 tiles) can do quite a bit in one map. So you can shove the whole graphics in 2 MB if you do well.
If you want to make it complex and with loads of stuff in one map, then hell, 2MB is too little

As for memory management with direct draw, if you don''t set DDSCAPS_SYSTEMMEMORY when making a surface, I *THINK* it attempts to create the surface in VRAM first then if it fails (if it doesn''t find enough memory) then it goes into system RAM.
By the way, how much does Windows (anything other than your application/game) eat up on VRAM when you use fullscreen exclusive mode, does anyone know?
Sadly alot of people have really crappy systems. Im talking about people who don''t know what a driver is, bought their computer at WAL*MART, and never installed or uninstalled anything properly. I feel as a programmer I should make my game as easy to get going and make it work across all computers. I enjoy trying to squeeze the most power out and make it the most stable I can. Hell I bought a refurbished pc for testing and it only cost about $50 US.
2mb Trio Card(NO 3D Acceleration)
Elephant Sound Card
200 mhertz MMX Processer
32 Ram
After I get my watered down version complete, I will update the graphics engine to support newer technology.
How about precompiling every tile, sprite, and object in code? That way when I need to render a new frame
1)I lock the backbuffer
2)Call all the functions that blit all the images
For Example fuction Draw_Grass_Tile does
Plot Pixel X+1 ,Y+1 Green
Plot Pixel X+2, Y+1 Green
Etc...
3)Unlock the backbuffer
4)Flip or Blt to Screen
2mb Trio Card(NO 3D Acceleration)
Elephant Sound Card
200 mhertz MMX Processer
32 Ram
After I get my watered down version complete, I will update the graphics engine to support newer technology.
How about precompiling every tile, sprite, and object in code? That way when I need to render a new frame
1)I lock the backbuffer
2)Call all the functions that blit all the images
For Example fuction Draw_Grass_Tile does
Plot Pixel X+1 ,Y+1 Green
Plot Pixel X+2, Y+1 Green
Etc...
3)Unlock the backbuffer
4)Flip or Blt to Screen
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement