Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Classic Games (Games) Programming

Man Creates Entire Game of Pong Inside a Single Commodore 64 Sprite (neowin.net) 67

"Pong on a Commodore 64 is one thing... but Pong in a single C64 sprite? That's uncharted territory," writes Slashdot reader segaboy81.

Neowin reports: The Commodore 64 is an iconic machine. For many of us boomers, it was our introduction to programming... Josip Retro Bits is a YouTube channel that specializes in fun challenges on old hardware like the Commodore 64. In an older video, Josip creates a game of Pong using Basic. On the surface, this doesn't sound very interesting, but it's a real challenge because Basic is very limited when compared to writing machine code. Basically, the C64 is perfectly capable of a game like Pong, but not really in Basic. Spoiler alert: he does it. However, a commenter on that video had a novel idea. How about creating an entire game of Pong in a single spite?
That's a 24 x 21 pixels object. ("It can be seen as a bigger programmable character that can be moved on hardware on steps of one pixel," explains one tech blog.) And another spoiler alert: he does it again.

Here's the repository for the "Tiny Pong" code. It's written in C, with functions like drawScreen() and batSound().

And about 18 minutes into the video, he not only plays a game of Pong inside the sprite — he simultaneously makes that sprite move around the screen like the ball in a game of Pong.
This discussion has been archived. No new comments can be posted.

Man Creates Entire Game of Pong Inside a Single Commodore 64 Sprite

