Tag Archives: Uncategorized

The History of Pong | Code the Classics

via Raspberry Pi

One topic explored in Code the Classics from Raspberry Pi Press is the origin story and success of Pong, one of the most prominent games in early video game history.

‘The success of Pong led to the creation of Pong home consoles (and numerous unofficial clones) that could be connected to a television. Versions have also appeared on many home computers.’

Ask anyone to describe a game of table tennis and they’ll invariably tell you the same thing: the sport involves a table split into quarters, a net dividing the two halves, a couple of paddles, and a nice round ping-pong ball to bat back and forth between two players. Take a look at the 1972 video game Pong, however, and you’ll notice some differences. The table, for instance, is simply split in half and it’s viewed side-on, the paddles look like simple lines, and the ball is square. Yet no one – not even now – would have much trouble equating the two.

Back in the early 1970s, this was literally as good as it got. The smattering of low-powered arcade machines of the time were incapable of realistic-looking graphics, so developers had to be creative, hoping imaginative gamers would fill the gaps and buy into whatever they were trying to achieve. It helped enormously that there was a huge appetite for the new, emerging video game industry at that time. Nolan Bushnell was certainly hungry for more – and had he turned his nose up at Spacewar!, a space combat game created by Steve Russell in 1962, then Pong would never even have come about.

“The most important game I played was Spacewar! on a PDP-1 when I was in college,” he says, of the two-player space shooter that was popular among computer scientists and required a $120,000 machine to run. Although the visuals were nothing to write home about, the game was one of the first graphical video games ever made. It pitted two spaceships against each other and its popularity spread, in part, because the makers decided the code could be distributed freely to anyone who wanted it. “It was a great game, fun, challenging, but only playable on a very expensive computer late at night and the wee hours of the morning,” Nolan says. “In my opinion, it was a very important step.”

Nolan was so taken by Spacewar! that he made a version of the game with a colleague, Ted Dabney. Released in 1971, Computer Space allowed gamers to control a rocket in a battle against flying saucers, with the aim being to get more hits than the enemy in a set period of time. To make it attractive to players, it was placed in a series of colourful, space-age, moulded arcade cabinets. Nolan and Ted sold 1500 of them; even though they made just $500 from the venture, it was enough to spur them into continuing. They came up with the idea for Pong and created a company called Atari.

One of their best moves was employing engineer Al Alcorn, who had worked with Nolan at the American electronics company Ampex. Al was asked to create a table tennis game based on a similar title that had been released on the Magnavox Odyssey console, on the pretence that the game would be released by General Electric. In truth, Nolan simply wanted to work out Al’s potential, but he was blown away by what his employee came up with. Addictive and instantly recognisable, Atari realised Pong could be a major hit. The game’s familiarity with players meant it could be picked up and played by just about anyone.

Even so, Nolan had a hard time convincing others. Manufacturers turned the company down, so he visited the manager of a bar called Andy Capp’s in Sunnyvale, California and asked them to take Pong for a week. The manager soon had to call Nolan to tell him the machine had broken: it had become stuffed full of quarters from gamers who loved the game. By 1973, production of the cabinet was in overdrive and 8000 were sold. It led to the creation of a Pong home console which sold more than 150,000 machines. People queued to get their hands on one and Atari was on its way to become a legendary games company.

For Nolan, it was justification for his perseverance and belief. Suddenly, the man who had become interested in electronics at school, where he would spend time creating devices and connecting bulbs and batteries, was being talked of as a key player in the fledgling video game industry. But what did Nolan, Ted, Al, and the rest of the Atari team do to make the game so special? “We made it a good, solid, fun game to play,” says Nolan. “And we made it simple, easy, and quickly understood. Keeping things simple is more difficult to do than building something complex. You can’t dress up bad gameplay with good graphics.”

Making Pong

On the face of it, Pong didn’t look like much. Each side had a paddle that could be moved directly up and down using the controller, and the ball would be hit from one side to the other. The score was kept at the top of the screen and the idea was to force the opposing player to miss. It meant the game program needed to determine how the ball was hit and where the ball would go from that point. And that’s the crux of Pong’s success: the game encouraged people to keep playing and learning in the hope of attaining the skills to become a master.

When creating Pong, then, the designers had a few things in mind. One of the most important parts of the game was the movement of the paddles. This involved a simple, vertical rectangle that went up and down. One of the benefits Atari had when it created Pong was that it controlled not just the software but the hardware too. By building the cabinet, it was able to determine how those paddles should be moved. “The most important thing if you want to get the gameplay right is to use a knob to move the paddle,” advises Nolan. “No one has done a good Pong using touchscreens or a joystick.”

