System memory vs Video memory performance issue

Started by
4 comments, last by Dogen 21 years, 10 months ago
Hi I have a little performance problem with my game i''m creating. My game consists of a map and a bunch of players with weapons. The players should be able to blow holes in the map during the game and when they do small pieces of the map should fly away and bounce on the map. It looks a little like worms but is not turn based and will in the future have support for multiplayergames. My problem is how to store my map surface since i have to both read from it to check if a piece will bounce or not and write to it to be able to make the holes after the weapons. Since i need this i have to Lock() it. When i store my surface in the memory of the videocard i can draw the map very fast but the reading and writing is slow. Thus when i store the map in the system memory the drawing is slow but the reading and writing it quick. Does anyone have a third suggestion of how i can make this go faster? You might think that the time is so little that it will not matter but trust me it will when you have a lot of objects checking the map to bounce or not. And my game has alot of objects cause it is a true action game help needed /Dogen
Advertisement
Making Liero 2?

Guss what? I''m also working on a realtime worms games, just like Liero And I had the same problem. Not sure what to do, except I''m gonna take a break and learn some assembly, already learnt a bit.

I''ll be watching this thread for the answer

Lycka till!

/MindWipe
"To some its a six-pack, to me it's a support group."
Yea
as a matter of fact i am making a new version of liero.
The main thing was to make it look better and of course the abillity to play it in multiplayer.
I just hope someone can solve this problem i have so i can go on.

/Dogen
Just as some consolation - it''s possible. Checkout this Liero Clone. Or actualy Liero is a Molez clone and that''s why this game is named MClone: MCLone Site

I have had some contact with the maker, he uses alot of assmebly and alot of speedups with MMX but it also had many special effects.

So for only a liero game it should be able to do it in another way.

One idea would be to have a 2D array for collison detection. And then just change that array and blit in vmem on the map.

Like having one in vmem and one in smem, the one in smem for checking stuff, the one in vmem for drawing.

/MindWipe
"To some its a six-pack, to me it's a support group."
ok
But how do you sync what has been changed in the system memory with the map that you draw from the video memory?
My problem is that it takes to long time to make the collision detection with the objects and the map.
Or you mean that you should have the map in an array, i think you do. But then you would have to to everything twice, or?

/Dogen
It''s been a while since I heard a lecture on this, but if I recall correctly... video memory is slow to write to but very fast to read from and system memory is pretty much fast to read from(but not as fast as vid mem) or write to. Given this, if you plan on doing a lot of writing to your surface, I would stick it in system memory. Any surfaces you don''t plan on writing to very much stick in video. I''m pretty sure both the primary and back buffer HAVE to be in video memory however. So do all your writing to an offscreen system memory surface, blt whatever you need to the backbuffer when you are ready and then flip to the primary surface.

D

This topic is closed to new replies.

Advertisement