Arduboy Magazine Vol.5

Page 1

Vol.

1st

JUN

2017

Arduboy

game

jam

Arduboy ゲームジャムのお知らせ 12 May - 22 May 2017

The Zoo had to close

テーマ:動物園は閉鎖しなければならない!

#arduboyjam

5


Contents: PLAY

1st Arduboy Game Jam Community Polls! New games out this month! Featured Game - SFZ (Arduboy)

LEARN

Tips & Tricks with Team a.r.g (Vol 5) Squeezing Bits to maximise your code with JO3RI (Vol 4) Game design with crait

Scribbled Notes with Celine

EXPLORE

Pixel Page with Justin Cyr Questions with Game Developer Shdwwzrd from Neo Retro Building Arduboys with Students! Game Loader with Erwin Page 2 of 45


A welcome note: Sketches fro m the maki ng of Techno M onkey

We hit mid year, and what an exciting month May has been for the Arduboy community! Not only are there a consistant stream of new games again this month (9!), there are also 10 entries for the first ever #arduboyjam! (page 6-13) A big thank you for everyone who participated and made it possible! It was refreshing to see so many new developers, and new groups working together to make an Arduboy game and take part in the jam. We featured the making of Harambe’s Revenge and Techno Monkey for anyone who needs some inspiration to get started with their own game. @celinebins

Do you wish to contribute? Have an interesting article you wish to share with the Arduboy community? A cool project you did, your experience on working on it? A funny joke? We want to hear it! Send arduboymag a message through the Arduboy community page or a DM on Twitter! Page 3 of 45


Thank you to this months contributors! @crait: Creator of various Arduboy games such as Circuit Dude and Train Dodge, crait has written tutorials on how to get started with creating your own game, and developed Arduboy Manager; an easy way to upload games to your Arduboy without using the Arduino IDE. http://www.crait.net/ @Dmian: This talented graphic & web Designer from Madrid, Spain created the Magazine’s Logo and various icons. https://damianvila.com/

@eried: Erwin Ried is a Computer Engineer from Chile working in an Innovation Garage in Northern Norway, near Santa. He loves calculators, 3D printing, electronics and of course the Arduboy!

@JUSTIN_CYR: One of his first professional jobs in the games industry was makings 1bit graphics for the first cell phones that had screens. I really loved the challenge of working in such a limited resolution and palette. It was almost like drawing at an atomic level. Years later I started making 1bit art again right around the time of the Arduboy. @JO3RI: Better known as TEAM a.r.g, some of Arduboy’s community favorite games are written by them, as well as their own Arduboy Game Loader, where you can easily upload your favorite Team a.r.g games without using the Arduino IDE. http://www.team-arg.com/

@TheArduinoGuy: Author of the ArduBoy games - Jet Pac & Arcodia.. Author of ‘Beginning Arduino’. Medway Makers. Maidstone Hackspace. http://thearduinoguy.org/

@Your name here: We want you to share your experience in this Magazine! Be a contributor and have your work published in Arduboy Magazine!

Page 4 of 45


Arduboy

Company

news:

What’s happening at headquarters?

@Celinebins The Tetris ÂŽ Microcard is now available at distributors around the world! Europe: EXP Tech USA: AC Gears Asia/Japan: Listings here

The Arduboy Store is up and running! Get your Arduboy, Tshirt, limited Kickstarter edition Arduboys, and Devkits shipped directly from us!

Where to buy Arduboy? In order to better deliver the Arduboy to you, a distribution model for sales has been currently implemented. You can now purchase the Arduboy from a variety of different retailers from around the world!

New! New!

New!

Talk to us!

Page 5 of 45


Make games!

Use fresh code!

Get social!

1s

Ardu Gam ja

12 May - 23

The Zoo ha

#Ardub The jam is all about creating something new alongside others and experiencing the creative process together. Join individually or as a team.


st

uboy ame am

3 May 2017

Win Prizes!

Help the community!

Have fun!

ad to close!

boyJam Check out all entries in the next few pages! A Poll was done to discuss and find the 3 community favourites.. Results on page 14.


#ArduboyJam With the theme announcement of “The Zoo had to close”, the community got to work on their take of why (or how) the zoo had to close and submitted them just 8 days after the theme was announced. Ranging from individual entries, first game ever made, to groups of students and instructors and “veteran” Arduboy game devs, visit the links and try them out for yourself!

Back

to

the

@eried

jungle

It is a small arcade game, inspired slighty by Frogger (but sideways). The zoo had to close, so help the animals cross the road and get back to the jungle! Did anyone find the hidden Easter egg? “I love the music, the story and the funny characters. It’s difficult but addictive”

Harambes

revenge

@MorganLapis and @SerenndipityDoDa e d th Rea ng of ! i mak

In Harambe’s Revenge, you play as a phantasmal Harambe that has returned from the afterlife to convert oblivious tourists into mutant zombie gorilla minions which will then protect him. The zoo had to close down in quarantine, trapping many tourists inside. Harambe’s path is a peaceful one so he has no actual attack. His specialty is the HARAMBE DASH - the ability to run faster than a speeding bullet. Harambe must contend with armed zookeepers, phantasmal snakes, and even anti-gorilla tank units. to be continued next page >> Page 8 of 45


The Making of.. Harambes

revenge

@MorganLapis and @SerenndipityDoDa Morgan: We both got our start in programming with the C64, typing in BASIC programs out of computer magazines. Molly first got interested in game programming when she played Metroid for the NES, still her favorite game today. I was inspired mostly by RPGs and adventure games. Today we both work in software development. The C64 also got me interested in making computer music (chiptunes), and I often use samples or emulations of the SID chip in new music arrangements I create today. Molly: I had a string of the TI calculators during High School. I bought all but the 81 with my own money and still have my 89. Learned Z80 assembly language so I could write games for the 85 and 86. I think the Z80 is really what made programming click for me. Ticalc.org was my mecca until I graduated high school and exploring arduboy.com gives me a similar feeling. Morgan: I came across the Arduboy browsing Massdrop. I have a collection of retro game systems and portables, especially anything that can be used for chiptunes in some way, and I became interested when I saw the Arduboy’s game library. I have seen many Gameboyinspired systems that are simply meant for emulating classic systems, rather than new retro style games, whether completely new ideas or minimalist takes on old favs. Molly: Initially I was turned off by the limitations of the system, but after working with the Arduboy it started to grow on me. The limitations of the system actually create exciting challenges. It is easy to start working on a project for the PC and completely get lost in the possibilities. The jam helped to further limit scope and keep us focused. Molly&Morgan: Harambe’s Revenge was initially inspired by Robotron: 2084. In our early brainstorming sessions we

imagined having the Zookeeper as the playable character. Harambe was to be like the brains from Robotron: 2084, able to transform the humans that wandered around aimlessly on the map. As we were developing the rudimentary game engine, it became clear that Harambe needed to be the hero, as Robotron is a dual joystick game, and the Arduboy only has one gamepad. Working together was a challenge mostly because we were sharing the Arduboy. The first weekend of the game jam we pair programmed to hammer out a very rough, but playable version. The gameplay was unbalanced and we only had the Zookeeper as an enemy. Morgan came up with the idea of adding the tank and on Saturday Morning, close to the deadline, the snake. Adding those enemies really helped to balance out the game since. Molly: As to dividing up the work, Morgan focused on the graphics, sound, enemy types, behavior and difficulty scaling. I built up the game engine, and it had to be refactored many times because we kept bumping into the edge of the limited SRAM as we added enemies. Morgan: We had a number of ideas that became impractical to implement before the deadline such as having a WAV file play when the Harambe Dash was used; Harambe exclaiming ‘HARAMBE DASH!’ using an emulator of the speech synthesis used in the Q*Bert arcade machine, but we couldn’t get ArduboyTones & ArdVoice to play nice together. We also hoped to revisit the idea of making the Zookeeper a playable character, even considering embedding this whole other game as an easter egg. All of that had to be cut out as the week progressed because we were too busy balancing the game and learning how to make use of Arduboy’s available features. to be continued next page >> Page 9 of 45


Molly: Burned up most of Saturday implementing the high score save to EEPROM because I insisted on wear leveling the writes(something that I later learned was overkill because someone tried to burn out the EEPROM and found that it took ~10x more writes than the documention rated it for). Sunday was spent implementing the game menu, scrolling intro and the help. After

Huhuu

submitting, much to my dismay, I found some bugs were added to the start menu as a result of implementing the help. Decided to call the game itself done the Sunday before the deadline so we could learn how to dump screenshots for the promo video. At the time we didn’t have a good method of recording video of the Arduboy.

is

hoo?

Students and instructors from Bard College at Simon’s Rock

In this match-2 memory style game, the player must find matches between animal sounds in different languages. For example, Huhuu matches with Hoo since they are both owl sounds, while Myau (Russian) matches with Nyan (Japanese) since they are both cat sounds. Credits to Liz Hartung - Pixel Art, Audrey Kim - Pixel Art, Joey Kim - Pixel Art Jody Leonard - Play Testing, Nani Li - Programming, Zoe Offermann - Sound, Aaron Williams - Concept, Programming.

Leanna

the

@shdwwzrd

Lion

Leana may be a lion, but she knows what she likes: fresh meat from her favorite restaurant, the Zoo. It’s an endless runner where you chase and eat the humans that are trying to get away from you! Stay away from the zoo keepers! to be continued next page >> Page 10 of 45


Poop

Panic!

@inajob

Keep the zoo clean from the animal’s poop so that it remains open for visitors! “I love how the poo looks like Hershey’s Kisses. This game made me lol.”

Roo

Run

@crait

The zoo had to close and now all the animals are trying to escape! Help the kangaroo run away from the animal control who’s trying to catch him. Push A and B back and forth as fast as you can to run faster.

Snail

Maze

@Keyboard_Camper

The zoo had to close so help guide Gary to the pub so he can get drunk!

to be continued next page >> Page 11 of 45


Sneaky

Zoo

@Hundstrasse

Sneak past zoo wardens with flashlights at night! It is still a WIP and if you hope that more development will be done on this game, developer @Hundstrasse promises “... I WILL finish it ... at some point when I’m not crazy busy :-S”

Techno

Monkey

@RetrobitCoder

e d th Rea ng of ! i mak

A meteor crashes in a zoo during the night. An alien virus spreads to the residents in the zoo and causes them to mutate into robot hybrids called Technoids. Due to the outbreak, the zoo has been under quarantine. It is a fight for survival inside. Can you beat the opposing Technoids and survive?

Zoo

Escape

@FerJerez

Animals have gone crazy.. Escape!!! Run away from all animals chasing you, jump over obstacles, and avoid the snapping crocodile. “I love the cute sprites and the controls feel very responsive.”

Page 12 of 45


The Making of.. Techno

@RetrobitCoder

Monkey

How did you know about the Arduboy? I actually knew about it well before the Kickstarter came out. I stumbled across someone sharing the original business card sized Arduboy images and website link on Tumblr, and thought it was really cool and wanted to see what it was about. I remember seeing that there were plans on selling the Arduboy after the development phase, and I was hooked. I can definitely say it is an amazing little system, and extremely fun to play with. How did you come up with the game idea? I have always been a huge Megaman fan, and for a while now I’ve wanted to do a Megaman like game. When the first Arduboy game jam was announced I was deciding on if I should do a Earthbound/ Mother like game with the theme or go the Megaman route (my two favorite game series), since I wanted to make games like that at some point and thought this was a great chance for me to just do it. I decided to go the Megaman route since I wouldn’t have to worry much about a story and more complex fight mechanics for a limited time frame, but would still be an interesting game for the jam. I quickly sketched out all the bosses that I thought would be cool to fight against in the game, and tried to come up with a main attack that was unique to each one. I have a personal notebook that I use for keeping my game ideas in so that way I don’t forget. I had even sketched out enemies that could appear in a level and items

for the player to get, but unfortunately I didn’t get far enough along to add levels, sound, or the weapon get ability like in Megaman. Even though I couldn’t get to a lot of the things I wanted in the game, I’m still pretty happy with how the game came out. What were some of the difficulties? The three main difficulties that I had were I had a limited amount of time I could work on the game during the week due to work, I never used the Arduboy2 library before, and this is technically the 3rd game that I have ever made for the system, so I am still inexperienced when it comes to making games (My 2nd game hasn’t been released yet). In particular for the Arduboy2 library, I had some issues with getting the weapons to move across the screen. I was using Rect to keep track of each boss’s weapons that they would shoot, but when it was time to update the Rect for each weapon, what I had wrote didn’t cause them to move, even though what I wrote should have done that. I was scratching my head for about 20 minutes trying to figure out why. My solution ended up being since I was storing the weapons in an array, I had to reassign my modified Rect for a weapon back to the correct position in the array. My guess is that since I was doing a for each loop through the array that maybe I was modifying a copy of the Rect in the array and not the original Rect for the weapon itself, but I’m not 100% sure on that. That is something I’m going to investigate on in my next game to see if my suspicion was right. What are your thoughts of the theme & how long did it take to make the game? I thought the theme was really interesting. There are many ways you can interpret the theme to make a unique game, although personally I was hoping for the robot theme. I think in total it took me something around 34 hours to make the game. I only had like 1 to 3 hours available to work on the game after I got off work during the week, so most of the hours put into the game happened on the weekends. Page 13 of 45


Community POLLs! by @Celinebins

This month we took to th asked what their fav We got 75 votes and

Prizes!

Congratulations to the prize winners! Everyone is a prize winner!! For taking part in the first EVER Game Jam, all participants will receive a package from Arduboy! The Arduboy Team will send a inner forum message asking for your shipping details so keep an eye out for that.

Back

to

the

Leanna

51%

#1

jungle

the

@eried

#1

Lion

@shdwwzrd

Zoo

51%

Escape

@FerJerez

#3


What game

is your favourite jam entry?

he community pages and vorite game jam was! d these are the results!

#10 Huhuu is hoo?

@students and instructors from Bard College at Simon’s Rock

#9 Snail Maze @Keyboard_Camper

3% 3%

#8 Sneaky Zoo @Hundstrasse

#7 29%

Poop @inajob

Panic!

#5 Roo @crait

29%

#5

Run

Harambes

revenge

@MorganLapis and @SerenndipityDoDa

32%

#4 Techno @RetrobitCoder

Monkey

41% Follow the Arduboy channel on Youtube and get notified when the Game Jam review video is released (soon)! Page 15 of 45


W

ES AM G

by @Celinebins So many new games were released this month! If you missed them on the community pages, here they are.

FR ES H

N E

PLAY:

That will get you hooked

BashBoss @Xideum

It’s very incomplete.. Allowing you to begin a game as the away team and freeze up after you select a batting command. Help give feedback to complete this game!

Bombzzle @HokuHakase

Bombzzle is a puzzle game where you must blow up chains of similar blocks to get points! Every 10 seconds, a bomb appears along with a tile marked as BONUS (+) and another as PENALTY (-).

Bloopies @FerJerez Bloopies on @FerJerez’s 3D printed Arduboy Arcade

It’s a Bejeweled/Candy Crush/Begemmed like puzzle game which was named by the community!

Graph - Graphing calculator @V360

Though not a game, and more of a novelty than an actual calculator, get the nostalgic vibes with this demo. to be continued next page >> Page 16 of 45


Lander! - Lunar Lander clone @Nave_99

You must land upright on a flat part of the map with a low enough velocity in the x and y direction.

Omega

Horizon

@shdwwzrd (& Team Neo Retro)

The planet of Turnax has high value resources and it is being attacked, and its mining operations damaged. Your mission is to eliminate the primitive hierarchy in minimal time.

StartOver @powmonk

Collect all the coins and guide the character to the next level in this horizontal scrolling platformer. Give @powmonk feedback to help complete the game!

Tempest @colinta

Shooter

Enemies emerge from the “portal” in the middle, so you rotate around the center and shoot towards the middle.

Want us to feature your game? Write in to us with your game, how you made it, and anything else you want the community to know!

Developer info: The Arduboy is an Arduino based device. The programming language used in the Arduino environment is based on C++ but there are some differences and additional built in functions provided. Even if you’re familiar with C++ (or not), it’s a good idea to review the Arduino Language Reference if you’re writing sketches for the Arduboy.

Page 17 of 45



This months

Featu re

ame G d

SFZ (Arduboy)

A short video on Instagram by user @jamatat got interest from the Arduboy community to find out what the Space Harrier like game was all about. The game is not officially posted on the community game pages, but after some searching, it is listed on Japanese developer - Cobinee’s website.

Game developer @cobinee tries his hand at developing for this specific genre of game. 【 Operating Environment 】 · Arduboy Library 3.0.0 【 How to operate】 Move cursor up / down / left / right with ↑ ↓ ←→ With PETIT OF THE DEAD, the scaling was tight shooting with A button, so we changed the pattern of 4 steps. Download from here Check out his other games: Umeruzu (Arduboy) PETIT OF THE DEAD (Arduboy) Do You Remember Love? (Arduboy)

なにか新しい開発環境、ゲーム制作環境が出る と必ずと言っていいほど誰かが手をつけるこの ジャンル、 というかこのゲームというか。 でもそういえば自分、手をつけたことなかったよ なぁと思いましたが、 とはいえそのままだとおも しろくないしなぁ、 ということで発売されていな い方のアレをベースとしてみました。 撃って倒してください。 【 動作環境 】 ・ Arduboy Library 3.0.0 【 操作方法 】 ・ カーソルの↑↓←→で上下左右移動 ・ A ボタンでショット PETIT OF THE DEAD で拡大縮小がきついのはわ かっていたので4段階のパターン切替、Arduboy の解像度がいろいろ手頃で作りやすいです。 ダウンロードはこちらから 他のゲームを見てみましょう: ウメルーズ(Arduboy) PETIT OF THE DEAD(Arduboy) Do You Remember Love? (Arduboy) Page 19 of 45


LEARN:

In this topic we would like to present to you some tips & tricks to help you code your games for Arduboy. What we present doesn’t intend to be the absolute truth, it’s just a way we at TEAM a.r.g. code. So always remember, these are not golden rules.

s k c i r T Tips &

by TEAM A.R.G

#5 - How to pass a variable into a function and vice versa by @jo3ri

In our previous article, we explained “function pointers”. This time let’s have look on how to pass variables into a function and in certain cases how to receive a variable back from a function. Why would one want to pass one or multiple variable? Well for example, because we don’t want to add to the global variables and also nesting a variable deep into functions, will add to the overall size of your code. First let’s have a look at a simple example, score. In a game you probably are keeping track of your games score. In our games we don’t use the text function, we only