Look at a Pong cabinet close up – there are plenty of YouTube videos which show the game in action on the original machine – and you will see what Nolan means. You’ll notice that players turned a knob anticlockwise to move the paddle down, and clockwise to move it up. Far from being confusing, it felt intuitive.

Movement of the ball

With the paddles moving, Atari’s developers were able to look at the movement of the ball. At its most basic, if the ball continued to make contact with the paddles, it would constantly move back and forth. If it did not make contact, then it would continue moving in the direction it had embarked upon and leave the screen. At this stage, a new ball was introduced in the centre of the screen and the advantage was given to the player who had just chalked up a point. If you watch footage of the original Pong, you will see that the new ball was aimed at the player who had just let the ball go past. There was a chance he or she would miss again.

To avoid defeat, players had to be quite nifty on the controls and stay alert. Watching the ball go back and forth at great speed could be quite mesmerising as it left a blurred trail across the cathode ray tube display. There was no need to waste computing power by animating the ball because the main attention was focused on what would happen when it collided with the paddle. It had to behave as you’d expect. “The game did not exist without collisions of the ball to the paddle,” says Nolan.

Al realised that the ball needed to behave differently depending on where it hit the paddle. When playing a real game of tennis, if the ball hits the centre of the racket, it will behave differently from a ball that hits the edge. Certainly, the ball is not going to be travelling in a simple, straight path back and forth as you hit it; it is always likely to go off at an angle. This, though, is the trickiest part of making Pong “The ball should bounce up from an upper collision with more obtuse angles as the edge of the paddle is approached,” Nolan says. “This balances the risk of missing with the fact that an obtuse angle is harder to return.” This is what Pong is all about: making sure you hit the ball with the paddle, but in a manner that makes it difficult for the opposing player to return it. “A player wants the ball to be just out of reach for the opponent or be hard for him or her to predict.”

Read on…

This post is part of a much longer deep dive into the history of Pong in Code the Classics, our 224-page hardback book that not only tells the stories of some of the seminal video games of the 1970s and 1980s, but also shows you how to use Python and Pygame Zero to create your own games inspired by them, following examples programmed by Raspberry Pi founder Eben Upton.

In conjunction with today’s blog post, we’re offering £1 off Code the Classics when you order your copy between now and midnight Wednesday 26 Feb 2020 from the Raspberry Pi Press online store. Simply follow this link or enter the discount code PONG at checkout to get your copy for only £11, with free shipping in the UK.

Code the Classics is also available as a free download, although the physical book is rather delightful, so we really do recommend purchasing it.

The post The History of Pong | Code the Classics appeared first on Raspberry Pi.

Colour us bewildered

via Raspberry Pi

A Russian-speaking friend over at Farnell pointed us at this video. Apparently it’s been made by Amperot.ru, a Russian Raspberry Pi Approved Reseller, who are running a t-shirt giveaway. We got our hands on a subtitled video, and…words fail me. Please turn the sound up before you start watching.

Конкурс от Amperkot.ru. Розыгрыш фирменной футболки с Raspberry Pi (ENG & RUS Subtitles)

Следи за новостями 1) на сайте Amperkot.ru 2) в группе Вконтакте (vk.com/amperkot) 3) на канале в Телеграме (t.me/amperkot_ru)

We hope you enjoy this as much as we did. I have known Eben for more than twenty years now, and I’ve never seen him try to cram his whole fist into his mouth with mirth before.

Many thanks to Rapanui, who we wrote about here back in November. We suspect this will be as much of a surprise to them as it was to us. (The words coming out of Mart’s mouth are decidedly not his own.)

The post Colour us bewildered appeared first on Raspberry Pi.

Make a Spy Hunter-style scrolling road | Wireframe #31

via Raspberry Pi

Raspberry Pi’s own Mac Bowley shows you how to make the beginnings of a top-down driving game inspired by 1983’s Spy Hunter.

Spy Hunter, an arcade game from 1983

Spy Hunter was one of the very first games with both driving and shooting.

Spy Hunter

The 1983 arcade classic Spy Hunter put players at the wheel of a fictitious Interceptor vehicle and challenged them to navigate a vertically scrolling road, destroying enemy vehicles.

Here, I’ll show you how you can recreate the game’s scrolling road to use in your own driving games. The road will be created using the Rect class from Pygame, with the road built from stacked rectangles that are each two pixels high.

Making the scrolling road in Python

First, I create two lists; one to hold the pieces of road currently being drawn on screen, and another to hold a queue of pieces that will be added as the road scrolls. To create the scrolling road effect, each of the current pieces of road will need to move down the screen, while a new piece is added to the end of the list at position y = 0.

Pygame can schedule functions, which can then be called at set intervals – meaning I can scroll my road at a set frame rate. The scroll_road function will achieve this. First, I loop over each road piece, and move it down by two pixels. I then remove the first item in the queue list and append it to the end of the road. The Pygame clock is then set to call the function at intervals set by a frame_rate variable: mine is set to 1/60, meaning 60 frames per second.

Our top-down rolling road in Python

Our code snippet provides a solid basis for your own top-down driving game. All you need now are weapons. And a few other cars.

My road can either turn left or right, a random choice made whenever the queue is populated. Whichever way the road turns, it has to start from the same spot as the last piece in my queue. I can grab the last item in a list using -1 as an index and then store the x position; building from here will make sure my road is continuous. I use a buffer of 50 pixels to keep the road from moving off the edge of my screen – each time a turn is made, I check that the road doesn’t go beyond this point.

I want the turn amount to be random, so I’m also setting a minimum turn of 200 pixels. If this amount takes my car closer than the buffer, I’ll instead set the turn amount so that it takes it up to the buffer but no further. I do this for both directions, as well as setting a modifier to apply to my turn amount (-1 to turn left and 1 to turn right), which will save me duplicating my code. I also want to randomly choose how many pieces will be involved in my turn. Each piece is a step in the scroll, so the more pieces, the longer my turn will take. This will make sure I have a good mix of sharp and elongated turns in my road, keeping the player engaged.

Our rolling road Python code

Here’s Mac’s code snippet, which creates a winding road worthy of Spy Hunter in Python. To get it working on your system, you’ll need to install Pygame Zero. And to download the full code, go here.

Speeding up the game

To make things more exciting, the game can also be speeded up by decreasing the frame_rate variable. You could even gradually increase this over time, making the game feel more frantic the further you get.
Another improvement would be to make the turns more curvy, but make sure you’re comfortable with algebra before you do this!

Get your copy of Wireframe issue 31

You can read more features like this one in Wireframe issue 31, available now at Tesco, WHSmith, all good independent UK newsagents, and the Raspberry Pi Store, Cambridge.

Or you can buy Wireframe directly from Raspberry Pi Press — delivery is available worldwide. And if you’d like a handy digital version of the magazine, you can also download issue 31 for free in PDF format.

Make sure to follow Wireframe on Twitter and Facebook for updates and exclusive offers and giveaways. Subscribe on the Wireframe website to save up to 49% compared to newsstand pricing!

The post Make a Spy Hunter-style scrolling road | Wireframe #31 appeared first on Raspberry Pi.

Vulkan is coming to Raspberry Pi: first triangle

via Raspberry Pi

Following on from our recent announcement that Raspberry Pi 4 is OpenGL ES 3.1 conformant, we have some more news to share on the graphics front. We have started work on a much requested feature: an open-source Vulkan driver!

Vulkan

Standards body Khronos describes Vulkan as “a new generation graphics and compute API that provides high-efficiency, cross-platform access to modern GPUs”. The Vulkan API has been designed to better accommodate modern GPUs and address common performance bottlenecks in OpenGL, providing graphics developers with new means to squeeze the best performance out of the hardware.

First triangle

The “first triangle” image is something of a VideoCore graphics tradition: while I arrived at Broadcom too late to witness the VideoCore III version, I still remember the first time James and Gary were able to get a flawless, single-tile, RGB triangle out of VideoCore IV in simulation. So, without further ado, here’s the VideoCore VI Vulkan version.

First triangle out of Vulkan

Before you get too excited, remember that this is just the start of the development process for Vulkan on Raspberry Pi. Igalia has only been working on this new driver for a few weeks, and we still have a very long development roadmap ahead of us before we can put an actual driver in the hands of our users. So don’t hold your breath, and instead look forward to more news from us and Igalia as they make further development progress.

The post Vulkan is coming to Raspberry Pi: first triangle appeared first on Raspberry Pi.

Build your own first-person shooter in Unity

via Raspberry Pi

Raspberry Pi Press is back with a new publication: this time, it’s Wireframe’s time to shine, with Build Your Own First-Person Shooter in Unity.

BUILD YOUR OWN first-person shooter game in Unity || Wireframe magazine

Ever fancied creating your own first-person shooter game? Now you can with Wireframe’s brand new, 140-page bookazine, which positively heaves with tutorials and advice from expert video game developers!

Could you build a video game?

We’ve all had that moment of asking ourselves, “I wonder if I could do this?” when playing a video game. Whether as a child racing friends in Mario Kart, or in more recent years with vast open-world masterpieces, if you like games, you’ve probably thought about designing and building your own.

So, why don’t you?

With the latest publication from Wireframe and Raspberry Pi Press, you can learn how to use Unity, free software available to download online, to create your very own first-person shooter. You could build something reminiscent of DOOM, Wolfenstein, and all the other games you tried to convince your parents you were old enough to play when you really weren’t (who knew blurry, pixelated blood could be so terrifying?).

Build Your Own First-Person Shooter in Unity

Build Your Own First-Person Shooter in Unity leads you step-by-step through the process of making the game Zombie Panic – a frenetic battle for survival inside a castle heaving with the undead.

You’ll learn how to set up and use all the free software you’ll need, make enemies that follow and attack the player, create and texture 3D character models, and design levels with locked doors and keys.

You’ll also get tips and advice from experts, allowing you to progress your game making beyond the tutorials in the book.

Get your copy now!

Build Your Own First-Person Shooter in Unity is available now from the Raspberry Pi Press online store with free worldwide shipping, from the Raspberry Pi Store in Cambridge, and as a free download from the Wireframe website.

Wait, a free download?

Yup, you read correctly. Build Your Own First-Person Shooter in Unity can be downloaded for free as a PDF from the Wireframe website. We release free PDF versions of our books and magazines on the day they’re published; it means as many people as possible can get their hands on high-quality, up-to-date information about computing, programming and making.

However, when you buy our publications, you help us produce more great content, and you support the work of the Raspberry Pi Foundation to bring computing and digital making to people all over the world. We offer a variety of subscription options, including some terrific free gifts. And we make sure our publications are printed to feel good in your hands and look good on your bookshelf.

So, buy Build Your Own First-Person Shooter in Unity if you can – thank you, you’re amazing! And if not, grab the free PDF. Whichever you choose, we hope you make an awesome game. Don’t forget to share it with us on our social media channels.

The post Build your own first-person shooter in Unity appeared first on Raspberry Pi.

The Arduino Fundamentals Certification Exam is now available in Spanish and Italian!

via Arduino Blog

For enthusiasts, the Fundamentals Exam is the first tier in the Arduino Certification Program (ACP), designed to test entrants knowledge in Arduino-related electronics, programming, and physical computing.

The exam is available for everyone interested in officially certifying their skills and knowledge on Arduino, that could, for example, be referred to in a resume for academic or professional purposes.

Get your students, colleagues and friends certified!

The Fundamentals Exam is now also open to schools, academic institutions, universities, and companies that are interested in getting their students and employees officially certified!

The Fundamentals Certification offers the right balance of academic excellence and real world skills to give students the confidence and motivation they need to succeed both in educational and professional environments.

It is a great opportunity for companies who are interested in certifying their employees to refresh and add new skills to their repertoire.

Want to learn more? Additional information can be found here.

El examen de Certificación Fundamentals, está ahora disponible en Español e Italiano

Para entusiastas, el examen de Certificación Fundamentals, es el primer nivel del Programa de certificación Arduino (ACP), diseñado para evaluar el conocimiento de los participantes en electrónica, programación y computación física relacionadas con Arduino.

El examen está disponible para todos los interesados ??en certificar oficialmente sus habilidades y conocimientos en Arduino, que podrían, por ejemplo, mencionarse en un currículum con fines académicos o profesionales.

¡Certifica a tus estudiantes, colegas y equipo de trabajo!

La certificación también está disponible para escuelas, instituciones académicas, universidades y empresas que estén interesadas en certificar oficialmente a sus estudiantes y equipo de trabajo.

La Certificación Fundamentals ofrece el equilibrio adecuado entre excelencia académica y habilidades del mundo real, para brindar a los estudiantes la confianza y la motivación que necesitan para tener éxito tanto en entornos académicos como profesionales.

También es una gran posibilidad para compañías que están interesadas en certificar a su equipo de trabajo para actualizar y agregar nuevas habilidades a su repertorio.

Para saber más visita: https://store.arduino.cc/digital/cert_fundamentals.

Siamo lieti di annunciare che l’esame per la certificazione Arduino Fundamentals è da adesso disponibile anche in spagnolo e italiano! 

Desideriamo rendere accessibile la Certificazione alle scuole, alle istitutuzioni, università e aziende che siano interessate a certificare ufficialmente i propri studenti e dipendenti! La certificazione Arduino Fundamentals offre il giusto equilibrio fra l’acquisizione di abilità accademiche e lavorative, fornendo agli studenti la sicurezza e la motivazione necessarie per riuscire nel mondo accademico e professionale. E’ inoltre un increndibile possibilità per le aziende interessate ad aggionarne, migliorare e/o accrescere le capacità dei propri dipendenti.

Per saperne di più, visitate: https://store.arduino.cc/digital/cert_fundamentals.