Post Syndicated from Bruce Schneier original https://www.schneier.com/blog/archives/2021/09/hacker-themed-board-game.html
Post Syndicated from Bruce Schneier original https://www.schneier.com/blog/archives/2021/07/friday-squid-blogging-squid-related-game.html
It’s called “Squid Fishering.”
As usual, you can also use this squid post to talk about the security stories in the news that I haven’t covered.
Read my blog posting guidelines here.
Post Syndicated from Bruce Schneier original https://www.schneier.com/blog/archives/2021/02/us-cyber-command-valentines-day-cryptography-puzzles.html
The US Cyber Command has released a series of ten Valentine’s Day “Cryptography Challenge Puzzles.”
Post Syndicated from Bruce Schneier original https://www.schneier.com/blog/archives/2021/01/including-hackers-in-nato-wargames.html
This essay makes the point that actual computer hackers would be a useful addition to NATO wargames:
The international information security community is filled with smart people who are not in a military structure, many of whom would be excited to pose as independent actors in any upcoming wargames. Including them would increase the reality of the game and the skills of the soldiers building and training on these networks. Hackers and cyberwar experts would demonstrate how industrial control systems such as power supply for refrigeration and temperature monitoring in vaccine production facilities are critical infrastructure; they’re easy targets and should be among NATO’s priorities at the moment.
Diversity of thought leads to better solutions. We in the information security community strongly support the involvement of acknowledged nonmilitary experts in the development and testing of future cyberwar scenarios. We are confident that independent experts, many of whom see sharing their skills as public service, would view participation in these cybergames as a challenge and an honor.
Post Syndicated from Ignacio Riesgo original https://aws.amazon.com/blogs/compute/improving-and-securing-your-game-binaries-distribution-at-scale/
This post is contributed by Yahav Biran | Sr. Solutions Architect, AWS and Scott Selinger | Associate Solutions Architect, AWS
One of the challenges that game publishers face when employing CI/CD processes is the distribution of updated game binaries in a scalable, secure, and cost-effective way. Continuous integration and continuous deployment (CI/CD) processes enable game publishers to improve games throughout their lifecycle.
Often, CI/CD jobs contain minor changes that cause the CI/CD processes to push a full set of game binaries over the internet. This is a suboptimal approach. It negatively affects the cost of development network resources, customer network resources (output and input bandwidth), and the time it takes for a game update to propagate.
This post proposes a method of optimizing the game integration and deployments. Specifically, this method improves the distribution of updated game binaries to various targets, such as game-server farms. The proposed mechanism also adds to the security model designed to include progressive layers, starting from the Amazon EC2 instance that runs the game server. It also improves security of the game binaries, the game assets, and the monitoring of the game server deployments across several AWS Regions.
Why CI/CD in gaming is hard today
Game server binaries are usually a native application that includes binaries like graphic, sound, network, and physics assets, as well as scripts and media files. Game servers are usually developed with game engines like Unreal, Amazon Lumberyard, and Unity. Game binaries typically take up tens of gigabytes. However, because game developer teams modify only a few tens of kilobytes every day, frequent distribution of a full set of binaries is wasteful.
For a standard global game deployment, distributing game binaries requires compressing the entire binaries set and transferring the compressed version to destinations, then decompressing it upon arrival. You can optimize the process by decoupling the various layers, pushing and deploying them individually.
In both cases, the continuous deployment process might be slow due to the compression and transfer durations. Also, distributing the image binaries incurs unnecessary data transfer costs, since data is duplicated. Other game-binary distribution methods may require the game publisher’s DevOps teams to install and maintain custom caching mechanisms.
This post demonstrates an optimal method for distributing game server updates. The solution uses containerized images stored in Amazon ECR and deployed using Amazon ECS or Amazon EKS to shorten the distribution duration and reduce network usage.
How can containers help?
Dockerized game binaries enable standard caching with no implementation from the game publisher. Dockerized game binaries allow game publishers to stage their continuous build process in two ways:
- To rebuild only the layer that was updated in a particular build process and uses the other cached layers.
- To reassemble both packages into a deployable game server.
The use of ECR with either ECS or EKS takes care of the last mile deployment to the Docker container host.
Larger application binaries mean longer application loading times. To reduce the overall application initialization time, I decouple the deployment of the binaries and media files to allow the application to update faster. For example, updates in the application media files do not require the replication of the engine binaries or media files. This is achievable if the application binaries can be deployed in a separate directory structure. For example:
Containerized game servers deployment on EKS
The application server can be deployed as a single Kubernetes pod with multiple containers. The engine media (/opt/local/engine-media), the application (/opt/local/app), and the application media (/opt/local/app-media) spawn as Kubernetes initContainers and the engine binary (/opt/local/engine) runs as the main container.
Applying multi-stage game binaries builds
In this post, I use Docker multi-stage builds for containerizing the game asset builds. I use AWS CodeBuild to manage the build and to deploy the updates of game engines like Amazon Lumberyard as ready-to-play dedicated game servers.
Using this method, frequent changes in the game binaries require less than 1% of the data transfer typically required by full image replication to the nodes that run the game-server instances. This results in significant improvements in build and integration time.
I provide a deployment example for Amazon Lumberyard Multiplayer Sample that is deployed to an EKS cluster, but this can also be done using different container orchestration technology and different game engines. I also show that the image being deployed as a game-server instance is always the latest image, which allows centralized control of the code to be scheduled upon distribution.
This example shows an update of only 50 MB of game assets, whereas the full game-server binary is 3.1 GB. With only 1.5% of the content being updated, that speeds up the build process by 90% compared to non-containerized game binaries.
For security with EKS, apply the imagePullPolicy: Always option as part of the Kubernetes best practice container images deployment option. This option ensures that the latest image is pulled every time that the pod is started, thus deploying images from a single source in ECR, in this case.
- Read through the following sample, a multiplayer game sample, and see how to build and structure multiplayer games to employ the various features of the GridMate networking library.
- Create an AWS CodeCommit or GitHub repository (multiplayersample-lmbr) that includes the game engine binaries, the game assets (.pak, .cfg and more), AWS CodeBuild specs, and EKS deployment specs.
- Create a CodeBuild project that points to the CodeCommit repo. The build image uses aws/codebuild/docker:18.09.0: the built-in image maintained by CodeBuild configured with 3 GB of memory and two vCPUs. The compute allocated for build capacity can be modified for cost and build time tradeoff.
- Create an EKS cluster designated as a staging or an integration environment for the game title. In this case, it’s multiplayersample.
The binaries build Git repository
The Git repository is composed of five core components ordered by their size:
- The game engine binaries (for example, BinLinux64.Dedicated.tar.gz). This is the compressed version of the game engine artifacts that are not updated regularly, hence they are deployed as a compressed file. The maintenance of this file is usually done by a different team than the developers working on the game title.
- The game binaries (for example, MultiplayerSample_pc_Paks_Dedicated). This directory is maintained by the game development team and managed as a standard multi-branch repository. The artifacts under this directory get updated on a daily or weekly basis, depending on the game development plan.
- The build-related specifications (for example, buildspec.yml and Dockerfile). These files specify the build process. For simplicity, I only included the Docker build process to convey the speed of continuous integration. The process can be easily extended to include the game compilation and linked process as well.
- The Docker artifacts for containerizing the game engine and the game binaries (for example, start.sh and start.py). These scripts usually are maintained by the game DevOps teams and updated outside of the regular game development plan. More details about these scripts can be found in a sample that describes how to deploy a game-server in Amazon EKS.
- The deployment specifications (for example, eks-spec) specify the Kubernetes game-server deployment specs. This is for reference only, since the CD process usually runs in a separate set of resources like staging EKS clusters, which are owned and maintained by a different team.
The game build process
The build process starts with any Git push event on the Git repository. The build process includes three core phases denoted by
post_build in multiplayersample-lmbr/buildspec.yml
pre_buildphase unzips the game-engine binaries and logs in to the container registry (Amazon ECR) to prepare.
buildphase executes the
docker buildcommand that includes the multi-stage build.
Dockerfilespec file describes the multi-stage image build process. It starts by adding the game-engine binaries to the Linux OS,
ubuntu:18.04in this example.
ADD BinLinux64.Dedicated.tar /
- It continues by adding the necessary packages to the game server (for example, ec2-metadata, boto3, libc, and Python) and the necessary scripts for controlling the game server runtime in EKS. These packages are only required for the CI/CD process. Therefore, they are only added in the CI/CD process. This enables a clean decoupling between the necessary packages for development, integration, and deployment, and simplifies the process for both teams.
RUN apt-get install -y python python-pip
RUN apt-get install -y net-tools vim
RUN apt-get install -y libc++-dev
RUN pip install mcstatus ec2-metadata boto3
ADD start.sh /start.sh
ADD start.py /start.py
- The second part is to copy the game engine from the previous stage
--from=0to the next build stage. In this case, you copy the game engine binaries with the two
COPY --from=0 /BinLinux64.Dedicated/* /BinLinux64.Dedicated/
COPY --from=0 /BinLinux64.Dedicated/qtlibs /BinLinux64.Dedicated/qtlibs/
- Finally, the game binaries are added as a separate layer on top of the game-engine layers, which concludes the build. It’s expected that constant daily changes are made to this layer, which is why it is packaged separately. If your game includes other abstractions, you can break this step into several discrete Docker image layers.
ADD MultiplayerSample_pc_Paks_Dedicated /BinLinux64.Dedicated/
post_buildphase pushes the game Docker image to the centralized container registry for further deployment to the various regional EKS clusters. In this phase, tag and push the new image to the designated container registry in ECR.
- docker tag $IMAGE_REPO_NAME:$IMAGE_TAG
The game deployment process in EKS
At this point, you’ve pushed the updated image to the designated container registry in ECR (
/$IMAGE_REPO_NAME:$IMAGE_TAG). This image is scheduled as a game server in an EKS cluster as game-server Kubernetes deployment, as described in the sample.
In this example, I use
By using imagePullPolicy, you ensure that no one can circumvent Amazon ECR security. You can securely make ECR the single source of truth with regards to scheduled binaries. However, ECR to the worker nodes via kubelet, the node agent. Given the size of a whole image combined with the frequency with which it is pulled, that would amount to a significant additional cost to your project.
However, Docker layers allow you to update only the layers that were modified, preventing a whole image update. Also, they enable secure image distribution. In this example, only the layer
MultiplayerSample_pc_Paks_Dedicated is updated.
Proposed CI/CD process
The following diagram shows an example end-to-end architecture of a full-scale game-server deployment using EKS as the orchestration system, ECR as the container registry, and CodeBuild as the build engine.
Game developers merge changes to the Git repository that include both the preconfigured game-engine binaries and the game artifacts. Upon merge events, CodeBuild builds a multistage game-server image that is pushed to a centralized container registry hosted by ECR. At this point, DevOps teams in different Regions continuously schedule the image as a game server, pulling only the updated layer in the game server image. This keeps the entire game-server fleet running the same game binaries set, making for a secure deployment.
Try it out
I published two examples to guide you through the process of building an Amazon EKS cluster and deploying a containerized game server with large binaries.
- Spotable Game Server creates the cluster, Dockerizes a game server, and deploys it.
- Containerized Game Servers, emphasizes the CI/CD scenario by using Docker multi-stage build and uses CI tools for seamless deployments.
Adopting CI/CD in game development improves the software development lifecycle by continuously deploying quality-based updated game binaries. CI/CD in game development is usually hindered by the cost of distributing large binaries, in particular, by cross-regional deployments.
Non-containerized paradigms require deployment of the full set of binaries, which is an expensive and time-consuming task. Containerized game-server binaries with AWS build tools and Amazon EKS-based regional clusters of game servers enable secure and cost-effective distribution of large binary sets to enable increased agility in today’s game development.
In this post, I demonstrated a reduction of more than 90% of the network traffic required by implementing an effective CI/CD system in a large-scale deployment of multiplayer game servers.
Post Syndicated from Bruce Schneier original https://www.schneier.com/blog/archives/2019/06/rock-paper-scis.html
How in the world did I not know about this for three years?
Researchers at the University of Tokyo have developed a robot that always wins at rock-paper-scissors. It watches the human player’s hand, figures out which finger position the human is about to deploy, and reacts quickly enough to always win.
EDITED TO ADD (6/13): Seems like this is even older — from 2013.
Post Syndicated from Bruce Schneier original https://www.schneier.com/blog/archives/2019/05/more_attacks_ag.html
Last month, Kaspersky discovered that Asus’s live update system was infected with malware, an operation it called Operation Shadowhammer. Now we learn that six other companies were targeted in the same operation.
As we mentioned before, ASUS was not the only company used by the attackers. Studying this case, our experts found other samples that used similar algorithms. As in the ASUS case, the samples were using digitally signed binaries from three other Asian vendors:
- Electronics Extreme, authors of the zombie survival game called Infestation: Survivor Stories,
- Innovative Extremist, a company that provides Web and IT infrastructure services but also used to work in game development,
- Zepetto, the South Korean company that developed the video game Point Blank.
According to our researchers, the attackers either had access to the source code of the victims’ projects or they injected malware at the time of project compilation, meaning they were in the networks of those companies. And this reminds us of an attack that we reported on a year ago: the CCleaner incident.
Also, our experts identified three additional victims: another video gaming company, a conglomerate holding company and a pharmaceutical company, all in South Korea. For now we cannot share additional details about those victims, because we are in the process of notifying them about the attack.
Me on supply chain security.
Post Syndicated from Rob Zwetsloot original https://www.raspberrypi.org/blog/play-heverlees-sjoelen-win-beer/
Chances are you’ve never heard of the Dutch table shuffleboard variant Sjoelen. But if you have, then you’ll know it has a basic premise – to slide wooden pucks into a set of four scoring boxes – but some rather complex rules.
Uploaded by Grant Gibson on 2018-07-10.
It may seem odd that a game which relies so much on hand-eye coordination and keeping score could be deemed a perfect match for a project commissioned by a beer brand. Yet Grant Gibson is toasting success with his refreshing interpretation of Sjoelen, having simplified the rules and incorporated a Raspberry Pi to serve special prizes to the winners.
“Sjoelen’s traditional scoring requires lots of addition and multiplication, but our version simply gives players ten pucks and gets them to slide three through any one of the four gates within 30 seconds,” Grant explains.
As they do this, the Pi (a Model 3B) keeps track of how many pucks are sliding through each gate, figures how much time the player has left, and displays a winning message on a screen. A Logitech HD webcam films the player in action, so bystanders can watch their reactions as they veer between frustration and success.
Taking the plunge
Grant started the project with a few aims in mind: “I wanted something that could be transported in a small van and assembled by a two-person team, and I wanted it to have a vintage look.” Inspired by pinball tables, he came up with a three-piece unit that could be flat-packed for transport, then quickly assembled on site. The Pi 3B proved a perfect component.
“We used infrared (IR) sensors to detect when a puck passed through the gate bar to score a point,” Grant adds. “Because of the speed of the pucks, we had to poll each of the four IR sensors over 100 times per second to ensure that the pucks were always detected. Optimising the Python code to run fast enough, whilst also leaving enough processing power to run a full-screen web browser and HD webcam, was definitely the biggest software challenge on this project.”
The Raspberry Pi’s GPIO pins are used to trigger the dispensing of a can of Heverlee beer to the winner. These are stocked inside the machine, but building the vending mechanism was a major headache, since it needed to be lightweight and compact, and to keep the cans cool.
No off-the-shelf vending unit offered a solution, and Grant’s initial attempts with stepper motors and clear laser-cut acrylic gears proved disastrous. “After a dozen successful vends, the prototype went out of alignment and started slicing through cans, creating a huge frothy fountain of beer. Impressive to watch, but not a great mix with electronics,” Grant laughs.
Instead, he drew up a final design that was laser‑cut from poplar plywood. “It uses automotive central locking motors to operate a see-saw mechanism that serve the cans. A custom Peltier-effect heat exchanger, and a couple of salvaged PC fans, keep the cans cool inside the machine,” reveals Grant.
“I’d now love to make a lightweight version sometime, perhaps with a folding Sjoelen table and pop-up scoreboard screen, that could be carried by one person,” he adds. We’d certainly drink to that.
More from The MagPi magazine
Subscribe to The MagPi on a monthly, quarterly, or twelve-monthly basis to save money against newsstand prices!
Twelve-month print subscribers get a free Raspberry Pi 3A+, the perfect Raspberry Pi to try your hand at some of the latest projects covered in The MagPi magazine.
Post Syndicated from Alex Bate original https://www.raspberrypi.org/blog/handheld-text-based-adventure-gaming-with-quest-smith/
Play text-based adventure games that print out in real time, with Quest Smith: the Raspberry Pi Zero W–driven handheld gaming device from Bekir Dağ.
Quest Smith is a raspberry pi zero driven thermal printing text based game. In each level, it gives you options to choose so every game is different than the other one.
Text-based adventure games
Today I learned:
Around 1975, Will Crowther, a programmer and an amateur caver, wrote the first text adventure game, Adventure (originally called ADVENT because a filename could only be six characters long in the operating system he was using, and later named Colossal Cave Adventure).
But I’m sure you already knew that.
According to the internet, text-based games in their most simple form are video games that use text instead of graphics to let players progress. You read the description of your surroundings and choose from a set of options, or you type in your next step and hope the game understands what you’re talking about.
We have a conversation going in our team right now about whether the term ‘text-based games’ is solely used for video games of this nature, or whether choose your own adventure books also fall into the category of text-based games. Leave your thoughts in the comments.
After encountering a similar handheld gaming device in a Berlin games museum, Bekir Dağ decided to build his own using a Raspberry Pi Zero W.
For Quest Smith’s body, Bekir Dağ designed a 3D print, and he provides the STL files for free on Thingiverse. And for the inner workings?
A Raspberry Pi Zero W fits snugly into the body alongside a thermal printer, a battery, and various tactile buttons. The battery is powered by a solar panel mounted on the outer shell, and all components are connected to a TP4056 board that allows the battery to power the Pi.
The Quest Smith software is still somewhat of a work-in-progress. While users can build Quest Smith today and start playing, Bekir has put out the call for the community to submit their own parts of the story.
Each level requires two versions of the story, which makes the possiblities grow exponentially. So it will be very difficult for me to finish a single story by myself. For the player to reach level 9, we will need to have 1023 story parts to be written. If you can help me with that, it would be amazing!
To see more of Quest Smith’s build process, find the files to make your own device, and instructions on how to contribute toward the story, visit the Quest Smith Hackster.io page.
More text-based adventuring with Python
If you’re interested in writing your own text-based adventure game in Python, we’ve got a free online course available in which you can learn about object-oriented programming while creating a text-based game. And for a briefer intro, check out Wireframe magazine issue 6, where game developer Andrew Gillett explains how to make a simple Python text adventure.
The post Handheld text-based adventure gaming with Quest Smith appeared first on Raspberry Pi.
Post Syndicated from Christina Foust original https://www.raspberrypi.org/blog/raspberry-pi-escape-room/
A few Mondays ago, the Raspberry Pi North America team visited a very special, Raspberry Pi–powered Escape Room in San Francisco. Run by Palace Games, the Edison Escape Room is an immersive experience full of lights, sensors, and plenty of surprises. This is the team’s story of how they entered, explored, and ultimately escaped this room.
At World Maker Faire this year, our very own social media star Alex Bate met Jordan Bunker, one of the Production Artists at Palace Games. Emails were sent, dates arranges, and boom, the Raspberry Pi North America team had to face the Edison Escape Room!
In case you’re not familiar, an escape room is a physical adventure game in which players solve a series of puzzles and riddles using clues, logic, and strategy to complete the game’s objectives. Many escape room designers use physical computing to control the many sensors and triggers involved in the player experience.
The team vs Edison
Upon entering the Edison Escape Room, my team and I quickly realized that we were within a complex system built like a giant computer! So even though it was our first-ever time in an escape room, that would not be a disadvantage for us.
Our goal was to accomplish a variety of tasks, including solving many puzzles, looking for hidden clues when anything could be a clue, completing circuits, moving with the floor, and getting a bit of a workout.
The true test, however, was how well we communicated and worked with each other — which we did an awesome job at: at times we split up the work to effectively figure out the many different puzzles and clues; there was a lot “try it this way”, “maybe it means this”, and “what if it’s supposed to go that way” being yelled across the room. Everyone had their Edison thinking hat on that day, and we were so ecstatic when we completed the last challenge and finally escaped!
The inner workings
After escaping the room, we got the chance to explore behind the scenes. We found a local network of many Raspberry Pis that are coordinated by a central Raspberry Pi server. The Python Banyan framework is the connective tissue between the Raspberry Pis and their attached components.
The framework facilitates the communication between the Pis and the central server via Ethernet. The Raspberry Pis are used to read various types of sensors and to drive actuators that control lights, open doors, or play back media. And Raspberry Pis also drive the control panels that employees use to enter settings and keep tabs on the game.
“Raspberry Pi keeps us going. It’s the heart and soul of our rooms.” – Elizabeth Sonder, Design Engineer & Production Manager
We highly recommend heading over to Palace Games and exploring one of their many escape rooms. It’s a great team-building exercise and definitely allows you to learn a lot about the people you work with. Thank you to the Palace Games team for hosting us, and we hope to return and escape one of their rooms again soon!
The post Raspberry Pi vs a Raspberry Pi–powered escape room appeared first on Raspberry Pi.
Post Syndicated from Bruce Schneier original https://www.schneier.com/blog/archives/2018/10/defeating_the_d.html
Two teenagers figured out how to beat the “Deal or No Deal” arcade game by filming the computer animation and then slowing it down enough to determine where the big prize was hidden.
Post Syndicated from Rob Zwetsloot original https://www.raspberrypi.org/blog/magpi-74-build-a-raspberry-pi-laptop/
Hey folks! Rob from The MagPi here with the good news that a brand new issue is out today, with a slightly new look. The MagPi 74 shows you how to build a Pi‑powered laptop, and gives tips on how to recycle an old laptop to use with Pi.
We’ve got a pretty simple, tiny laptop build that you can follow along with, which will easily slip into your pocket once it’s completed. We also cover the basic Raspberry Pi Desktop experience, in case you fancy installing the x86 version to bring new life to an old laptop.
Welcome, foolish mortals…
I’m also very happy to announce that The MagPi Halloween projects feature is back this year! Put together by yours truly, Haunted Halloween Hacks should get you in the mood for the spookiest time of the year. October is the only month of the year that I’m allowed to make puns, so prepare yourself for some ghastly groaners.
Still want more?
On top of all that, you can find more fantastic guides on making games in Python and in C/C++, along with our brand new Quickstart guide, a review of the latest Picade, and more inspiring projects than you can shake a Pi Zero at.
Get The MagPi 74
You can get The MagPi 74 today from WHSmith, Tesco, Sainsbury’s, and Asda. If you live in the US, head over to your local Barnes & Noble or Micro Center in the next few days for a print copy. You can also get the new issue online from our store, or digitally via our Android or iOS apps. And don’t forget, there’s always the free PDF as well.
Rolling subscription offer!
Want to support the Raspberry Pi Foundation and the magazine? You can now take out a monthly £5 subscription to the magazine, effectively creating a rolling pre‑order system that saves you money on each issue.
You can also take out a twelve-month print subscription and get a Pi Zero W plus case and adapter cables absolutely free! This offer does not currently have an end date.
We need you!
Issue 75 is next month, and we’re planning to showcase 75 amazing Raspberry Pi projects! We need your help to vote for the top 50, so please head to the voting page and choose your favourite project. Click on a project name to cast your vote for that project.
Post Syndicated from Eben Upton original https://www.raspberrypi.org/blog/learn-to-write-games-for-the-bbc-micro-with-eben/
Long-time fans of the Raspberry Pi will know that we were inspired to make a programmable computer for kids by our own experiences with a machine called the BBC Micro, which many of us learned with in the 1980s.
This post is the first of what’s going to be an irregular series where I’ll walk you through building the sort of game we used to play when we were kids. You’ll need a copy of BeebEm (scroll down for a Linux port if you’re using a Pi – but this tutorial can be carried out on a PC or Mac as well as on an original BBC Micro if you have access to one).
I’m going to be presenting the next game in this series, tentatively titled Eben Goes Skiing, at the Centre for Computing History in Cambridge at 2pm this afternoon – head on down if you’d like to learn how to make scrolling ascii moguls.
We’re going to build a simple helicopter game in BBC BASIC. This will demonstrate a number of neat features, including user-defined characters, non-blocking keyboard input using INKEY, and positioning text and graphics using PRINT TAB.
Let’s start with user-defined characters. These provide us with an easy way to create a monochrome 8×8-pixel image by typing in 8 small numbers. As an example, let’s look at our helicopter sprite:
Each column pixel position in a row is “worth” a different power of 2, from 1 for the rightmost pixel up to 128 for the leftmost. To generate our 8 numbers, we process one row at a time, adding up the value for each occupied pixel position. We can now create custom character number 226 using the VDU 23 command. To display the character, we change to a graphics mode using the MODE command and display it using the PRINT command.
Type the following:
10MODE 2 70VDU 23,226,0,248,32,116,126,116,112,0 RUN PRINT CHR$(226)
You should see the little helicopter on the screen just above your prompt. Let’s define some more characters for our game, with character numbers 224 through 229. These represent leftward and rightward flying birds, a rightward flying helicopter, the surface of the sea, and a landing pad.
Type the following:
50VDU 23,224,0,14,12,104,16,28,8,0 60VDU 23,225,0,112,48,22,8,56,16,0 80VDU 23,227,0,31,4,46,126,46,14,0 90VDU 23,228,0,102,255,255,255,255,255,255 100VDU 23,229,255,255,0,0,0,0,0,0
Trying running your program and using print to view the new characters!
Now we’re ready to use our sea and platform characters to build the game world. Mode 2 on the BBC Micro has 20 character positions across, and 32 down. We’ll draw 20 copies of the sea character in row 30 (remember, rows and columns are numbered from zero) using a FOR loop and the PRINT TAB command, and pick a random position for the platform using the RND() function.
Type the following:
110FOR I%=0 TO 19 120PRINT TAB(I%,30) CHR$(228); 130NEXT 140P%=RND(20)-1 150PRINT TAB(P%,30) CHR$(229); RUN
You should see something like this:
Don’t worry about that cursor and prompt: they won’t show up in the finished game.
It’s time to add the helicopter. We’ll create variables X% and Y% to hold the position of the helicopter, and Z% to tell us if it last moved left or right. We’ll initialise X% to a random position, Y% to the top of the screen, and Z% to zero, meaning “left”. We can use PRINT TAB again to draw the helicopter (either character 226 or 227 depending on Z%) at its current position. The whole thing is wrapped up in a REPEAT loop, which keeps executing until the helicopter reaches the ground (in row 29).
Type the following:
160X%=RND(20)-1:Y%=0:Z%=0 180REPEAT 260PRINT TAB(X%,Y%) CHR$(226+Z%); 290UNTIL Y%=29 RUN
You’ll see the helicopter sitting at the top of the screen.
We’re almost there: let’s give our helicopter the ability to move left, right and down. On each trip round the loop, we move down one row, and use the INKEY() function to read the Z and X keys on the keyboard. If Z is pressed, and we’re not already at the left of the
screen, we move one column left. If X is pressed, and we’re not already at the right of the screen, we move one column right.
Type the following:
210IF INKEY(-98) AND X%>0 THEN X%=X%-1:Z%=0 220IF INKEY(-67) AND X%<19 THEN X%=X%+1:Z%=1 230Y%=Y%+1 RUN
You should see something like this:
The game is much, much too fast to control, and the helicopter leaves trails: not surprising, as we didn’t do anything to erase the previous frame. Let’s use PRINT TAB to place a “space” character over the previous position of the helicopter, and add an empty FOR loop to slow things down a bit.
Type the following:
190PRINT TAB (%,Y%)""; 280FOR I%=1 TO 200:NEXT RUN
Much better! This is starting to feel like a real game. Let’s finish it off by:
- Adding a bird that flies back and forth
- Detecting whether you hit the pad or not
- Getting rid of the annoying cursor using a “magic” VDU 23 command
- Putting an outer loop in to let you play again
Type the following:
20REPEAT 30CLS 40VDU 23,1,0;0;0;0; 170A%=RND(18):B%=10:C%=RND(2)-1 200PRINT TAB(A%,B%) ""; 240A%=A%+2*C%-1 250IF A%=0 OR A%=19 THEN C%=1-C% 270PRINT TAB(A%,B%) CHR$(224+C%); 300IF X%=P% PRINT TAB(6,15) "YOU WIN" ELSE PRINT TAB(6,15) "YOU LOSE" 310PRINT TAB(4,16) "PRESS SPACE" 320REPEAT UNTIL INKEY(-99) 330UNTIL FALSE RUN
And here it is in all its glory.
You might want to try adding some features to the game: collision with the bird, things to collect, vertical scrolling. The sky’s the limit!
I created a full version of the game, using graphics from our very own Sam Alder, for the Hackaday 1K challenge; you can find it here.
Here’s the full source for the game in one block. If you get errors when you run your code, type:
MODE 0 LIST
And compare the output very carefully with what you see here.
10MODE 2 20REPEAT 30CLS 40VDU 23,1,0;0;0;0; 50VDU 23,224,0,14,12,104,16,28,8,0 60VDU 23,225,0,112,48,22,8,56,16,0 70VDU 23,226,0,248,32,116,126,116,112,0 80VDU 23,227,0,31,4,46,126,46,14,0 90VDU 23,228,0,102,255,255,255,255,255,255 100VDU 23,229,255,255,0,0,0,0,0,0 110FOR I%=0 TO 19 120PRINT TAB(I%,30) CHR$(228); 130NEXT 140P%=RND(20)-1 150PRINT TAB(P%,30) CHR$(229); 160X%=RND(20)-1:Y%=0:Z%=0 170A%=RND(18):B%=10:C%=RND(2)-1 180REPEAT 190PRINT TAB(X%,Y%) " "; 200PRINT TAB(A%,B%) " "; 210IF INKEY(-98) AND X%>0 THEN X%=X%-1:Z%=0 220IF INKEY(-67) AND X%<19 THEN X%=X%+1:Z%=1 230Y%=Y%+1 240A%=A%+2*C%-1 250IF A%=0 OR A%=19 THEN C%=1-C% 260PRINT TAB(X%,Y%) CHR$(226+Z%); 270PRINT TAB(A%,B%) CHR$(224+C%); 280FOR I%=1 TO 200:NEXT 290UNTIL Y%=29 300IF X%=P% PRINT TAB(6,15) "YOU WIN" ELSE PRINT TAB(6,15) "YOU LOSE" 310PRINT TAB(4,16) "PRESS SPACE" 320REPEAT UNTIL INKEY(-99) 330UNTIL FALSE
Post Syndicated from Bruce Schneier original https://www.schneier.com/blog/archives/2018/08/hacking_the_mcd.html
Long and interesting story — now two decades old — of massive fraud perpetrated against the McDonald’s Monopoly sweepstakes. The central fraudster was the person in charge of securing the winning tickets.
Post Syndicated from Bruce Schneier original https://www.schneier.com/blog/archives/2018/08/using_in-game_p.html
Evidence that stolen credit cards are being used to purchase items in games like Clash of Clans, which are then resold for cash.
Post Syndicated from Alex Bate original https://www.raspberrypi.org/blog/raspberry-pi-recursive-backtracking/
Engineerish is back with another Raspberry Pi–based project that you didn’t know you needed until now.
Don’t already have a device around your home that, at the press of a button, prints something cool? Build one! Mine prints randomly generated mazes but why stop there? Thermal printer: https://www.adafruit.com/product/597 Source code: https://github.com/mattiasjahnke/rpi-maze-printer Recursive backtracking algorithm: https://en.wikipedia.org/wiki/Maze_generation_algorithm#Recursive_backtracker ———— Consider subscribing to the channel so you don’t miss out!
Mattias Jahnke, better known as Engineerish to his online followers, was asked by his nephew to draw labyrinth mazes for the youngster to complete. While the task was fun to do by hand, Mattias soon found himself wondering what code and technology he could use to automate it. He soon hit upon the idea of using a Raspberry Pi, a thermal printer, and the recursive backtracking algorithm to produce mazes.
What is recursive backtracking?
The latter of these links provides the following summary of backtracking:
Backtracking problems are solved one step at a time. Literally! Here’s the general algorithm:
1) Is where I am a solution?
2) No. OK, where can I go from here? If I can go somewhere, choose a place to go.
3) Go there.
5) Was that a solution? If yes, return true!
5) If there are remaining places to go, choose one and go to #3.
6) Out of places to go. Return false.
Building an automated maze printer
To fit the Raspberry Pi and printer, as well as an arcade button and a power supply, Engineerish built a custom wooden box.
This is me – only seconds away from realizing how mankind first discovered how to make a fire. They’ve must have been trying a cut a whole in a wooden box with a Dremel for a maze-generating raspberry pi project.
492 Likes, 17 Comments – Engineerish (@engineerish) on Instagram: “This is me – only seconds away from realizing how mankind first discovered how to make a fire….”
The arcade button is wired to GPIO pin 16, and pressing it starts a Python script that runs the recursive backtracking algorithm and lets the thermal printer produce the finished maze.
Endless fun for the whole fam! Randomly generated mazes with adjustable difficulty at the click of a button. Even though that “button” is currently an ssh connection to a raspberry pi, the execution of two python scripts with passed process arguments to set difficulty and nanoing source code to set the maze size. I’ll try to go full Windows Vista on the user friendlyness another day. For now – it works!
689 Likes, 40 Comments – Engineerish (@engineerish) on Instagram: “Endless fun for the whole fam! Randomly generated mazes with adjustable difficulty at the click of…”
Engineerish has provided the complete code for the project on his GitHub account, allowing everyone to try their hand at printing (and completing) these awesome mazes.
And be sure to also check out his Raspberry Pi Binary Clock, which we covered here on the blog in January.
The post Automatic mazes with Raspberry Pi and recursive backtracking appeared first on Raspberry Pi.
Post Syndicated from Alex Bate original https://www.raspberrypi.org/blog/raspberry-pi-summer-projects/
The sun is actually shining here in Cambridge, and with it, summer-themed Raspberry Pi projects are sprouting like mushrooms across our UK-based community (even though mushrooms don’t like hot weather…). So we thought we’d gather some of our favourite Pi-powered projects perfect for the sun-drenched outdoors.
Air quality monitors and solar radiation
With the sun out in all its glory, we’re spending far more time outside than is usual for UK summer. To protect yourself and your adventurous loved ones, you might want to build a Raspberry Pi device to monitor solar radiation.
“Solar radiation is the radiation, or energy, we get from the sun.” explains project designer Uladzislau Bayouski. “Measurements for solar radiation are higher on clear, sunny day and usually low on cloudy days. When the sun is down, or there are heavy clouds blocking the sun, solar radiation is measured at zero.”
To measure more health-related environmental conditions, you could build this air quality monitor and keep an eye on local pollution.
Maker Oliver Crask describes the project:
Data is collected by the particulates sensor and is combined with readings of temperature, humidity, and air pressure. This data is then transferred to the cloud, where it is visualised on a dashboard.
If you’ve been building your own hackable weather station using our free guide, these are also great add-ons to integrate into that project.
Automatic pet and plant feeders
While we’re spending our days out in the sun, we need to ensure that our pets and plants are still getting all the attention they need.
This automatic chicken feeder by Instructables user Bertil Vandekerkhove uses a Raspberry Pi to remotely control the release of chicken feed. No more rushing to get home to feed your feathered friends!
And while we’re automating our homes, let us not forget the plants! iPlanty is an automated plant-watering system that will ensure your favourite plant babies get all the moisture they need while you’re away from your home or office.
An automated Plant watering solution that waters my plant every day at 8:30
Electromagnetic bike shed lock
If, like me, you live in constant fear that your beloved bike may be stolen, this electromagnetic bike shed lock is the solution you need.
The lock system allows for only one user per lock at any one time, meaning that your bike needs to be removed before anyone else can use their RFID card to access the shed.
With so much sunlight available, now is the perfect time to build a time-lapse camera for your garden or local beauty spot. Alex D’s Zero W time-lapse HAT allows for some glorious cinematic sliding that’s really impressed us.
Slider settings: -960 mm drive distance -400 steps -28 seconds interval Camera settings (Canon EOS 550D): – Magic Lantern auto ettr – max ISO 1600 – max Exposure 10 seconds
Infrared laser tag
While it’s sunny and warm, why not make this Raspberry Pi Zero W laser tag for the kids…
…and then lock them outside, and enjoy a Pimms and a sit-down in peace. We’re here for you, suffering summer holiday parents. We understand.
Self-weighing smart suitcase
“We’re all going on a summer holiday”, and pj_dc’s smart suitcase will not only help you track of your case’s location, it’ll also weigh your baggage.
Four 50kg load cells built into the base of the case allow for weight measurement of its contents, while a GPS breakout board and antenna let you track where it is.
Our free resources
While they’re not all summer-themed, our free Raspberry Pi, Code Club, and CoderDojo resources will keep you and your family occupied over the summer months whenever you’ve had a little too much of the great outdoors. From simple Scratch projects through to Python and digital making builds, we’ve got something for makers of all levels and tastes!
Post Syndicated from Alex Bate original https://www.raspberrypi.org/blog/grand-theft-auto-radio/
Relive the San Andreas glory days with this Grand Theft Auto radio built by Raphaël Yancey.
With the “tuned” status LED. https://t.co/PuIi6sY78V
…and now I have Barracuda stuck in my head.
The music of GTA
Anyone who has played Grand Theft Auto knows that one of the best parts of the series is the radio stations: a mix of classic tunes and often comical DJ interludes make driving haphazardly through the streets of San Andreas a joy.
And much like fans of the Fallout series, many of us GTA players are guilty of listening to the in-game music outside of gaming sessions.
Hacking a radio
Maker Raphaël Yancey loves the San Andreas tunes so much, he decided to build his own Grand Theft Auto radio, complete with the MP3s available from Rockstar, the game’s creators.
Raphaël used a 1970s Optalix TO100 portable radio for this project, along with a Raspberry Pi 3. While this would be enough to create a music player, he also added two potentiometers for volume control and frequency tuning, as shown in the video above.
Python code allows the potentiometers to move within a virtual frequency range of 88.7Mhz to 108.0Mhz, with five stations to find along the way. A LED comes on whenever the player finds a station, and the Pi then plays the music.
You can find Raphaël’s complete code for building your own GTA radio here. We’re keen to see what other game-based music projects our community will come up with. Here at Pi Towers, we have a spare Fallout Pip-Boy that’s aching to play the sweet sounds of the post-apocalyptic Commonwealth…
Raspberry Pi and music
The integration of Raspberry Pi within music projects is a theme we’re very fond of. From rejuvenated jukeboxes such as Tijuana Rick’s 1960’s Wurlitzer, to The Nest, a USB music download system built into Table Mountain, we’ve seen a host of imaginative projects and are always eager to discover more.
So if you’ve used a Raspberry Pi in your music project, whether it be a jukebox, a guitar pedal, or an instrument, be sure to share it with us.
Post Syndicated from Yev original https://www.backblaze.com/blog/welcome-jack-data-center-tech/
As we shoot way past 500 petabytes of data stored, we need a lot of helping hands in the data center to keep those hard drives spinning! We’ve been hiring quite a lot, and our latest addition is Jack. Lets learn a bit more about him, shall we?
What is your Backblaze Title?
Data Center Tech
Where are you originally from?
Walnut Creek, CA until 7th grade when the family moved to Durango, Colorado.
What attracted you to Backblaze?
I had heard about how cool the Backblaze community is and have always been fascinated by technology.
What do you expect to learn while being at Backblaze?
I expect to learn a lot about how our data centers run and all of the hardware behind it.
Where else have you worked?
Garrhs HVAC as an HVAC Installer and then Durango Electrical as a Low Volt Technician.
Where did you go to school?
Durango High School and then Montana State University.
What’s your dream job?
I would love to be a driver for the Audi Sport. Race cars are so much fun!
Favorite place you’ve traveled?
Iceland has definitely been my favorite so far.
Of what achievement are you most proud?
Getting my Eagle Scout badge was a tough, but rewarding experience that I will always cherish.
Star Trek or Star Wars?
Coke or Pepsi?
Coke…I know, it’s bad.
Why do you like certain things?
I tend to warm up to things the more time I spend around them, although I never really know until it happens.
Anything else you’d like to tell us?
I’m a friendly car guy who will always be in love with my European cars and I really enjoy the Backblaze community!
We’re happy you joined us Out West! Welcome aboard Jack!
Post Syndicated from Janina Ander original https://www.raspberrypi.org/blog/brutus-2-gaming-pc-case/
Attention, case modders: take a look at the Brutus 2, an extremely snazzy computer case with a partly transparent, animated side panel that’s powered by a Pi. Daniel Otto and Carsten Lehman have a current crowdfunder for the case; their video is in German, but the looks of the build speak for themselves. There are some truly gorgeous effects here.
Vorbestellungen ab sofort auf https://www.startnext.com/brutus2 Weitere Infos zu uns auf: https://3nb.de https://www.facebook.com/3nb.de https://www.instagram.com/3nb.de Über 3nb: – GbR aus Leipzig, gegründet 2017 – wir kommen aus den Bereichen Elektronik und Informatik – erstes Produkt: der Brutus One ein Gaming PC mit transparentem Display in der Seite Kurzinfo Brutus 2: – Markencomputergehäuse für Gaming- /Casemoddingszene – Besonderheit: animiertes Seitenfenster angesteuert mit einem Raspberry Pi – Vorteile von unserem Case: o Case ist einzeln lieferbar und nicht nur als komplett-PC o kein Leistungsverbrauch der Grafikkarte dank integriertem Raspberry Pi o bessere Darstellung von Texten und Grafiken durch unscharfen Hintergrund
What’s case modding?
Case modding just means modifying your computer or gaming console’s case, and it’s very popular in the gaming community. Some mods are functional, while others improve the way the case looks. Lots of dedicated gamers don’t only want a powerful computer, they also want it to look amazing — at home, or at LAN parties and games tournaments.
The Brutus 2 case
The Brutus 2 case is made by Daniel and Carsten’s startup, 3nb electronics, and it’s a product that is officially Powered by Raspberry Pi. Its standout feature is the semi-transparent TFT screen, which lets you play any video clip you choose while keeping your gaming hardware on display. It looks incredibly cool. All the graphics for the case’s screen are handled by a Raspberry Pi, so it doesn’t use any of your main PC’s GPU power and your gaming won’t suffer.
To use Brutus 2, you just need to run a small desktop application on your PC to choose what you want to display on the case. A number of neat animations are included, and you can upload your own if you want.
So far, the app only runs on Windows, but 3nb electronics are planning to make the code open-source, so you can modify it for other operating systems, or to display other file types. This is true to the spirit of the case modding and Raspberry Pi communities, who love adapting, retrofitting, and overhauling projects and code to fit their needs.
Daniel and Carsten say that one of their campaign’s stretch goals is to implement more functionality in the Brutus 2 app. So in the future, the case could also show things like CPU temperature, gaming stats, and in-game messages. Of course, there’s nothing stopping you from integrating features like that yourself.
If you have any questions about the case, you can post them directly to Daniel and Carsten here.
The crowdfunding campaign
The Brutus 2 campaign on Startnext is currently halfway to its first funding goal of €10000, with over three weeks to go until it closes. If you’re quick, you still be may be able to snatch one of the early-bird offers. And if your whole guild NEEDS this, that’s OK — there are discounts for bulk orders.