Comments Filter:
  • by Volanin ( 935080 ) on Sunday March 27, 2022 @11:40AM (#62393781)

    Silly, curious and definitely news for nerds!
    Makes me want to fire up the old MSX and code some.

  • This reminds me of a tiny Break-Out clone which I wrote in BBC BASIC V, back in 1990: it ran in an icon on the RISC OS icon bar on the Archimedes computer (or on the Raspberry PI using RISC OS Open [riscosopen.org]), using co-operative multitasking so you can run several copies of the program at the same time.

    I quickly uploaded it here [gitlab.com].
  • by Osgeld ( 1900440 ) on Sunday March 27, 2022 @12:53PM (#62393915)

    The Commodore 64 is an iconic machine. For many of us boomers, it was our introduction to programming

    Quick google says "boomers" are from 1946 to 1964, the personal computer revolution was in the mid 70's so by 1982 you were in your 40's and joining the fad or just getting out of high school. Either way the original statement isn't that impressive as for most of your life computers were not accessible or there was 4 on the planet for the older crew

    • by mmell ( 832646 )
      I bought a C=64 for two hundred bucks when it hit the market. I was a buck Private in the US Army. I wasn't a boomer - in fact, I was a few years too young to be a hippie. I know I'm not Gen-X, Gen-Y, or any of those other types I'm constantly tellin' to get offa my lawn.
      Now, the C=64 was awesome - way better than the TRS-80 it replaced on my shelf. Playing with the SID chip was a blast, and once I had a running ML monitor (manually typed in from a magazine article; I'd have never been able to do it my
    • Gen X started early-mid 60s, so younger boomers would merely have been teens when this started.

    • Right. The C-64 was an introduction to programming for pretty much everyone at the time regardless of age, given how popular it was and how easy it was to get started. Literally kids could do it (I did! Programmed my first simple game at age 11...) I feel like most Gen-X coders got started on the C-64 at an early age in the 80s and early 90s. There were after-school computer clubs, magazines, radio programs that transmitted code as audio you could record onto a cassette tape(!) and the Commodore was the p

    • Comment removed based on user account deletion
  • by chrpai ( 806494 )
    This is cool but I have to ask why? The point of a sprite was to be a movable object block. You could cycle through them and move them making it look like a character walking as an example. In the case of pong it could be the ball. 24x21 where each pixel was transparent or a color say white. Now you simply update the X and Y and you having a moving ball. If you wanted 3 colors (plus transparent makes 4) you lost half the horizontal resolution. On the upside, sprites is what made me learn binary when
    • This is cool but I have to ask why?

      Turn in your nerd card.

    • It's similar to making a game in the favicon of a browser. Just fun.

    • For as long as one member of mankind has said, "Hmm, that's interesting," we've been challenging ourselves and see if we can. Anything of interest that was ever accomplished was at the cost of "Why?" in pursuit of "Can I?"
    • by AmiMoJo ( 196126 )

      I thought they meant that be made a game of Pong using busy one sprite for everything.

      It's possible on many systems by reprogramming the sprite as the screen is being drawn, "racing the beam" as it's called.

    • This is cool but I have to ask why?

      Because he can and because he wanted to. Sometimes explanations are that simple.

    • For the youtube views.

      That video has almost 6 thousand views! Possibly enough to fund the purchase of a new pizza.

  • The C64 does all the displaying and moving of the sprite in hardware. Hence moving it is trivial and not an accomplishment as the story seems to suggest. Putting Pong into a sprite is similarly easy: This is basically a small screen, no special properties. You just draw your pixels, maybe synced with the screen refresh and that is it.

    I guess whoever wrote that mindless sensationalist story has never heard of hardware sprites...

  • For you young punks, a sprite was an onscreen visual object. But because ram, including viideo ram, was insanely expensive, and processors slow, they built special hardware to shove limited-sized objects around screen. This offloaded general ram and processor needs.

    On the old Atari, they only had 4 sprites or something, which is why the original Adventure game sometimes had blinking objects -- with more than 4 dynamic objects in a particular room, they had to rotate through them, giving each a shared sli

  • Seems to me like you should be able to write a core pong game in maybe three or four dozen lines of basic code.
    • The basic interpreter on a c64 is extremely slow and unsuitable for video games. Games were usually written in assembler.

      • by mark-t ( 151149 )
        My own direct experience with BASIC games from the era is with the Apple2 and TRS80, both of whose BASICs could easily be used to implement pong, despite being slow, because it could be done in so few lines. I am surprised that the c64s own BASIC was not similar.
        • Well, it was obviously enough for a PONG game, since it was done. And i still have a few c64 games written mostly in BASIC. But it is a slow interpreter and it has no graphical commands.

          • by mark-t ( 151149 )
            For a game like pong, you could actually do it entirely using the text console. All you require is a way to control the cursor position. Did c64s BASIC not even have that?
        • by ncc74656 ( 45571 ) *

          One of Steve Wozniak's design goals for the Apple II was to be able to write a Breakout-like game for it in BASIC. The result, Little Brick Out, shipped with every Apple II for years.

    • by nuntius ( 92696 )

      Yes. I played pong and breakout style games that were written in Basic on the C64. Nothing by today's standards, but not exactly unheard of back then. This author got carried away in their excitement.

  • You go brother,. I need some United States people see my important Article for themâï https://www.mtmoviezworld.in/2... [mtmoviezworld.in]
  • Why on earth is it important that this was done by a man?
    • No one cares that it was a man, just that it was done.

      Why does the gender of who did it matter to you?

      • Jeez everyone thinks I was making a gender statement.
        Here’s a title: “Game of Pong Created Inside a Single Commodore 64 Sprite" Do you see what's missing? The stuff which is completely irrelevant. Just cos I’m a nerd doesn’t stop me from being a grammar nazi. What is it with the young these days - is everyone dyslexic or illiterate?
        • > Just cos I'm a nerd doesn't stop me from being a grammar nazi.

          1. Found the problem: You are whining about an issue no one gives a fuck about.

          2. If a woman had done this the title would read: Woman Creates Entire Game of Pong Inside a Single Commodore 64 Sprite.

          3. The /. editors do fuck all. They can't even be bothered to check for dupes for the past ~20 years yet you expect them to do the ONE job they actually have? Are you new here? /s

          > What is it with the young these days

          They have lots of proble

          • Hahah.. Yeah, I give it to you. Though I really hope they would NOT title it "Woman Creates ..." - it would be embarrassing for those of us geeks who don't see women as a different species. Personally, the only time that I think it would be relevant to use "man/woman/human" in a headline would be where such a thing would be extraordinary for a human to do it. Like "Man sets foot on moon". If it were a dog or - I don't know - a dolphin - that Created a game of Pong - then it would be remarkable, and wort
            • > My largest bugbear ...

              For me, two of the biggest problems with the /. "editors" (and I use the word loosely) are:

              * Including the entire article in the summary. Seriously? Like WTF.

              * Half-assed dupes. How the hell do you get THREE dupes in the SAME day???

              > 'm getting way too old for /.

              Me and me both buddy. Now get off my LAN. /s =P

    • Because if we wrote "Woman" in the title we'd be objectively wrong. Stop being such a triggered snowflake every time you see a gendered term. There's nothing important about it, you are just trying to make it important.

      Go back to tumblr.

      • Quite clearly not a copywriter. I do hope you find time to develop a modicum of civility and lose the toxic chip on your shoulder. I have no interest in siding either with your or against you in any pre-modern gender battles, and I do not see an opposite as the sole alternative to an assertion. You could learn little more grammar, hermeneutics, semantics, and narrative - especially as applied within journalism. Let me give you an example of a pithy, relevant, and focussed title to the article. "Game of P
        • You quite clearly are not a copywriter either. Of course people read what you wrote as a comment on gender, what you should have written was:
          "Why on earth is it important that this was done by a human?"
          or
          "Why on earth is it important that this was done?"
          Or something along those lines.
          As an aside, I don't think this was very challenging or important at all. He wrote the simplest of games and had it display on a tiny "window" (the sprite) 24x21 pixels in size. That's all.
          It's odd, and useless. I'm sure he had

  • During the summer of 1982, I had written a game in assembler for the Commodore VIC called "Intruder Scramble". It was a much simplified clone of an Arcade game named Scramble. The idea was suggested perhaps jokingly by my college roommate while we were playing Scramble in the SUNY Stony Brook Union Basement Arcade with something like "Hey Fern, you know computers, why don't you write one of these?" But also afterwards at the start of the summer I saw another young guy later who had written and sold his own

  • Now that's funny!

    No idea why none of the folks in the "group" back then didn't think of it, but it would be relatively easy to do.
    The commodore 64 had nicer sprites, and more of them, but the atari 800 had a different type of sprites that might be easier to do that with, and could easily be full screen sized without pixelating any more than you wanted if you don't exceed the resolution capability of it.
    The differences in sprites between the two was bigger than it might seem, but both had definite advantages
  • Comment removed based on user account deletion
    • by tsa ( 15680 )

      You never watch a movie or make a walk, just for fun?

      • Comment removed based on user account deletion
        • by tsa ( 15680 )

          I see your point, and I also find making other people happy important, but I need me-time as well. I love reading the paper in the morning, and playing adventure games. Some people need more me-time than others.

      • Comment removed based on user account deletion
        • by kackle ( 910159 )
          Dump her and write "Pong", man! I'm kidding...

          But seriously, happiness is where one finds it. If "happy" for him is exploring a coding exercise, learning something, rising to a challenge to accept the sense of accomplishment after a job well done and engaging/showing others (who then go on to discuss it on Slashdot), then why not?
          • Comment removed based on user account deletion
            • by kackle ( 910159 )
              I'd prefer Pong guy to be happy versus less happy--I'll assume it makes the world a better place.

              Dump her and write "Pong", man!

              That statement is ironic at so many levels that if it wasn't kind of painful, I would be laughing my ass out right now.

              Ouch. Relationships are often difficult; I wish you luck in yours.

  • Now he just has to find a way to get the ball to show Pong as well.

  • The guy doesn't do what the article states.

    First claim is he makes pong in basic.
    The 'BASIC' code he wrote was full of assembly-like routines and calls. It has very little to do with actual BASIC and BASIC is basically used as a framework for calling faster things. You could maybe argue that this is how you do BASIC on a C64, but it is not a clean BASIC program. It's an exercise in circumventing BASIC.

    The second claim is that he made PONG entirely inside a sprite.
    But the code actually runs on the CPU. The s

  • This is the last video in a series of miniaturized Pong games: A pong game inside a single PETSCII Character. https://www.youtube.com/watch?... [youtube.com]

God help those who do not help themselves. -- Wilson Mizner

Working...