use 10 sprites (numbers 0-9) and combine those into the score. So we create our own drawScore function. But in a game you’re not only showing the score while playing. You’ll probably also create a GAME OVER screen, showing the score again and maybe you’ll even add in a HIGH SCORE screen. Instead of creating 3 functions, with each one it’s own position, we can create just one function and pass it the position whenever we need it. This is how such a function would look like:

to be continued next page >> Page 20 of 45


void drawScore(byte xPosition, byte yPosition) { char buf[10]; ltoa(scorePlayer, buf, 10); char charLen = strlen(buf); for (byte i = 0; i < charLen; i++) { char digit = buf[i]; if (digit <= 48) { digit = 0; } else { digit -= 48; if (digit > 9) digit = 0; } sprites.drawSelfMasked(xPosition + (5 * i), yPosition, numbersSprite, digit); } } If you want to understand how this function works, you’ll have to read the article “The bit Squeezer” in this same issue. Now just have a look at the function itself. You’ll see it has 2 bytes in the beginning between the brackets.

Those mean we temporary declare two bytes, but as soon as the function is finished, those will no longer take up space in RAM. So if you want to use this function, you will have to add the x and y position like this:

drawScore (40, 56); Now you created a function that will behave differently, when feeding it different variables. This trick is used a lot for testing functions, where you want to give some variables to a function, test a condition and get a result back. it’s not easy to understand this by just reading some text, so let’s have another example. Most puzzle games can be reduced into a grid. meaning you can see them as a grid char { 0, 0, 1, 1, 0, }

of stacked elements, blobs, blocks or dots. The most simply way, is that you’re grid holds every possible place of one element and just store if there is an element or … not, 1 = true and 0 = false. Of course you can make it more complex, by storing a type of element, where 0 = no element an any number represents a certain element type. But as said, let’s keep it simple with true or false.

arrayOfElements[] = 1, 1, 0, 1, 1,

0, 1, 0, 1, 0,

1, 1, 0, 1, 0,

1, 0, 1, 1, 0, to be continued next page >> Page 21 of 45


Here we have created an array of 25 elements. Each element has it’s own position in the array (grid). To make it easier we wrote the array in 5 rows of each 5 columns. Although this is just for easier reading, this doesn’t change a thing on how we use the grid. By the way, doesn’t this remind you of something? Indeed, images are stored the same way, we store images in PROGMEM and our grid is stored in RAM, because we might want to change elements in the grid.

Let’s say we want to know if the neighbouring element at the right side of every other element is empty (false). That means we need a function where we can pass the position of the element we want to check. Our function only needs to tell us if it’s true or false, that’s why we’ll use boolean instead of void. Now it’s very clear, we’re expecting only two possibilities from our function. This boolean can now be used to test certain conditions in the grid and change it according the result you got from the test.

boolean checkIfRightNeighbourIsEmpty(byte elementToCheck) { if (arrayOfElements[elementToCheck + 1] == 0) return true; else return false; } Although this is a very simple example, it should have showed you how you can pass variables into a function and get one back. We use this technique a lot for testing collision of a sprite with its background. What we do is, test the neighbouring tile, by feeding the test function the direction our sprite is pointing at, along with the position of our sprite. Depending on the direction we check the tile above, right, below or left. (North, East, South or West). If that tile is 0, the sprite is allowed to move, if it’s not 0, the sprite can’t move into that direction.

to be continued next page >> Page 22 of 45


#define #define #define #define #define

NORTH EAST SOUTH WEST GRID_WIDTH

0 1 2 3 5

boolean checkIfNeighbourIsEmpty(byte directionPointing) { switch (directionPointing) { case NORTH: if (arrayOfElements[elementToCheck - GRID_WIDTH] == 0) return true; else return false; break; case EAST: if (arrayOfElements[elementToCheck + 1] == 0) return true; else return false; break; case SOUTH: if (arrayOfElements[elementToCheck + GRID_WIDTH] == 0) return true; else return false; break; case WEST: if (arrayOfElements[elementToCheck + 1] == 0) return true; else return false; break; } }

Have fun coding your games and next time we’ll go deeper into these grids and how to use them in combination with tile sheets and collision detection.

Page 23 of 45


BIT In this “small” part of the magazine I would like to tell you about the possibilities you have to reduce coding size when creating your app/game.

SQ

U EEZ

ER

by JO3RI

#4 - Reduce image size by @jo3ri

Every issue I’ll give you a new suggestion on how to get the most out of your code using the least amount of bytes. Remember to always test these tips and compare compiled size before and after these kind of tricks. In the previous issue we reduced size by “clever coding”. In this issue, let’s have a look on how we can reduce the size of images by using tile sheets. As you might know, the screen resolution of the arduboy is 128x64, which equals to 8192 pixels or 1024 bytes (1kb). Now how convenient is that. It doesn’t need much understanding to know, you can’t have a lot of images like this, or the available memory will be filled up very quickly. Back in the days, memory limitations have led to a genius trick called tile sheets. So how do those sheets work ? Whether the image is a background image in a side scrolling game or a map in a top down game, in both cases you probably want an images that’s multiple times

bigger than the screen size. One way to achieve this, is by using compression, but decompressing images takes time and the function to decompress itself takes memory too. when using a tile sheet, your bigger image is being build by small pieces, small images or tiles. Indeed, this means your bigger images will look more repetitive, but that’s the price to pay for gaining lot’s of bytes. You can find lot’s of tools these days for creating a tile sheet and making a bigger image out of these tile sheets. Once you export such a tile sheet, you will get an images with all tiles in it and an array of numbers representing a tile out of you sheet. Of course you can just create the tilesheet in any drawing program yourself too and convert it with this online tile sheet converter.

to be continued next page >> Page 24 of 45


Remember these characteristics, your tile sheet image has to comply to: • a tile sheet has 1 column of tiles vertically arranged • the top tile is the first one, bottom tile the last one • 100% pure black and 100% pure white pixels.(transparent pixels will be converted into black pixels) • height and width needs to be a multiple of 8. (8x8, 16x16, 24x24,32x32) • a tile has to be square • -naming is very specific: nameTileSheet_ widthOfTilexheightOfTile (example: myTileSheet_8x8)

