CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2000
    Location
    India, Delhi
    Posts
    8

    PCMAN programming

    PC-MAN

    I am planning to program the exact classic version of PC-MAN in c++ (the classic version occupies only 17KB! which is a .com file) which i suppose made in 320x200 in 16 colour.

    I want to program this game in 320x200 in 16 colours DOS Mode. Now;

    1. How can i initialise this mode (ie. 300x200 in 16 colour) using the initgraph function in c++. please tell me how?

    2. Can i use getimage() / putimage() to capture my pc-man image defined in unsigned char[] array for animation. if yes, how? if no, why?

    3. In case if I use the double buffering technique, how can i use getimage() / putimage() for animation.

    I have already programmed a small part this game (i.e. movement of enemy in all the direction) using the image stored in unsigned char[] array under double buffering technique. But here i have to draw the background (i.e. path/maze) alongwith all animations every time, otherwise the movement of opponent would erase the background .

    For this particular reason i want to program the graphics using getimage() / putimage(). I want to draw the maze only once and then the animation follows. also please advise me which is the best way to program this game. i.e. normal onscreen mode or double buffering mode.

    i would like to add that i really appreciate the classic version of PC-MAN since this game occupies only 17KB! which is really unbelievable!!. How this program has been made. In assembly or in C++. I used to play this game a lot in my school time and now i want to program this my own. Kindly help.

    your help would be highly appreciated.

    thanks

  2. #2
    Join Date
    Jul 2003
    Location
    Maryland
    Posts
    762
    Not sure about your questions, but just fyi, your game won't be 17kb with C++. Just using main() will make it take up like 20kb or something like that. It can still be well under 100kb, but don't expect it to be 17kb. Also, I would bet the classic game was made in either assembly, C or maybe some other older language, but I doubt it was C++.

  3. #3
    Join Date
    Feb 2004
    Posts
    20
    As I remember, if you do DOS programming, you should:
    1. Keep yourself away from "initgraph".
    Use 0xa000 video-card address instead.
    And int 10h to switch graphic mode.
    2. Compile with "tiny" option of compiler.
    This will create you ".com" executable and not ".exe".
    3. Keep your data, code and stack segment size in 64K boundary.
    I mean avoid huge allocations and too deep recursions.

    If you follow this notation, you will get your 17K or with
    some effort even less.

    The only question is why DOS ?
    What is wrong with somewhat bigger app for Win32 ?
    Or may be XLib ?
    Or Swing from Java ?

  4. #4
    Join Date
    May 1999
    Location
    Southern California
    Posts
    12,266
    I think you should really evaluate whether you want to write a DOS program. If the only reason to use DOS is size, then there are other possibilities. Size is not a significant consideration for desktop systems and most laptops; it might be a consideration for PDA type systems, but even then, as far as I know, 100 KB is not a problem. I think any system in which size would be a significant consideration is not likely to be running DOS.

    Also, it helps to be clear about what you are asking about. The C++ langauge does not have an initgraph function, so I assume it is something provided by the compiler you are using.
    "Signature":
    My web site is Simple Samples.
    C# Corner Editor

  5. #5
    Join Date
    Feb 2004
    Posts
    20
    Info for kasracer: It`s Windows application that takes
    100K for empty main. DOS application, even .exe takes less.

    Answer to Sam: initgraph as well as line, plot etc. are
    coming with Borland C++ BGI library (pretty havy as for DOS).
    Because Borland compilers were most popular for DOS, it was
    easy to get confused about.

    In any case choosing DOS it seems good only for training.
    But it shouldn`t be better if you can show your program
    to somebody that can`t appreciate your educational
    efforts in DOS ?

  6. #6
    Join Date
    Jul 2003
    Location
    Maryland
    Posts
    762
    Originally posted by arkadi
    Info for kasracer: It`s Windows application that takes
    100K for empty main. DOS application, even .exe takes less.
    I know, I said it can still be well under 100kb.

  7. #7
    Join Date
    Aug 2002
    Posts
    78
    Four years ago I played Java versions of Space Invaders and Asteroids, and they looked better, and played just as well as, anything in an arcade 20 years ago.

    Go for Java and then you can dump it on the net, until the guys who own the rights come after you, of course.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured