wyrd Posted July 10, 2003 Posted July 10, 2003 I noticed that the Paint event automatically gives a blank Graphics object, which would mean I'd have to redraw every object in my game (at most 115). There's also an option to set auto backbuffer, right? Obviously the Refresh method and Paint event makes things simplistic an easy, I was wondering just how fast or slow it is? Would I benefit more if I were to just use a single Graphics object and clear moving object by hand (which obviously wouldn't be all 115), or would the speed different in my small game not matter much? Maybe I should take the easy route, and if speed isn't efficient enough, try out the "old fasion" way of creating my own back buffer and just clearing/drawing items that are moving? Oh and btw, how do you set the backbuffer option for a form? :P Quote Gamer extraordinaire. Programmer wannabe.
*Experts* mutant Posted July 10, 2003 *Experts* Posted July 10, 2003 Oh and btw, how do you set the backbuffer option for a form? :P You use DoubleBuffering to do that. Set those properites to true in your form like this: SetSTyle(ControlStyles.DoubleBuffer, True) SetStyle(ControlStyles.AllPaintingInWMPaint, True) SetStyle(ControlStyles.UserPaint, True) Windows will draw the fastest way possible for it :) As for your object, I think GDI+ will have some trouble drawing 115 objects at one time especially if they are big :) Quote
AndreRyan Posted July 10, 2003 Posted July 10, 2003 You could use Invalidate instead of Refresh. Then you'd only have to redraw the sections that changed. I found this to turn really nasty sometimes because if you stray onto areas that aren't invalidated they just won't show up. Quote .Net allows software to be written for any version of Windows and not break like Unmanaged applications unless using Unmanaged procedures like APIs. If your program uses large amounts of memory but releases it when something else needs it, then what's the problem?
wyrd Posted July 11, 2003 Author Posted July 11, 2003 Mutant: Hmm, I see. Will that still clear the backbuffer on every Paint or will I have to manually clear areas now? BTW objects are only 32x32. Quote Gamer extraordinaire. Programmer wannabe.
*Experts* mutant Posted July 11, 2003 *Experts* Posted July 11, 2003 You dont have to worry about clearing it. Quote
wyrd Posted July 11, 2003 Author Posted July 11, 2003 Hmm, okay. Well I'll try it out, should be able to easily convert it from Paint event to my own routine if redrawing 115 images becomes to much of a slow down. Need to test it anyway, because if it can't handle this then there's no way it'll be able to handle an NES style 2D game. Quote Gamer extraordinaire. Programmer wannabe.
jawadh90 Posted July 11, 2003 Posted July 11, 2003 advice to to get it faster you might want to change all your mathematical operations to integer because it takes alot of processor usage to perform complex math operations when you have single, double, etc. variables...if you run task manager while you're running your program drag the task manager above the form and look at the processor usage then you'll see! most gaming programmers use this technique to lessen flickering and at the same time processor usage Quote
*Gurus* divil Posted July 11, 2003 *Gurus* Posted July 11, 2003 You should redraw the entire scene every time, that's just how it's done. Drawing 110 32x32 objects shouldn't slow things down too much, if this is a windowed GDI+ game. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
wyrd Posted July 11, 2003 Author Posted July 11, 2003 You should redraw the entire scene every time, that's just how it's done. Drawing 110 32x32 objects shouldn't slow things down too much, if this is a windowed GDI+ game. Hmm. I was always under the impression that you shouldn't draw any more then you have to (which in 99% of the cases is the entire game). Well any way, good to know drawing 110 objects shouldn't be to big a deal. Quote Gamer extraordinaire. Programmer wannabe.
*Experts* Nerseus Posted July 11, 2003 *Experts* Posted July 11, 2003 Keep in mind that all 3D games are redrawing the entire screen every time - it's not as big a deal as it once was. Back in the "old days", you wanted to use Dirty Rectangles to only update what needed updating because things were much slower to draw. On a game I was working on, I had been drawing roughly 1000 14x14 images using DirectX in fullscreen. My original design had them setup as separate buffers, each drawn through a separate call. The speed was extremely slow (20-30 FPS) on my PIII 700 with GeForce 2 GTS. I modified the code to use one buffer and jumped to 500+ FPS (no waiting on the vsync). Now I know you're not using DirectX, but the point is that there may be different ways to draw things that may speed things up (or slow them down, if done wrong). So I'd test out your theory of drawing 110 objects and see what the speed looks like in a sample app. If it looks ok then you're good to go. If not, you may have to rethink how you design the GUI parts (such as structures to store what's changed and redraw only that). -Nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.