In the example above we have a tile sheet consisting of 16 tiles, each 8 by 8 pixels. So let’s calculate our bytes used. The tile sheet is 16 * 8 * 8 = 1024 pixels or 128 bytes. Our image itself consists out of 16 * 16 of those tiles, or 256 bytes. This is a total of 384 bytes for an images that normally would be 2048 bytes. So why 256 bytes (16*16) for the image ? const unsigned char PROGMEM mapArray[] = { 7, 11, 11, 11, 11, 11, 11, 11, 11, 11, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 12, 1, 11, 10, 0, 14, 0, 0, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 13, 0, 0, 14, 0, 0, 0, 14, 0, 0, 2, 11, 11, 5, 11, 11, 11, 14, 0, 0, 14, 0, 0, 14, 0, 0, 0, 14, 0, 0, 14, 0, 0, 15, 0, 0, 0, 14, 0, 0, 14, 0, 0, 0, 0, 0, 0, 14, 0, 0, 14, 0, 0, 0, 0, 0, 0, 14, 0, 0, 14, 0, 0, 0, 0, 0, 0, 14, 0, 0, 9, 11, 11, 1, 10, 0, 0, 14, 0, 0, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 0, 0, 14, 0, 0, 0, 9, 11, 11, 11, 11, 11, 3, 11, 11, 11, }

Well, this number is the total of all reference numbers in the grid representing the big image. What we do is, create an array in which we reference to a tile in our tile sheet. 0 being the first tile, a floor tile in this case and 1 up to 15 being the wall tiles. Here you have the array for the above image.

11, 0, 0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 12, 0, 0, 11,

11, 0, 0, 12, 0, 0, 11, 0, 0, 0, 0, 0, 11, 0, 0, 11,

11, 11, 11, 0, 0, 0, 0, 0, 0, 8, 0, 0, 14, 0, 0, 14, 0, 0, 4, 0, 0, 14, 0, 0, 14, 0, 0, 14, 0, 0, 14, 0, 0, 14, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 11, 11, 11,

8, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 6, to be continued next page >> Page 25 of 45


This will put the array in PROGMEM, so our array doesn’t take any of that precious RAM. Now we need to create a function, that will show our map on the screen of our Arduboy.

We assume all our maps will have the same size, if you would create a game, where that is not the case, you will have to provide the size within that array, like you do with images. Our map exists out of 16 * 16 tiles, so our draw function will like like this:

void drawArray() { for (byte row; row < 16; row++) { for (byte column; column < 16; column++) { sprites.drawSelfMasked( column * 8, row * 8, tileSheet, pgm_read_byte(&mapArray[(row * 16) + column])); } } }

What we do, is draw each tile in a loop, by looking up the correct tile in the array, 256 times (16 * 16) in this particularly draw function. We have to multiply column and row by 8 because our tiles are 8 pixels wide and high. Don’t forget to add the converted tileSheet image in your code.

The way the function is written, should help you see we draw a complete row of tiles, before we move on to the next row. But we can even make this function compile smaller. It won’t be much, but every squeezed byte is a gained byte. Although the code looks longer (bigger), the compiled size will be smaller.

void drawArray() { byte column = 0; byte row = 0; while ((column + (row * 16)) < 256) { if (column > 15) { column = 0; row++; } sprites.drawSelfMasked( column * 8, row * 8, pgm_read_byte(&mapArray[(row * 16) + column])); column++; } }

pgm_read_byte is used to get the data out of PROGMEM. So now you know how to use a tile sheet. Now you can add a variable to the y position of the tiles, so

that when you press a button, the image moves up or down. to be continued next page >> Page 26 of 45


Let’s add the up and down button and change our draw function accordingly, so it will move the map, when one of both #define MAP_HEIGHT int cam_y = 0;

buttons is pressed. First add this to the global.h file.

16

other file you’ll be using the checkInputs function. If you don’t know what we’re talking about, have look on the “tips & tricks” article in the first Arduboy Magazine on how to use multiple files.

We only added vertical movement, because our map is exactly the width of our screen, but adding horizontal movement comes down to the exact same thing.

void checkInputs() { if (arduboy.pressed(DOWN_BUTTON) && (cam_y < MAP_HEIGHT)) { cam_y++; } else if (arduboy.pressed(UP_BUTTON) && (cam_y > 0)) { cam_y--; } }

And finally add the cam_y variable in your drawArray function. Because the map won’t fit the screen, we are drawing to much tiles. It would be better to only “draw” the part that’s actually on the screen, meaning you the “camera”

function need more work. In short, our screen is only 16 * 8 tiles, so we have only 8 rows to display. For now let’s have a look at the drawing function with the added variable and don’t care about to rows we can’t see.

void drawArray() { byte column = 0; byte row = 0; while ((column + (row * 16)) < 256) { if (column > 15) { column = 0; row++; } sprites.drawSelfMasked( column * 8, (row * 8) + cam_y, pgm_read_byte(&mapArray[(row * 16) + column])); column++; } }

Voila, your image will now move up and down when pressing the according buttons. Next time we’ll see on how to

reduce the tiles drawn to the ones actually shown on the screen. This should improve speed a lot on bigger maps/backgrounds.

Have fun making games!

Page 27 of 45


game

design by crait

tips

6 Reasons Why Arduboy Is Great For Beginners I started programming when I was in middle school for the Sony PSP. It was incredibly difficult and I felt defeated at every turn. I’ve evolved over the years and even got a degree in Software Engineering. Even though I’m an experienced programmer, I wouldn’t recommend any beginners learn to program on the PSP. It’s just not practical. I wish that I had a device like the Arduboy when I was a kid because I wouldn’t have had such a hard time learning the ropes and making my first game. In this article, I’m going to list 6 things that make the Arduboy a great platform for people learning to program. Even with my background, I still love programming for this device!

1 - Popular Language To program for the Arduboy, you can use C++, which is one of the most popular programming languages in the world. Because of this, if you’re going to make an Arduboy game, you’ll be using skills that so many other people have. If you ever run into a really complex question about the language, you can always find the answer online. Once you become a pro, your new coding skills will transfer over to any other programming you do in your life.

