Thread: Which is the better way to draw?

  1. #16
    In the Land of Diddly-Doo g4j31a5's Avatar
    Join Date
    Jul 2006
    Posts
    476
    Thanks for the insight guys. True, most of my algorithms are not optimal yet. I'm just trying to create the game (and the engine) from scratch. And I have just made the basic functionalities. Maybe I'll redesign my application after this.
    ERROR: Brain not found. Please insert a new brain!

    “Do nothing which is of no use.” - Miyamoto Musashi.

  2. #17
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Polymorphism won't kill your game if you use it correctly. It will destroy your game if you derive everythng from one base and have more than 3 or 4 levels of inheritance with virtual calls all leading back to the base class.

    But even then the difference is going to be minute. When it comes to polymorphism I have a general rule of 1 level of inheritance and to do more I would require the President's signature in order to be able to justify it.

    More than 1 level of inheritance might work good for GUIs and may be unavoidable, but in a game context it gets very confusing and only serves to obfuscate the code without any noticeable performance gains.

    As has been said anything can slow the game down if it is used incorrectly. If you test every object in your world for collision with an object that is nowhere near 90% of those objects, you are wasting 90% of your time checking collisions on objects that could never collide with each other in the next frame. Algorithms are the key and they must be efficient...notice I said efficient...not complex. Some of the most efficient algos are simple straightforward and easy to code while others may take a bit more. But if it's too complex for you to follow, it's probably too complex. I've run into this a few times myself.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. draw function HELP!!!
    By sunoflight77 in forum C++ Programming
    Replies: 1
    Last Post: 05-10-2005, 11:28 PM
  2. ray casting
    By lambs4 in forum Game Programming
    Replies: 62
    Last Post: 01-09-2003, 06:57 PM
  3. draw to a BITMAP* argument - allegro and objects again
    By MadHatter in forum Game Programming
    Replies: 13
    Last Post: 12-13-2002, 06:51 AM
  4. Draw Shapes.
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 08-19-2002, 09:22 AM
  5. Transparent Draw Question
    By GodLike in forum Windows Programming
    Replies: 5
    Last Post: 05-07-2002, 06:56 AM