win32 openGL?

This is a discussion on win32 openGL? within the C++ Programming forums, part of the General Programming Boards category; is it easier to make a 2d tile game were it can scroll in all directions with the main character ...

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    224

    win32 openGL?

    is it easier to make a 2d tile game were it can scroll in all directions with the main character in the middle of the screen at all times using win32 or OpenGL or DirectX and what one is most/least time consuming and which is easiest/hardest to understand/learn.

    hope you caught all that

    thx

  2. #2
    Registered User
    Join Date
    Mar 2002
    Posts
    1,595
    I suspect you'll find enthusiasts and detractors for any/all of the choices listed, and any other you come up with as well. If you have no restrictions, try one on for size and see how you like it. Ease and simplicity are very relative when writing code at this level, and any other for that matter. In reality, none of the things you mentioned are easy for someone new to C++, and an experienced programmer may be able to switch from one to the other without skipping a beat.

  3. #3
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    I would suggest win32 (GDI), because it's a good thing to know - and if you go with OpenGL or DirectX right away, you'll probably never go back and learn it. It's good enough for simple games (you can see some of mine at the link in my sig), although it's might take some getting used to (it's not that intuitive). But you CAN go through most of the basics of 2D game programming with it.

    BTW, what happened to all the people advocating Allegro and SDL?
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  4. #4
    Registered User
    Join Date
    Aug 2003
    Posts
    470
    There's absolutely no way you will be able to do this with the GDI. You can only just almost do with directx, and this is creating a large surface in video memory to pan on. You will most likely will use gdi calls in the map editor but even this could probably be improved by using directx/opengl.

  5. #5
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    >BTW, what happened to all the people advocating Allegro and SDL?
    I was sleeping.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  6. #6
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    >>There's absolutely no way you will be able to do this with the GDI.
    I disagree. There almost certainly IS a way, you just need to be efficient about figuring out what needs to be displayed and what doesn't. Although I haven't tried making a tile game before, I believe GDI is sufficient for most 2D needs other than alpha blending and crazy dynamic stuff (which can probably be closely simulated with pre-generated animations anyways). Besides which, GDI performance issues might force a lazy developer to figure out more efficient algorithms and better design.

    >>this is creating a large surface in video memory to pan on.
    Why not create several smaller surfaces (i.e. one for each unique tile) - or in GDI you might use HDC's or just HBITMAPS - and blit them to the primary surface when they scroll onto the screen, instead of drawing the whole thing in one go?

    >>but even this could probably be improved by using directx/opengl.
    The point wasn't optimization - it was that GDI can be used, and is a good thing to learn anyways. From your comments, I'd guess that you haven't learned GDI very well yourself. It's obvious that DirectX or OpenGL would offer significant performance enhancements (if the graphics ever get as complex as that), but... well, DUH. They're game libraries (well, OK so OpenGL is all-purpose. Whatever.). GDI is fairly simple compared to both though, IMO.

    >>I was sleeping.
    I meant, I haven't seen a lot of people promoting them lately. What happened?
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  7. #7
    Even death may die... Dante Shamest's Avatar
    Join Date
    Apr 2003
    Location
    Malaysia
    Posts
    970
    Hunter2 is right. You can certainly create a tile-based RPG game engine using just plain GDI. I've created one before and got a respectable 40+ FPS.

    They key is knowing which tiles require drawing and which don't. Of course when you're scrolling everything, you have no choice but to repaint the whole client area, but at other times when only a few sprites are moving, you need only redraw certain small areas.

    The problem with GDI is that it really becomes slow if you're doing a lot of things besides playing the game. E.g. compiling some program in the background or listening to Winamp.

  8. #8
    Intranasal Heroin User Xterria's Avatar
    Join Date
    Sep 2001
    Location
    Buffalo, NY
    Posts
    1,035
    use directdraw. its what i used for my sonic game and it was great.

  9. #9
    l'Anziano DavidP's Avatar
    Join Date
    Aug 2001
    Location
    Plano, Texas, United States
    Posts
    2,738
    Like Hunter and Dante have already said, you most certainly can make a tile-based game using GDI. I have seen plenty of them, in fact.

    >BTW, what happened to all the people advocating Allegro and SDL?

    Right here.

    Yeah! Go SDL! Woo! Seriously, try SDL. It is great. In fact I am using it right now on my own RTS project I am working on.
    My Website

    "Circular logic is good because it is."

  10. #10
    Registered User
    Join Date
    Aug 2003
    Posts
    470
    I disagree. There almost certainly IS a way, you just need to be efficient about figuring out what needs to be displayed and what doesn't.
    If your scrolling the entire background every frame, then it would be necessary to redraw everthing.

    Although I haven't tried making a tile game before, I believe GDI is sufficient for most 2D needs other than alpha blending and crazy dynamic stuff (which can probably be closely simulated with pre-generated animations anyways). Besides which, GDI performance issues might force a lazy developer to figure out more efficient algorithms and better design.
    The GDI is not too well designed from the standpoint of loading bitmaps, blitting them, etc. but it's not too hard to create wrappers of it. People make all sorts of mistakes such as forgetting to select in the old bitmap when your done, forgetting to delete the device context when it's done.

    >>this is creating a large surface in video memory to pan on.
    Why not create several smaller surfaces (i.e. one for each unique tile) - or in GDI you might use HDC's or just HBITMAPS - and blit them to the primary surface when they scroll onto the screen, instead of drawing the whole thing in one go?
    I do both. I have the tiles loaded into memory along with a paning surface. In reality it's not just a large surface but three for the different parallax levels(Only two are map layers , the other one is just a bitmap). But for a while I was only using one surface, and I did not think the scrolling was as smooth as a video arcade's. The scrolling is still not done with one very huge surface, it's actually done with a fairly large surface with calls resync the surface with map data when the boundaries cross over. Since this does not happen too often, it's not noticed. My video card is not all that good, however.

    >>but even this could probably be improved by using directx/opengl.
    The point wasn't optimization - it was that GDI can be used, and is a good thing to learn anyways. From your comments, I'd guess that you haven't learned GDI very well yourself.
    I am to the point where I can pretty much look up the arcane functions and create code. I understand the basic mechanisms of CreateCompatibleBitmap, LoadImage, and SelectObject. But that said, I will always create something overtop of the gdi code. Ok, one of the reasons why my map editor was little flickerly using gdi was that I had not overrid OnEraseBkgnd(this would occur when the user scrolled down very fast) but this is besides the point.


    It's obvious that DirectX or OpenGL would offer significant performance enhancements (if the graphics ever get as complex as that), but... well, DUH. They're game libraries (well, OK so OpenGL is all-purpose. Whatever.). GDI is fairly simple compared to both though, IMO.
    I don't think the simple argument holds here. I consent that if he was creating a map editor, he would most likely want to use MFC and the MFC's gdi code but this doesn't mean the bulk of the gdi's code will be any simpler. Once someone has written out the main abstractions for bitmap loading and blitting and directx initialization, I don't think gdi would have any advantage. If simplicity was the deciding factor, then the SDL or allegro are much more simpler to use.

  11. #11
    Registered User
    Join Date
    Aug 2003
    Posts
    470
    Ok, as a test, do you all think the gdi scrolling code on my map editor(not yet done) is sufficiently smooth enough for a fairly large screened game? I'm been kind of busy on other stuff so I haven't been able to work on it too much. Double clicking the tiles on the right side should bring up the properties for a given tile.
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    Oct 2001
    Posts
    224
    do things like allegro and SDL have many limitations that win32 or OpenGL or directX dont?

    i also remember reading somewhere that DirectX was hard and not all that user friendly. to use or learn.

    i have also been told that allegro was easy to learn and use... but i never really looked into it yet but i think i might soon.

    and one more how hard is it to use OpenGL to make a 2d 4 direction scroller? every tutorial i have seen for it is only enough 2d to understand how a shape is made then it goes into 3d for the rest of the 5 pages of tutorials... i thnk i want to learn OpenGL but if allegro doesnt have many limitations and is easier to use ill use it

    thx

  13. #13
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    >>If your scrolling the entire background every frame, then it would be necessary to redraw everthing.
    Given the speed of today's processors, I'd say that it's not a big deal. I'd assumed that you meant creating a huge surface to encompass the whole map and redraw the whole thing each frame.

    People make all sorts of mistakes such as forgetting to select in the old bitmap when your done, forgetting to delete the device context when it's done.
    That's where the wrapper comes in, like you said. Besides, it's better to get over all that now rather than miss it later.

    I did not think the scrolling was as smooth as a video arcade's.
    I wonder why. Maybe because the arcade is... *gasp* meant for gaming?

    Once someone has written out the main abstractions for bitmap loading and blitting and directx initialization, I don't think gdi would have any advantage.
    The point is to do the writing yourself - otherwise, you might as well use SDL or Allegro. Besides, you run into all that muck with reloading all your surfaces if you minimize, and stuff like that.

    I suppose there is something to what you're saying though; after writing a DirectDraw7 wrapper (with a similar interface to my GDI one), it was a fairly simple matter to port my Space Shooterz game to DirectX. It's just that the writing of the wrapper took a good deal more effort than writing the GDI wrapper.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  14. #14
    Registered User
    Join Date
    Aug 2003
    Posts
    470
    do things like allegro and SDL have many limitations that win32 or OpenGL or directX dont?
    Not really. They do different things, however. If you are doing 2D on windows with SDL or allegro, you most likely would eventually be using direct draw overtop of a layer. On the other hand, it's possible to use opengl with allegro and SDL.

    i also remember reading somewhere that DirectX was hard and not all that user friendly. to use or learn.
    I think so.

    I have also been told that allegro was easy to learn and use... but i never really looked into it yet but i think i might soon.
    This is true, I think. But as soon as you attempt something outside of the blitting surfaces, you might have a more difficult time. For example, if you were going to add printing support to map editor, you would want to use the gdi drivers.

    and one more how hard is it to use OpenGL to make a 2d 4 direction scroller? every tutorial i have seen for it is only enough 2d to understand how a shape is made then it goes into 3d for the rest of the 5 pages of tutorials... i thnk i want to learn OpenGL but if allegro doesnt have many limitations and is easier to use ill use it
    I'm not sure. You can definitely can use bitmap textures with display lists to achieve this effect, but I haven't tried.

  15. #15
    Registered User
    Join Date
    Oct 2001
    Posts
    224
    i think i will tryout OpenGL then... for now anyway... does anyone know were i can get a good OpenGL tutorial that deals with more 2d and such...

    i know a few good places with great tutorials but they just show you how to make a triange, then square, then straight into the 3d stuff... all the tutorials that do anything with bitmaps is placing them on a 3d box or someother.

    after thinking about it for a while i decided i might try DX9 and see how hard it would be to make a 2d game with it... then i found out that they got rid of DD (DirectDraw) in DX7. a bit more searching said there were still ways of making 2d games with DX8+ just a bit harder seeing as how you would need to learn 3D concepts and whatnot.

    i think i dont really want to use allegro anymore because from a post earlier in this thread they said that it was limited and for certain things i would have to use/learn openGL or something else
    to port to.

    thx for any and all help
    Last edited by c++.prog.newbie; 05-14-2004 at 07:30 PM.

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. opengl and networking on win32
    By viaxd in forum Windows Programming
    Replies: 7
    Last Post: 01-11-2006, 09:15 AM
  2. win32 or opengl
    By jaylc185 in forum Game Programming
    Replies: 8
    Last Post: 06-02-2005, 06:28 PM
  3. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 01:34 PM
  4. win32, openGL basecode
    By Perspective in forum Game Programming
    Replies: 6
    Last Post: 03-10-2003, 09:43 PM
  5. OpenGL .dll vs video card dll
    By Silvercord in forum Game Programming
    Replies: 14
    Last Post: 02-12-2003, 07:57 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21