2 - Resources The PSP actually used C++, as well. Even though the language is so popular and there are so many resources online, I still felt overwhelmed. To me, the main difference between the Arduboy and PSP (and a lot of other game systems) is the amount of system-specific resources. I was lost when trying to figure out how to do the most basic of tasks when I was a kid. There was no central place to get updated tutorials or code snippits. When it comes to the Arduboy, though, there are so many more resources available. I wrote several tutorials on the Arduboy website, but beyond that, there are wellwritten documents like MLXXXp’s library documentation. The other amazing part about learning with the Arduboy is that almost every game is open-source. This means that if you enjoy a game, you can download the code and look at how that game works! When I was starting out, no one shared their code on the PSP and I felt like I was alone. Releasing code for the Arduboy and seeing other people’s methodology makes me feel like I’m part of a community!

to be continued next page >> Page 28 of 45


3 - Easy Portability What comes to mind when you hear “portability”? A lot of times, people think about being able to physically carry something around with them. In that regard, the Arduboy is great! You can easily take it with you and tinker around with it, coding using a laptop on a flight, or at your friend’s house, or even in a library. It’s great and if you’re stuck, you have even more oppurtunities to mess around with it. However, in the computer world, “portability” is the ability to take your code and it apply it elsewhere. I have seen people take games for other systems and port them easily over to the Arduboy. Currently, I am porting Circuit Dude to the PC and mobile devices so that more people can play my game. I love the Arduboy’s portability. :)

4 - No OS Restrictions When I was learning to program for the PSP, I had to write a lot of code to ineract with the operating system that really made no sense to me. There were a lot of complex code chunks that I just ignored or confused me the more I stared at them. All operating systems have their own restrictions and guidelines for programming on. Because of this, there have been a lot of frameworks designed to work around these restrictions. However, these frameworks usually have their own weird restrictions. When programming a game for the Arduboy, you really do not have to worry about this issue, though. There’s no code that you have to write that won’t be used or can’t be easily explained to someone new.

When I first got my Arduboy, I was able to code a game in a single day. I was so surprised how little extra work I had to do to implement my game design.

5 - Hardware Restrictions The Arduboy only has 6 buttons, a screen, and a speaker. The hardware is very limited. Some people may not like this, but when it comes to learning how to code, this can be benificial! Learning to program can be overwhelming. Pile on a lot of extra hardware you have to learn about and you have a recipe for disaster. The more you include in the device, the longer it will take for people to learn how to program for, and this is especially true for beginners. Instead of thinking of hardware restrictions as a bad thing, I think of them as hardware simplifications.

6 - Scaling challenge Even though I’m a good programmer, there are a lot of things I could improve on. The Arduboy can only handle a little bit of memory. The bigger the game is, the more challenging it is to develop for. In this respect, the Arduboy becomes a great exercise challenge for programming experts, like myself. I have learned so much about compressing my code and refactoring because of the Arduboy. It’s helped me grow in so many ways and I’m sure that even if you’re a beginner, it can help you, as well.

If you’re interested in keeping up with my projects and work, be sure to follow me on Twitter at: http://www.twitter.com/crait Page 29 of 45



Scribbled notes

by @celinebins I started with little programming experience, so I decided to make a game to better understand all the users that are trying to do so. Proving that if I can do it, then anyone can too, and of course have something cool to show off. This series is going to summarize some of the lessons I’ve learnt as I try to create my own game. I hope it will help and inspire other users!

How to upload code to the forums Using the community can be a little tricky, there are so many features to use! Arduboy uses Discourse, and if you would like to read more on how to maximise your usage of the community pages, you can read their FAQs here.

One of the more useful features is using Preformatted text </> to upload your code when you are asking for help. This will make your code from Arduino appear like it is on the page, and it condenses it into a scrolling text bar, reducing the length of your post. To use it, paste your code to the left text bar, highlight it and click on the </> symbol. You should see your text transform on the right preview bar. You can also quote a reply to another user’s comments with the ” button, upload images with the Upload button, create lists, headings, include emojis and under the setting menu you can also choose to build a poll. Go forth and experiment!

What’s next? Let’s say you’ve gotten help from the community and finalised your game code and are ready to share it with everyone.. What’s next? Create your own repository on Github so everyone can easily download and contribute to your project! to be continued next page >> Page 31 of 45


Firstly, what is Github? GitHub is a development platform that allows you to host and review code, manage projects regardless if it is from an open sourced individual level, or for businesses. This means if you like an existing project, let’s say someone else’s game on the community that you want to improve or change a little, you can request a Branch (branch image). This will allow you to change and work on the file without deleting or affecting the original in any way. Sign up for a Github account.. It’s free! Once you have your account ready, you should be able to see this home screen. If you have more time, do read the guide, otherwise click on the New Project button to start creating your new repository.

What is a repository? A repository for computing related matters is a central location in which data is stored and managed. So it’s like a “file” for your data. Call it what you would call your game (no spaces allowed), and I would suggest to check “Initialize this repository with a README” so you can include some background info in the README text file.

to be continued next page >> Page 32 of 45


Create your .ino file in Github By now you would only have a README.md with a little description on what your repository is all about, so it’s time to add your code from your .ino file. Under the <> Code tab, click “Create new file”

Paste code and save! Name your file exactly the way your game file is saved and a “.ino”at the end - this way when any one downloads the file as a zip folder, they can open it on their Arduino program and upload your sketch!

Experiment and learn more about Github There are so many (dare i say, better) ways to use Github, and now that you’ve started somewhere, try searching for videos / articles on how to better use Github by commiting branches from other people’s projects, saving your projects to Github directly from your desktop and so much more!

Hope this has been informative for users who are starting off! Check back next issue for more scribbled notes..

Page 33 of 45


In this segment of the magazine we feature work from pixel artists. Do contact them if you would like to work with them or use their work. Their contact information is listed below.

Does this scene look familiar? Justin did the pixel art for the TEAM a.r.g game, Sirène.

Copyright by @JUSTIN_CYR Twitter: https://twitter.com/JUSTIN_CYR


Are you a pixel artist? Done some Arduboy Fan art? Wish to have your work shared with the Arduboy community? Send arduboymag a message through the Arduboy community page or a DM on Twitter!

Page 35 of 45


EXPLORE:

