none
Performance Question RRS feed

  • Question

  • hi! i have a question.
    when an image is drawn on the graphics window, does that suck the same amount of performance like there are 100 images drawn on the graphics window? (i mean, when theyre already drawn. not the drawing process itself)

    cuz i want to make staying blood effects in my game..
    ____ OR GET RAPED!
    Wednesday, August 19, 2009 12:57 AM

Answers

  • To answer your question, the drawig proccess cost is proportional to the amount of data to treat (if you draw 100 times an images, you'll have a cost nearly 100 times higher than drawing one image) but once the image is drawn, there should be no cost anymore.

    If you're using Addxxxx, there's a drawing cost every time the windows is repainted because the image is not 'rasterized'.

    Does it answer your question ?
    Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension
    • Proposed as answer by FremyCompany [MSFT] Thursday, August 20, 2009 2:12 PM
    • Marked as answer by Dudeson Thursday, August 20, 2009 4:04 PM
    Thursday, August 20, 2009 2:12 PM

All replies

  • Not absolutely certain what you mean, but cpu is required to perform the actions that you code, so unmoving images (just there) have very little performance overhead.  The main performance bottleneck will be the movement that you code .  In particular there will be an overhead in performance for calling each Shapes.Move, to a lesser extent array indexing etc., even if the new position is unchanged from its current position, so don't Shapes.Move objects that are static.

    For performance you should 'optimise' the code that is repeating many times (e.g. inside loops) as much as possible.

    You can build small prototype programs to test performance of different approaches.  Since SmallBasic was not designed for high performance, careful programming is required to achieve the best results - I see this as a positive aspect since it encourages careful design, rather than letting you 'get away with' less efficient design.
    Wednesday, August 19, 2009 7:57 PM
    Moderator
  • no, i mean when you draw an image to the graphics window with graphicswindow.drawimage ... you know, like a brush. not shapes. that should suck the same amount of performance like theres just 1 drawn in the graphics window. right? (do you now understand what i mean?)
    ____ OR GET RAPED!
    Wednesday, August 19, 2009 8:00 PM
  • Please be clearer:

    You do a graphicswindow.drawimage and is this equivalent to 'just 1 drawn in the graphics window'? 

    Perhaps you can test the performance by trying with a test code, this will be a better guide than any any general comments I can give other than that every statement in you code will take cpu and moving, drawing graphics are probably among the heaviest.  Set some simple test code and do it a lot of times inside a loop and see how it behaves.
    Wednesday, August 19, 2009 8:18 PM
    Moderator
  • woops! i meant, like i did graphicswindow.drawimage 100 times, sucks the same amount of performance like 1 image drawn on the graphics window? (also with graphicswindow.drawimage)

    btw, yes, i can test that out. but its not that useful here, since i have a very good cpu... i want my game to run on slower systems too.. i cant test them on other systems atm..
    ____ OR GET RAPED!
    Wednesday, August 19, 2009 11:02 PM
  • You should never use raster operations lilke Drawxxx and Fillxxx because they are very slow.
    You should always prefer using AddImages, Addxxxx; in particular if you're doing many operations.

    As VJ has said, also avoid 'temporary' moves. Do only useful moves.
    Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension
    • Proposed as answer by FremyCompany [MSFT] Thursday, August 20, 2009 2:03 PM
    • Unproposed as answer by Dudeson Thursday, August 20, 2009 2:09 PM
    Thursday, August 20, 2009 2:03 PM
  • i need drawimage cuz i want the player to be over the "bloodspot" not the bloodspot over the player... and and using shapes.addellipse makes it also lag like ____...

    but you also didnt answer my question...
    Live for nothing, OR CODE FOR SOMETHING! (Happy now vijaye?^^)
    Thursday, August 20, 2009 2:09 PM
  • To answer your question, the drawig proccess cost is proportional to the amount of data to treat (if you draw 100 times an images, you'll have a cost nearly 100 times higher than drawing one image) but once the image is drawn, there should be no cost anymore.

    If you're using Addxxxx, there's a drawing cost every time the windows is repainted because the image is not 'rasterized'.

    Does it answer your question ?
    Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension
    • Proposed as answer by FremyCompany [MSFT] Thursday, August 20, 2009 2:12 PM
    • Marked as answer by Dudeson Thursday, August 20, 2009 4:04 PM
    Thursday, August 20, 2009 2:12 PM
  • yes, cuz there will be just about 1 image drawn on the graphics window at a time.. so i just needed to know how much performance an already drawn one sucks...

    thx man!
    Live for nothing, OR CODE FOR SOMETHING! (Happy now vijaye?^^)
    Thursday, August 20, 2009 2:13 PM