CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Jun 2009
    Posts
    100

    Is this possible with C?

    Ok a friend made a bet with me that I couldnt make a very basic pong replica in C that used less then 1 MB of HDD space and ran in less then 10MB of ram. CPU cycles isnt important in this case.

    I know you can make pretty small and fast things in C but is this even possible?

  2. #2
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: Is this possible with C?

    It's probably possible. Really depends what you mean by "basic". If you're going to go with ASCII art I'd say definitely. Even some basic graphics packages should allow you to stay under those limits, so long as you make sure everything is linked statically.

  3. #3
    Join Date
    Jun 2009
    Posts
    100

    Re: Is this possible with C?

    Quote Originally Posted by Lindley View Post
    It's probably possible. Really depends what you mean by "basic". If you're going to go with ASCII art I'd say definitely. Even some basic graphics packages should allow you to stay under those limits, so long as you make sure everything is linked statically.
    basic meaning rectangles for the paddles, a circle for the ball and two lines for the top and bottom edges kind of basic. xD

  4. #4
    Join Date
    Aug 2007
    Posts
    858

    Re: Is this possible with C?

    Honestly it should be trivial to meet those requirements.

  5. #5
    Join Date
    Jan 2009
    Posts
    1,689

    Re: Is this possible with C?

    I'll bet you can do it in half that. Didn't the atari only have like 128K in those cartridges?

  6. #6
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: Is this possible with C?

    I don't think the question is whether or not it can be done---obviously it can---but whether it would be easy to do with modern graphics libraries. There *is* a tendency towards bloat in some of them.

  7. #7
    Join Date
    Aug 2007
    Posts
    858

    Re: Is this possible with C?

    Well, a basic program using the Allegro graphics library yields a ~600KB exe with Allegro and the CRT statically linked, and uses 3-4MB of RAM. That's with no attempts at size optimization whatsoever, and there's really no way you should use another 400KB of exe space or 5+MB of memory to implement pong.

  8. #8
    Join Date
    Apr 2005
    Posts
    107

    Re: Is this possible with C?

    Quote Originally Posted by ninja9578 View Post
    I'll bet you can do it in half that. Didn't the atari only have like 128K in those cartridges?
    The Atari 2600 console system permitted an absolute maximum of 6KB in a ROM cartridge. Eventually that ceiling was broken to some degree by using bank switching in 4K blocks to swap in and out different 4KB blocks into the memory space.

    Still later and more advanced cartridges contained code to swap banks in smaller increments, and even have some onboard RAM, but classic, 2600 Pong (and the 4 or 5 other games that came with) all fit into a singl 6K ROM.

    Sure, the console itself had some additional features for display and sound interfacing, but the actual game code was tiny.

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