In this section we’ll ask the same 10 questions to a different developer in every new issue.

Questions with game developers by @celinebins This issue we interview the newest team dev group in the Arduboy community - Neo Retro. We ask member @Shdwwzrd a little more questions then usual (16!) to find out more about them and how they work together to create games!

1. Who makes up Neo Retro, and how does everyone know each other?

5. Is this the first platform you’ve been developing for?

Neo Retro is currently, myself (Shdwwzrd), my brother Kuronowachan, my wife Cris and my brother Deathknight.

This is the first platform we have developed for with this team. We’ve all worked on different things at times with a mix of the groups.

2. How do you spilt the work?

6. Can anyone else join Neo Retro?

We try to divide the game development into everybody’s strong suits. Shdwwzrd: lead programmer/game design/artist/testing Kuronowachan: level designer/game design/artist/story/testing/music Deathknight: game design/testing Cris: game design/testing/story/ videographer/photographer

We’re always on the looking for talented people to join our team. Especially an artist lol.

3. How long has everyone been making games? I have has been developing games for over 30 years on several different platforms.. Deathknight and Kuronowachan have worked on games off and on for several years.

4. What are your favorite games / style of games? All of us like different styles of games so we can all add our input into pretty much any game that we develop.

7. Where did you find out about Arduboy the first time? We’re always looking for new tech gadgets. I was surfing online a little over a year ago when he stumbled across mention of the Arduboy. He was immediately intrigued and found out as much as possible about it. Within a month i started developing games for the device before i actually got my hands on an arduboy.

8. What is the first game you created for the Arduboy? Rayne the Rouge is the first finished game we made for the Arduboy. We started working on Omega Horizon first but we just got it finished.

to be continued next page >> Page 36 of 45


9. Did you have game developer / programming experience before Arduboy? Yes, I have been programming since my teen years. I started out on the Atari 8 bit computer and eventually published games on various cell phones including the n-gage and the iPhone.

10. What programs do you use for creating Arduboy games?

14. What is the next app/game for Arduboy we can expect? Omega Horizon will be coming out soon. It’s a metroidvania style game. We’re also working on a Dragon Warrior style RPG.

15. What app/game would you love to see on the Arduboy? A Fire Emblem style turn based strategy. A Zelda style game would also be awesome.

We use several apps. Primarily Arduino IDE and paint. We currently use the Arduboy tones library for music.

16. What is your best tip for other people who want to start creating apps/games for Arduboy?

11. What do you read to learn how to code for the Arduboy?

First make sure you buy an Arduboy so you can test your code. Take it one step at a time. Don’t focus so hard on the end results that you get overwhelmed. Do one component at a time. Test, test and then test again.

We learned from reading the library documentation and sample code.

12. What game do you currently have on your Arduboy? All of them have games we’ve written or are currently working on. We’re always testing to see what we can change or make better.

13. What Arduboy app/game is your favorite? Whichever one we’re currently working on lol. But honestly we have enjoyed playing CastleBoy by Dir3kt and Increment and Mystic Balloon by Team ARG.

Developer info: Using the PROGMEM keyword to store data in program memory requires special techniques to access it. The following links are a good source of information on the use of program memory for storing data: Nongnu AVR Lib User Manual Arduino PROGMEM Reference Info Arduino Playground PROGMEM Info

Have someone other than yourself help with the testing, they’ll find bugs easier than you. They’ll also help gauge the difficulty, the game is easier for you because you know what the code/game is supposed to do.

Are you a developer and want to be featured here? Reach out to the Magazine through Twitter DM @ arduboymag

Want to start playing your game or testing your new code faster? If the game uses a recent version of the Arduboy2 library, you can skip the ARDUBOY logo sequence by holding the D-pad RIGHT button when powering up then releasing it, or you can press and release it when the logo is scrolling down. Page 37 of 45


EXPLORE:

Building Arduboys students!

with

Community member Fernando Jerez (@FerJerez) has been guiding the 17 - 19 year old students in his school’s (CIFP Majada Marcial from Canary Island, Spain) electronics program to make $12 compatable Arduboys by providing the electronics and instructions. The classes focus on the hardware (of Arduboy), as the students have no programming skills at this point. First session was about building a Arduboy clone on protoboards / breadboards using an Arduino Pro Micro, OLED screens and cheap buttons and buzzers as pictured on the left. They learned the basics of Arduino related electronics: What are ouput pins, what are ground wires, voltage and amperage basics and a few tips related to making prototypes. With the pin list for buttons and screen they built a functional protoboard-arduboy in approximately one hour.

The students also had a 'learn to soldering' session where the goal was to build a controller soldering the 6 buttons (D-Pad and 2 buttons) in a solderboard, wiring and plugging into the protoboard as pictured above. There were different grades of success, as it was a first time for the students with a solder but it was a fun experience. to be continued next page >> Page 38 of 45


They have a 3D printer in the classrom which is used to learn a few things about 3D printing and prototyping. Pictured above are the final results. A students mini-maker faire (for 12-16 years old kids) was organised where they show the projects developed in their schools. Fernando assists as organizer and talks to students about his Arduboy and clones (and some other 3 printing and arduino creations). Fernando’s conclusion: “Teenagers love electronics, and Arduino is an easy plattform to learn with. They love gaming (who doesn’t?) and the idea of making your own gaming plattform from scratch using a few cheap arduino components is great.

First year of ‘Sistemas Microinformáticos y Redes students: Agoney Rodriguez, Ismael Cedres, Antonio Cedres, Carlos Santana, Raul Santana, Daniel Santano, Victor Brito, Esteban Silva, Victor Diaz, Nicolas Oliviera, and Antonio Cedres pictured in this article.

Other teachers always are interested in using Arduino/ Arduboy clones for their classrooms too. Here in Spain students between 12-16 years old have a few hours of 'Technology'. Ten years ago the 'technology' was about carpenters, ceramic, electricity... but over the last few years it's all about 3D printing, Arduino stuff and programming courses. Teachers love this kind of work mainly because the students are very motivated and we have very good experiences in the classrom.”

Thank you for sharing Fernando! All the best to your students!

Page 39 of 45


EXPLORE:

New Unofficial uploader

Arduboy

by @eried

