Would this be possible?

This is a discussion on Would this be possible? within the Game Programming forums, part of the General Programming Boards category; I want to use MFC to create a 2D tile based RPG. I'm going to divide the client rect into, ...

  1. #1
    Registered User Dual-Catfish's Avatar
    Join Date
    Sep 2001
    Posts
    802

    Would this be possible?

    I want to use MFC to create a 2D tile based RPG. I'm going to divide the client rect into, say 20 pieces (x and y) and load bitmaps (tiles) into each division. Then I'll have a character which can traverse the map, etc.

    Is this plausable? Will I be able to load the tiles and switch their position quickly enough.. or is this method too slow? Another thing, I need transparencies... especially for my character bitmap. Is there any way I can do this?

    Thanks in advance

  2. #2
    Registered User
    Join Date
    Dec 2001
    Posts
    421
    i can't see why it wouldn't be plausible. Though if you want speed, i'd avoid the use of MFC.... use straight win32 with GDI or even DirectX and you wont have any problems at all i dont think.

    good luck
    U.
    Quidquid latine dictum sit, altum sonatur.
    Whatever is said in Latin sounds profound.

  3. #3
    Used Registerer jdinger's Avatar
    Join Date
    Feb 2002
    Posts
    1,065
    I second that. I'd never used MFC for any graphics that need any speed.

    As far as dividing the screen like that. Yes. That's the basic
    concept behind dirty rect's.

    As far as for transparency (this is using GDI, if you go with
    DirectDraw then I can explain that too), You would have two pic's
    for your sprite. 1 would be a normal sprite with a black
    background. The second would be a mask of the original (ie: the
    body of the sprite would be in black and the background would
    be in white). Then you blit your mask with SRCAND and then blit your sprite on top of it with SRCPAINT.

  4. #4
    Registered User Dual-Catfish's Avatar
    Join Date
    Sep 2001
    Posts
    802
    Well, I'm not going for break-neck speeds here, I just want it to be playable on say... a 300mhz computer. What about smooth scrolling? Do you think this would be possible? Shift the bitmaps down, up, left or right one position in a smooth motion?

  5. #5
    Used Registerer jdinger's Avatar
    Join Date
    Feb 2002
    Posts
    1,065
    I don't see why you couldn't get smooth animations. Especially if
    you use dirty rectangles. I still would recommend NOT using MFC
    for any graphic apps. Why the need for MFC?

  6. #6
    Registered User Dual-Catfish's Avatar
    Join Date
    Sep 2001
    Posts
    802
    Especially if
    you use dirty rectangles.
    What exactly do you mean by dirty rectangles? Sorry, I'm kinda new to this type of programming..

  7. #7
    Registered User
    Join Date
    Apr 2002
    Posts
    133
    dirty rectangles, as defined by allegro demo:
    Store a list of what has changed on the screen to avoid redrawing pointless stuff (not word for word)
    flashdaddee.com rocks!!!

  8. #8
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,598
    DirectX/OpenGL is the way to go. I'd never use API or MFC for graphics. Why use that when DirectX/OpenGL are sitting there just waiting to be used?

    Both DirectX/OpenGL will take all the hassle out of trying to figure out the best low-level way to do things. Face it, they use the hardware via the HAL. The video manuf implements each function call in their drivers (according to MS specs) and then writes code to interface with their card. The hard-coded circuits on the video card (which used to be software assembly programs/code) are much faster than C, assembly, or anything else in software.

    So that's why perspective correct texture mapping is so fast. It's because DirectX does not do it - the hardware does - if it supports it. Take my advice and do graphics in DirectX or OpenGL. It may take some time/headaches to learn but before long you'll be cranking out professional looking graphics with little effort.

Popular pages Recent additions subscribe to a feed

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