I am sure that about a second after trying a new Arduboy any person is going to try more games. I felt that too, instantly. Installing a new game was like getting a little gift and I do like gifts. The problem was: where to get those games. The known uploaders and repositories were a good start, however there are so many missing gems buried, I had to do something.

Repository for the games Everything started with the quest for finding a way to maintain a collection of games without having to do much work. A co-worker told me sarcastically that I should use Github (he hates git for some mysterious reason) and his sarcasm turned out to be a marvellous idea. I could use a git repository to manage all the games, one directory per Genre, everything is completely automated. After a new commit a repo.json file is automatically generated and a website is updated: http://arduboy.ried.cl So, the first part of my quest was over. Easier than I thought.

Uploading Games With the repository ready to go I was happy for a few seconds. Now the second issue on how to upload the games became a big hustle.

Figure 1: GitHub repository

All the current Arduboy uploaders are not designed, in my humble opinion, for snappy interaction. I want to see a screenshot of a game, click a button and get the game in my Arduboy. I do not want to choose a file, click on a message button or anything like that. It must be 1 or 2 clicks away, tops. to be continued next page >> Page 40 of 45


The Arduboy world needs a new uploader, hence: Arduboy Uploader was born. You can get the Uploader here: https:// github.com/eried/ArduboyUploader/ releases/

How does the uploader work? The Arduboy is basically an Arduino Leonardo. The Leonardo works with two USB devices, one is used solely for uploading things to the program memory. The system never starts in the upload mode, but switches to that mode Figure 2: Arduboy Uploader after an invocation through pressing the hardware reset button or doing what I will describe in the next steps below. The entire Upload process starts by looking for the correct serial port. The code I am going to use is C# but it might be considered as pseudocode: private static bool GetArduboyPort(out string port) { port = “”; using (var s = new ManagementObjectSearcher(“SELECT Name, DeviceID, PNPDeviceID FROM Win32_SerialPort WHERE” + “(PNPDeviceID LIKE ‘%VID_2341%PID_8036%’) OR “ + “(PNPDeviceID LIKE ‘%VID_2341%PID_0036%’)”)) foreach (var p in s.Get().Cast<ManagementBaseObject>().ToList()) { port = p.GetPropertyValue(“DeviceID”).ToString(); return true; } return false; } What that code is doing is looking for a device that exposes a serial port and uses a specific VID/PID (vendor and product indentification). For the Arduboy, we basically expect: VID PID 2341 0036 2341 8036 If after a while the Uploader cannot find a suitable device, it just shows an error. I designed a series of cute error animations for the program using a neat online tool (www.piskelapp.com) that is also a convenient way to design Arduboy game assets:

Figure 3: No Arduboy found error to be continued next page >> Page 41 of 45


Figure 4: Input file is invalid

Figure 5: Error transfering the file

Now to switch the Arduboy to the uploader mode, we have to open the serial port using 1200 baud as speed and enable DTR (Data Terminal Ready: it is a control signal for serial transmissions): private static void SendReset(string port) { var arduboy = new SerialPort { BaudRate = 1200, PortName = port, DtrEnable = true }; arduboy.Open(); while (!arduboy.IsOpen) Thread.Sleep(Resources.WaitIdleFastMs);

}

arduboy.DtrEnable = false; arduboy.Close(); arduboy.Dispose();

Why do we have to use that specific speed? Just because the bootloader (Caterina) was coded like that. As I commented earlier this could be achieved by also pressing the reset button on the Arduboy. Now, the Arduboy has been switched to the uploader mode and it created a new

serial port (at least for 8 seconds, after that it returns to the normal mode if the uploading has not started). We need to call again the routine (GetArduboyPort) for detecting the serial port. Finally, we use AvrDude (http://www.nongnu.org/avrdude/) to upload the code.

var processStartInfo = new ProcessStartInfo() { CreateNoWindow = true,RedirectStandardError = true, RedirectStandardOutput = true, UseShellExecute = false, FileName = “avrdude.exe”, WorkingDirectory = Environment.CurrentDirectory, WindowStyle = ProcessWindowStyle.Hidden, Arguments = $”-C custom.conf -p atmega32u4 -V -q -c avr109 -P {serial_port} -b 115200 -D -U flash:w:\”{hex_file_path}\”:i” }; to be continued next page >> Page 42 of 45


The arguments used in my example are the same that the Arduino IDE uses, with slight modifications (speed and the custom.conf). All these steps, form the upload process and they are executed in order by the

Arduboy Uploader to achieve the smooth upload you can experience yourself by using the program. Additionally, we can do sweet stuff like rejecting invalid-looking files to avoid breaking our Arduboys:

if (!File.Exists(input) || Path.GetExtension(input).ToLower() != “.hex” || Path.GetFileName(input).Contains(“.with_bootloader.”) || new FileInfo(input). Length > Resources.ParamMaximumHexFilesizeKB * 1024) { throw new Exception(“Invalid hex file”); }

Bonus Track In the repository website, there is a button with the label: “Upload to Arduboy” that seems to work magically after installing the Arduboy Uploader:

If you check the URL of that button, you will find a link that actually does not start with the typical “http://” but a rather strange “arduboy:”. This is because, when you install the Uploader and associate the filetypes there is a new registry entry in your PC:

What this does is to call the program directly from the webbrowser. Arduboy Uploader downloads the file for you silently (and since the games are usually so small there is no noticeable delay)… magic!

Happy Uploading!

Page 43 of 45


#arduboy:

Still feeling Lucky with Arduboy! Yellow, corresponding with Earth, is considered the most beautiful and prestigious color. The Chinese saying, “Yellow generates Yin and Yang�, implies that yellow is the center of everything. Yellow signifies neutrality and good luck. Yellow is sometimes paired with red in place of gold. Yellow Golden Back Arduboys still available here!

@brzezinskitv

@astro_andre

@omurot

@murdokibz

@mt_nabe

@vjbab

@ brzezinskitv

@psicoff

@brzezinskitv

Post your photos with Arduboy on Instagram and Twitter with #arduboy. We want to feature them in this segment! Page 44 of 45


Thank

you!

Thank you for reading the Magazine! Hope you enjoyed it as much as we did putting it together. We want to know how to make Volume 6 better than the last, so write in to us to tell us what you think!

https://twitter.com/arduboymag


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.