Pokitto Magazine 002 FREE PREVIEW

Page 1

YOUR ONE-STOP SOURCE OF INFORMATION ABOUT YOUR FAVOURITE DIY CONSOLE

July 2020

MAGAZINE ISSUE 002

GAMING MEGAMAG! Game reviews Making of Canabalto Game Jam winners

DEV FemtoIDE Python Basics ARM Assembly!

1


E? Great! Go to: R O C S H IG H W E N a Got om/c/highscores/40 https://talk.pokitto.c

HIGHSCORES! Kong II Cutie Critters Galaxy Fighters

GAME A Filmote Sbmrgd Torbuntu Tuxinator Torbuntu

568400 359270

Ball Bust

238 220 118

GAME B Tuxinator Sbmrgd Torbuntu GAME C Tuxinator Torbuntu

496 33 23 125 13

Sbmrgd Jez Torbuntu

3322505 1059557 315963

Canabalto

Raquer*Mete

Tuxinator Torbuntu

Vampirics Tuxinator HomineLudens

3350 3260 Sbmrgd Denismr Vampirics

2

31020 17910 4360

8790m 3009m 2081m


ARRAY

of

Contents Dark Ritual

Cover Story - Exclusive Review!

Endless Forms Most Pokittoful Game Review

Making of Canabalto

A daring Java game dev story

Learn Python with Hanski, part 2 Second episode of microPython tutorial

Photo Booth

Community Photos from around the world

Don’t Forget a license!

Open source is not open without a license

Espresso Shoot

Interview with game jam winner HomineLudens

Hey JOE!

Interview with game jam winner Spinal

IR Remote controller

Turn your TV on with your Pokitto

Planet Escape 0.5.0 Game review

FM Radio Hat

A simple kit turns Pokitto into a radio

FemtoIDE

Fast tracking to Pokitto game development

Pipes - tutorial

Write a game in C++ using FemtoIDE

ARM Assembly, part 1

Learning to code in ARM Assembly language

Hardware Schematics, part 2/2 Schematics of Pokitto

04 06 08 12 15 16 18 20 26 27 28 30 34 40 43

Welcome to Pokitto Magazine number two! We are back at it again with the second Pokitto Magazine! Much has happened since last time. Pokitto is a device for gamers, and this magazine highlights the Pokitto’s gaming potential with our cover story featuring the recently released Dark Ritual by Press Play on Tape, the same team that brought us Kong II, Galaxy Fighter and many others. For the gamers, community members Tuxinator, Tuomo, and Zockeromi give us some great reasons to play more Pokitto games with their game reviews. Game Highlights show the inner workings of how games are made. Drummyfish explains the importance of licenses so you don’t have to worry about legalese. For the developers, there are a handful of tutorials for all levels of developer for Software and Hardware hacking, including more Python basics from Hanski and C++ in depth with filmote. And, for the intrepid adventurers, we have an intro to Assembly by the very same mind behind FemtoIDE, Fmanga! We also have the second part of the much anticipated Pokitto Hardware Schematics from Jonne! -Tor July 2020

3


Dark Ritual

Exclusive review by Tuxinator2009 of the new Press Play On Tape survival horror game

IVE

S U L EXC EW!! I V E R

Don’t forget to free your fellow cultists along the way

The dark god Drakull has murdered you

and your fellow cultists and trapped your souls in the underworld. As the leader of the Moon Cult you, Zakarël, must delve deep into hell as you gather treasure, defeat monsters, and find the ancient runes needed to free yourself and fellow cultists. Spiders, snakes, and ogres oh my, and is that chicken I smell? Do you have what it takes to make it through the labyrinth and come out victorious or will your soul be forever trapped? Only finding all six runes and kneeling at the altar will allow your soul to ascend back into the world of the living. Just don’t forget to enjoy some delectable bread and tonic along the way.

Walls can provide excellent cover for attacking from a safe distance

Gameplay

I find the core gameplay mechanics to be fairly simple and only requiring a very basic understanding of RPG’s (i.e. eating bread will restore

4


some health). There’s an optional tutorial level to help learn the basic mechanics of the game. There’s plenty of challenges with a good mix of pre-made levels and randomly generated levels making for a unique playthrough on subsequent runs.

Presentation

I find the overall package to be really nicely done. The tiles are simple in design, but well suited for the gameplay. The soundtrack adds a nice dark foreboding feeling to the game and the sound effects do nicely to increase the depth of the gameplay. Unique background music for levels, shops, and boss areas provides for a nice variety of immersion.

soundtrack. I find this game to be very enjoyable overall and well worth a second run, or two, or twenty. I can tell this is one I’ll definitely be going back to on multiple occasions even after I beat it. Overall Press Play On Tape has done a really good job in delivering yet another great game for the Pokitto.

Story

Barrels can sometimes contain money or even food so be sure to destroy all of them

Dark Ritual’s simple, but compelling, story gives you a sense of purpose and does a nice job of explaining the situation. Every cultist you meet along the way will have some interesting information for you, whether it’s a helpful tip or more details on the story.

Score Gameplay: 2.5 Play time: 3 Presentation: 3 Community bonus: 1

Playability

The game starts off fairly easily, and the semi-randomness to the maps adds good replay value as well as the overall challenging nature of the game. The core mechanics are simple enough that it doesn’t take long at all to figure out how to play and what to do. As you progress you start to get better at dodging enemies and destroying them. Plenty of save spots make it easier for more casual players to have fun. However, loading resets your score to zero so if you want a high score you’ll have to do it with one life. For those brave enough to beat the game there’s a hidden extra hard mode that will provide an even greater challenge for the true hardcore players.

Pokitto

9.5 Traps are everywhere so watch your step and try not to get yourself impaled or cooked

/ 10

~Tuxinator2009

Difficulty

Plentiful save posts makes for an easier experience for the casual players allowing you to load your last save when you die or pause and come back to the game later continuing where you left off. For the hardcore gamer who wishes to get a high score you’ll need to do it without dying because, as previously mentioned, loading your game will reset your score to zero. There’s even a hidden extra hard mode for the true masochist cultists, but you’ll need to beat the game to learn how to unlock it.

Overall thoughts Shopping smart is essential to getting further in the game

Fun and exciting with a decent challenge and enchanting

5


Endless Forms Most Pokittoful

Zocker Omi enjoys Oldschool Platform Goodness on Pokitto

Gameplay

This game is a typical example of easy to learn, hard to master. You control a cute little creature collecting things called imps on horizontal platforms and avoid enemies while a clock is ticking to end your attempt to reach your task. You can change platforms at certain points (teleporters activated by pressing up and down) or leave the screen at the left side to ascend a level or on the right side to descend a level. To complete a level all imps have to be collected. If an enemy touches you, you lose a life. Sometimes

6

imps drop bonus items like more time, bonus points, freeze enemies or extra lives. Levels and enemies are randomly generated. So nothing new really, but well made.

Play Time

As it is just a hunt for highscores, you might play the game as long as you like. This might seem a concept that doesn´t fit into the idea of good gameplay in 2020, but if you start the game you will get this typical arcade feeling of: “Alright, one more try, I know I can do better!” And so I always return to this game and play some


rounds. There isn´t much to discover or anything to unlock or progress, but as the original game came out in 2012 under the name “Endless Forms Most Beautiful” on Spectrum (there are also versions for PC and C64) made by Dave Hughes, I think the idea was to revive the good old days, where the gameplay itself is enough to keep you entertained and that`s what it does on Pokitto also.

E M GA IEW V E R Pokitto

Score Gameplay: 2.5 Play time: 3 Presentation: 2 Community bonus: 1

8.5

/ 10

Presentation

It is cute. Really cute! The main character would make a great stuffed toy. Even the enemies look cute and as much as you try to avoid them, you will never hate them, because they look like they are not there to be nasty. The graphics are clean and the colors are chosen wisely to add atmosphere and not to distract you. The sound is nothing special, but adds to the arcade feeling and always underlines what happens on the screen. I wish we had some more enemies or music tracks, but the possibilities of the hardware might prevent more variety. (The computer versions also have more items because of hardware limitations).

~Zocker Omi

Community bonus +1

I did find license information on github and good documentation including all the original sources on the Pokitto forums, and JVDW007 is always answering questions and open for suggestions regarding his games. https://github.com/jvdw008/efmp https://talk.pokitto.com/t/game-endless-forms-most-pokittoful/1944

7


Making of CANABALTO

Agent HomineLudens takes us through a daring Java game mission on Pokitto

Canabalt origins

A V JA ! V E D 8

It was sometime around 2010 when I first experienced Canabalt. I was gaming at a friend’s house. Between games, we had breaks by surfing the web. That is when we stumbled upon this simple and addictive flash game. I think it was one of the first times we found a game that was good, yet playable in a browser for free. Just one button to press at the right time. The gameplay was just magically balanced, and like a magnet it attracted us to play more and more. We played game after game, beating our own best scores. The computer

we played on was connected to a big stereo and we pumped up the music until it was late. I really loved the simplicity. I was used to games with complex controls and gameplay, but Canabalt was a real surprise: it extracted just the juice of a game and tuned it to perfection. You escape from an unknown peril, with ever growing tension, measuring every jump, determined to reach a new record and discover something new. As the father of endless runners, Canabalt is, by far, still the best. Fast-forward several years later, to Pokitto’s Discord channel. A place where someone with great talent


enjoyed throwing gorgeous mockups like hooks, to see if some poor programmer would catch the fly. @Vampirics was the man, and by the casting of his hook a journey began.

the 90’s. In truth, it was not that easy. You can run it on other OSes, so long as a compatible version of the JVM was present. For years, Java improved and various subsets were adopted to allow it to run on even DVD players and mobile phones (JME, or Java Micro Edition). Still, detractors said it was “heavy” and slow compared to native applications, written in C++.

Java on MCU!?

The ante-fact

FemtoIDE had recently been released and the Pokitto Java Jam was about to start. I had been playing with some code in the new Java transpiling magic @FManga was building, since he had asked me to write some code snippets to test it with (he was doing “TDD”, he said, and I had to look it up: Test Driven Development). Making a small game with a new tool looked like a great way to not be overcome by another side project. Building a small game as a more extensive test of the solidity of the framework seemed like a good idea. In hindsight, maybe it wasn’t.

Java?

Everyone knows Java, or has heard of it at least. It isn’t JavaScript (and BTW, HTML is not a programming language). Also, it isn’t usually considered the most lightweight language. It’s interpreted, with bytecode that runs under a virtual machine (the Java Virtual Machine, or JVM). The promise is that you can “write your code once, and run it everywhere”. This was the Java motto, during

How is it possible to run Java on a microcontroller with few kB of RAM? Good question! The answer is: it’s not! Simply, there’s not enough resources (RAM) to make it run on Pokitto. But then a Brazilian boy, with some crazy skills, threw out an idea: Why not take Java code and transform it into C++? Probably because it would be damn hard and would require lot of time / coffee / capabilities? A few minutes later (OK, maybe not minutes …), the Brazilian Boy had made a new transpiler and IDE for writing and converting Java code into Pokitto-ready C++, complete with an optimized Garbage Collector and many other Java goodies. The result is quite impressive, leveraging the power of a high level language, on a device with the bare minimum. But maybe here @FManga could explain better than I: Java. Designed in the early 90’s, it was meant to run on fancy remote controls. Due to its simplicity, its growth exploded and soon it could be found on all sorts of hardware, from phones to servers, and battling for first place in language popularity rankings.

One place it couldn’t be found: the Pokitto. With only 256kB of flash and 32kB of RAM, the device barely has enough space for the games it runs, let alone a virtual machine. If Java were to be used to make games for the Pokitto, it would have to be without a VM. Compiling directly into welloptimized native code isn’t trivial, however. So let’s stand on the shoulders of giants: translate Java into C++ and leverage the enormous amount of work that has gone into GCC instead. Still not trivial, but it made it possible to have Java games released within a few months.

The pause screen glitches effect. It was born to celebrate the numerous times memory was corrupted.

Making the game

Once upon a time, when Java was at its newly-released infancy, I made a project with it. Then I never used it again. Now, here I was, trying to make a game with it. From the beginning, I was trying to make things in an OOP way: modeling classes with a common Interface and dynamically adding objects at runtime. In theory, the Garbage Collector would take care of the unused resources. Finding out what is actually unused is more easily said than done, however. In the first

9


versions of the compiler, it would delete things it wasn’t supposed to, and keep others around forever. Iteration after iteration, the game’s codebase was simplified to avoid memory allocation. As the player jumps from one building to another, new buildings on the right are generated by recycling the ones that leave the screen on the left. This infinite runner needs only three buildings in memory. This also has the benefit of avoiding memory fragmentation.

Making of CANABALTO

Parallax, jumping and other stuff

As soon as @Vampirics prepared some assets (player animation and background), I started to put together some basic logic. Parallax scrolling and animation was smooth, and it give me confidence that Java on Pokitto was something that could work with good performance. After that, we really needed some basic game play, so I faced the task of implementing the jump mechanic. There’s a wonderful article (https://www. gamasutra.com/blogs/ AdamSaltsman/20100929/88155/ Tuning_Canabalt.php) written by Adam Saltsman (the maker of the original Canabalt) where he explains the way he tuned his jump mechanics. It is very important to get it right, since jumping is the key aspect of this game. Adam did a lot of analysis and consideration on the feeling of the gameplay by adjusting field of view, the speed and the jump. The Pokitto’s screen has a different aspect ratio, and a much lower resolution. So I went mainly with the “feel right” meter, tuning gravity, speed and acceleration. With plenty of testing and luck,

10

Canabalto on Pokitto also has the less-known 2-player game mode jumping felt quite right from the beginning. Thanks to @Vampirics I had a second opinion, so I was quite confident. From there, it was just a matter of adding more. We started with the crane and then a cracked building. That required logic for falling and a trigger mechanism had to be implemented. The falling building threw debris and sometimes you could run through groups of birds. If you look closely, you might see that the birds have a familiar shape…

The starting building has a glass window that the player breaks at the beginning of his escape. Sound support came to Java, with a handy API that allowed streaming a maximum of 4 different sounds. Hearing the window crash, or the the birds fly away, was really satisfying. Lots of little improvements, but not always implemented in the best way. Some of the refactoring was due to not really understanding the RAM and resources used. Then there was an oversight: I hadn’t implemented a particle manager of any kind. I resorted to attaching birds, stones and glass to buildings. Other refactorings were just due to me trying to make


a game with little Java experience and in short time. So at the end I had both “Spaghetti” code and “Lasagna” code. Luckily for me, @FManga dropped me some precious help on nailing some nasty bugs and stupid mistakes.

No more space? Optimizations!

Sooner or later in Pokitto development, you’ll face the beauty of limited resources. Maybe beauty isn’t the best term, but like the checkout at your preferred online shop, after a compilation you’ll see that every little thing adds up and your cash is limited. So you go back to your shopping cart and look for things to trim. Especially if you really need to keep that expensive and cool intro animation you just received. After an initial moment of depression, it turned out there was some wasted memory with the sound samples used. Audio is very space-consuming, particularly when that nice crashing glass sound that you hear for a half second was gently fading out for a couple of seconds more, till it became a nearly inaudible whisper. Trimming the samples was still not enough. So I went deeper into asset optimization. The buildings now became composed of reusable little tiles, flipped randomly and patched with decorations.

Submission date!

The Jam’s submission date was October 31st, 2019. So the end of October, right? The announcement was made at the end of July and, believe me or not, for some strange reason I messed up the dates. For most of the competition I was convinced the submission was due before the end of September. I’m not sure how I misread the date, nor why I didn’t discover the error till the last week of September. @Vampirics was pushing on the game with ideas and great pixel art in a constant, high flow of interest. Only now I’m starting to get used to his kind of attitude in game development, so I was sure the time was running out and the game was behind schedule. The fun fact is that, after quickly wrapping this game up, we started working on our entry for the Jam (as Canabalto did not fit the theme). That other entry, Espresso Shoot won! Anyway, imagine my feelings when our “Art Director” came up with the 2-player mode idea, just a few days before what was supposed to be our release...

Two player mode

“Have you ever see the 2-player mode for Canabalto?”, he said, while sending me a link: https://www.youtube.com/ watch?v=A03rhUNTEM4 I’m not sure 2-player mode is official, but if possible, that seemed to make the game even better. I was both annoyed and curious, as I’d never played the game that way. It really added a great, local multiplayer, experience. The whole new logic is genius, and gave me a great vibe. Some video games really are a work of art. Finding a new way to

expand their dimension is magical. The only problem was: I had to implement it all in the shortest time possible! I had to change so much code, running the risk of breaking everything. In the end, we managed to do it and I’m proud of the way it turned out. It allowed me to have some fun moments with my kids. And for the crazy ones among you to have some really crazy ideas: build some kind of foot switch you can jump over, attach it to Pokitto’s PEX and control your character by stomping like a boss! Actually I’m not really sure why the intro came at the end, but it’s nice to put it here now. The beauty of this intro is something I really couldn’t hope to reach alone. I can say it’s simple, yet effective. I remember @ Vampirics endlessly pointing me to either adjust the background scroll speed, or to move the High Score text just 1 pixel away to better align with the ceiling. It has been a highly educational experience for me, and it taught me again the importance of teaming-up with the right people to make a project. My completed vs unfinished projects ratio has risen to the stars, after I finally met some great people in the Pokitto community, bringing with that the satisfaction and gratification of having published some good games.

Special thanks

Vampirics: Teamwork really works, good productive time, and passionat game maker. FManga: Once again a giant with comfortable shoulders.

D!

ON ISHE I S MIS OMPL ACC

11


Let’s learn with Hanski! PART 2 More Python Game Programming Basics

This is the latter part of the game programming basics of MicroPython in Pokitto. The first part was in the issue #1, “The More You Know”. Please read it first as it has essential knowledge needed for understanding this article. There was a very simple game done and explained in the first article. Now we make it a more complete game with animation, sounds and high score saving!

to right” animation frames, which can have, say, four frames, and each frame duration can be e.g. 200 ms. Showing those frames in sequence looks like the character is walking to the right. There can be several animation sequences for different purposes, like walking, running, fighting, etc, but in our game we are using only one sequence. Below are all the animation sequences for the game objects.

Pic. 2. rocket and robot animations Pic. 1. four walk animation frames

Animate

E M GA ! V E D 12

Animation makes the game objects alive and gives them personality. For animation you need a sequence of animation frames, i.e. bitmaps, which you will show one after another. Usually, when talking about overall frames-per-second (FPS), a “frame” means the period of time when the game engine processes and draws the whole screen once. An “animation frame” is a different thing and relates to an individual character animation. The character can have e.g. “walk

Instead of having a timer to show each frame for a certain time, we use the screen frame counter to measure time. The expression “if frameCount % 5 == 0:” will be true once in 5 frames. If the screen frame count is e.g. 25 FPS, the expression is true in 200 ms periods. We can use that for switching the frames for our character animations. The graphics and sound data is now in its own source file: “data. py”. We include it at the start of the main.py file: import data


Now we have access to all the global scope objects in the data. py file. The rocket is animated every 5th screen frame. The current animation frame is being drawn to the screen. The rocketAnimFrames is a list that contains all three animation frames.

# Animate the rocket if frameCounter % 5 == 0: rocketAnimFrameNum += 1 if rocketAnimFrameNum >= len( data.rocketAnimFrames ): rocketAnimFrameNum = 0 # Draw the rocket animation frame screen.blit( data.rocketAnimFrames[rocketAnimFrameNum], rocket[0], rocket[1] ) # Increase the screen frame counter. frameCounter += 1

And finally, the screen frame counter is increased at the end of the game loop.

Make some noise!

The Python editor makes it very easy to add sound effects: just drag-and-drop any sound effect file over the game source file. It depends on the web browser, but at least the WAV format should always be supported. The Python Editor automatically converts the audio file to the 4-bit, 8 KHz raw data format to save ROM space. Because of the limited format and the limitations of audio capabilities you might need to try several audio files before finding the one that sounds good enough on hardware. It might be a good idea also to edit the sound first with a program like Audacity. You can e.g. amplify the sound if it is too silent. After dragging and dropping the sound file over data.py, the converted audio data launchRocketSfx becomes a byte literal inside our code. launchRocketSfx = b’\ \x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\ \x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x77\x76\x77\x77\x78\...

In the main.py we need to create an instance of the sound class at startup. # Start audio sound = upygame.mixer.Sound()

Then, to play the sound we call just play_sfx(). Thats all! sound.play_sfx( data.launchRocketSfx, len(data.launchRocketSfx), True )

Note that audio works only on HW, not in the emulator.

Saving scores

Most games have some kind of scoring system. For saving the scores between gaming sessions, Pokitto HW has the special memory (EEPROM) that can be written to, and which stores the data even if the device is shut down. Each block of preserved data is called a “cookie” in the Python API. You can give a cookie a name and store your best scores to Pokitto. Next time the game is started the cookie is read and the high score is shown to the user. The cookie API is used like this: # Initialize the cookie. myCookieData = bytearray(1) # Only one byte myCookie = umachine.Cookie(“MRROBOT”, myCookieData) # Load the cookie from EEPROM myCookie.load() highScore = myCookieData[0]

13


If the cookie of that name does not exist in EEPROM already it is automatically created. The maximum length of the name is 8 characters. Saving is done as follows: # Save the cookie to EEPROM myCookieData[0] = highScore myCookie.save()

Note that writes to EEPROM are not saved in the Pokitto emulator. It works only on HW like the sound. You can browse and manage cookies in Pokitto with the excellent Xploritto tool by @bl_ackrain, but no cheating, please!

Mission completed!

Almost done! The only thing missing is the ability to restart the game after the end. When the player is hit, we set the variable isGameRunning to False, and draw the objects only when isGameRunning is back to True. That happens when the user presses the A button so that we can restart the game by setting also the frameCounter and rocketList to their initial values. if eventtype.key == upygame.BUT_A: # Reset the game to the initial state isGameRunning = True frameCounter = 0 rocketList=[[20,-40],[40,0],[60,-60],[80,-20],[100,-80]]

The game source codes are now too big to be listed here, but you can have them in GitHub. See the “Links” chapter.

Pic. 3. Screenshot of our little game. Now you can begin to add more details!

This part 2 concludes my “Python game programming basics for Pokitto” article series. You can now experiment and improve the game to your liking: add the explosion animation and the sound effect, create different kinds of enemies, add bonus weapons or shields for your character. The possibilities are limitless! There are also a lot more fancy features which you can use in the gaming API, uPyGame, like using a tilemap or playing music from the SD card.

Links The source codes: https://github.com/haviital/MrRobot

Thank you Hanski!

The Pokitto gaming API for Python (uPyGame): https://talk.pokitto.com/t/wiki-reference-pokitto-gaming-api-forpython-upygame-and-umachine/1615 Free sounds: www.freesound.org

d? on lanvel e v i l n e ytho e C-l does tP’s above th y h W Q: ause i A: Bec 14


PHOTO BOOTH!

Sweet summer

Hello Kitty

Aspen was great!

Mr and Mrs T.

O sole mio!

Can I play too?

15


§

Don’t forget a License!

Drummyfish on the importance of licensing your open contributions

When I joined the awesome Pokitto community, I found that many great projects forget to attach a license to let others know in which ways it can be used. It’s understandable - we’re here to have fun, why care about boring legalities? It doesn’t make me happy either, but the truth is that due to strict copyright laws it is important even for programmers to take some minimal steps in order to properly share their programs. The licence (or lack of) will affect the popularity of your project and the audience you reach, whether you’re aware of it or not. Let us therefore briefly go through the basics so that your next project is ready to be properly shared! We’ll focus on open source licensing here as Pokitto is an open source community and the topic of proprietary and commercial licensing is more complicated.

Why license?

I’ve already mentioned copyright laws. These say that even if you make your source code public, by default you still keep all rights to what can be done with it. It is therefore important to know that it is not open source without a license. Yes, just the availability of the source code isn’t enough to call it open source because that code technically doesn’t give anyone the rights to work with it -- it’s like the author just displays it in a museum, just for the viewing. Using or modifying such programs is technically a copyright infringement. That’s why we need to clearly state the rights we give along with our program. There are two big authorities in the licensing world: the Open Source Initiative (OSI) and the Free Software Foundation (FSF). Simply put, what OSI calls open source the FSF calls free software (free as in freedom, not price!). Let’s avoid this naming mess by using the term free and open source software, or FOSS for short.

16

Both FSF and OSI have their own definitions of FOSS. These definitions are very similar, and in simple terms say FOSS has to allow anyone to freely: 1. Run and use the program for any purpose (even commercial) 2. Study and modify the program. This requires the source code to be available 3. Redistribute (share) the program (modified or not) So your program can only be called FOSS (open source) if it fulfills all these conditions. You can state additional requirements, such as author attribution, but must not break the above mentioned conditions, otherwise the program is not FOSS by definition - we call such programs proprietary (sometimes also closedsource, or source available if the code is public). If your program is FOSS - that is it comes with a proper FOSS license - other programmers know they can help improve and maintain it without having to worry about law trouble.


They can build upon the work of others without reinventing wheels, they can analyze the security of the program, customize it, use its parts as Lego bricks, and do all kinds of other great things. The license not only gives rights to the masses, but also protects the program and its users - e.g. the GPL license holds that the program stays FOSS and no company can make it proprietary. It keeps the community work in the community. These clearly stated rights are what drives big FOSS projects such as Linux or Arduino. What happens when there is no license? The author is in a better position to make the program commercial, but the program is dependent solely on the author, which can be discouraging to the users. Take a look at the old DOS games - they simply die as soon as the company stops maintaining them. This is why it is important to always use a proper FOSS license unless you specifically intend to keep the rights for specific (mostly commercial) reasons.

How to add a license to your project

It’s easy! Both OSI and FSF maintain a list of licenses they approve of -- you just pick one up and state that this is your license. This is how it’s usually done: • By adding a plain text LICENSE file to your repository alongside the source code. The file contains the copy-pasted text of the license. Systems like GitHub and GitLab support this method: you can automatically add a license file from their website. The system will recognize the file and will add a nice license icon alongside your repository. • By stating the license in the comments at the beginning of each source code file. You can do either of these or both, depending on situation. E.g. if you only have one source file, it’s convenient to just use the comment method.

Which license to choose?

There are many licenses made for sharing code (and/or general works of art). Let’s list the most common ones (this is just a summary, don’t forget to read the license before using it!): license

summary (conditions)

notes

find at

MIT

Modified program has to mention the original author

Most common license at GitHub. Typical for small programs and libraries. Note that anyone can e.g. make the program proprietary.

mit-license.org

GPLv3

Modified program has to be shared under the same license (so called copyleft).

Also among the most common licenses. Protects your program -- no one can make it proprietary. However, it is a bit complex and more difficult to follow.

www.gnu.org/licenses/ old-licenses/gpl-3.0.en. html

BSD 3-clause

Modified program has to mention the original author’s name which can’t be used to promote the modified version.

opensource.org/licenses/ BSD-3-Clause

Apache 2.0

Modified program has to document the changes made against the original.

apache.org/licenses

CC0

You give up all your copyrights and give the work to the public domain. No conditions.

Anyone can do anything with your work without any conditions. CC0 however doesn’t address patent issues.

creativecommons.org/ publicdomain/zero/1.0

Blue Oak Model

Only a link to this license has to come with the program.

A new license -- very simple to follow (only one simple condition), addresses issues of older licenses.

blueoakcouncil.org/ license/1.0.0

It should also be noted that if your game includes someone else’s code, for example a library, which is copyleft licensed (most often the GPL), you’re required to license your work under copyleft license too. You have no choice here. This prevents close sourcing the program but is also a small burden placed on the users and a reason why many developers use non-copyleft licenses such as the MIT. When you’re familiar with licensing, there’s a possibility to license your precious game data (graphics, sounds, texts etc.) differently from the code. There exist special licenses for these purposes, most notably Creative Commons, which allow you to fine-tune the details. For example, you can forbid commercial use or derivative works of the game art (which however makes it no longer free as in freedom!). For more information please visit creativecommons.org.

Conclusion

The main point is that nowadays you should always think about usage rights when sharing your games, and not only games -- even if you don’t want to make your game open source for various reasons, please make it explicitly clear there is no license. Hopefully the whole topic is a bit more clear now. If unsure about details, feel free to ask away in the community, we’re here to help! author: Miloslav “drummyfish” Cíž, released under CC0 1.0

17


Hanski interviews some of our Pokitto Game Jam Winners

“Espresso Shoot� by HomineLudens and Vampirics won the Java of the Dead game jam

Since the issue #1 there have been two game jams in PokittoLand. The first, Java of the Dead Jam, was in JulyNovember 2019. As the name implies, the jam entries were to be made in Java language for Pokitto. Btw, I do not know any other MCU device that has Java support! Java jam was won by the game Espresso Shoot by the Pokitto forum members HomineLudens and Vampirics. The game required fast reflexes and included zombies. It really pushed the whack-a-mole genre and made it more interesting!

Vampirics, graphics artist and game designer Tell us something about yourself I am a father of 3 kids, Graphic Designer by profession. I live in QuĂŠbec, Canada. My interest for video games and game design started with the Commodore Vic-20 that my dad bought when I was a kid. From there, without even knowing english (I only knew

French back then), I was on a mission of typing all the lines of code in the big instruction manual to see and understand what was happening. Other interests I have are board games and music.

How did you get to know Pokitto and the Java Jam? Pharap is the person that introduced me to the Pokitto. After some research on it, I decided I wanted to try it out. After trying out what had been done on it, I decided to help on the graphic side of things on the Pokitto. I heard about the Java Jam on the Pokitto forum, the theme Java of the Dead was fun to me.

18


Why did you choose to make graphics for the Espresso Shoot game? I became friends with HomineLudens on the Pokitto Discord channel. A little bit before the Jam we worked on Canabalto, a conversion of Canabalt for the Pokitto using Java for Pokitto. So we decided to team up and make an entry for the Java Jam. One thing to note is that while it’s true that I was the one working on the graphics, something that people often forget is that I also work on the game design part as well. HomineLudens is so great to work with that even with the stress of having it done in time, I had fun working on Expresso Shoot.

How did the project go? The project changed a lot during development, at first we were going for a game where you drive around in first person perspective and shoot zombies on the road… it started to look interesting, but we decided to try something else because to make it run fast enough it would have taken us maybe too long. Then we got the idea that something based on Whack-A-Mole but with zombie heads popping out of holes on the ground to steal coffee cup could be interesting. Simple but fun. Me being me, I wanted it to be violent a bit so why not using a shotgun to blow their heads off right? And we need to stay awake all night to stay alive, so we need to actually

drink coffee to not fall asleep. From my point of view the hardest part was to make something that looks gory, but not too much so that it becomes a turn off for some players. Then there was the Trophy mode where you have to shoot the golden trophy from the hands of the zombies so that they don’t steal it. balancing that was challenging as we had to find out the right timing and the fact that we didn’t have enough screen to actually see where the trophy was in the air after shooting it.

coded a couple game on that one, not just graphics.

How was the development environment (IDE, documentation, etc.)? I didn’t work on the programming part at all on this one, but from what I saw and how HomineLudens talked about it FemtoIDE was easy to use and even has a built-in emulator so that you can try out your game as you build it!

How do you think Pokitto is different from the rest of the handhelds? What makes the Pokitto different to me is really the Community and its maker Jonne. the fact that we can do all sort of things with the PEX connector on the top makes it special as well. And I have to admit that the overall look of the device is just so full of personality to me.

How do you feel about Pokitto Community? The Pokitto community is like an alternative family to me. Really welcoming, always ready to help someone if needed. And a lot of the users are working really hard to make the Pokitto a better device. What other platforms you are making graphics for? I am also working on games for the Arduboy, really different from the Pokitto, smaller screen, and only 1bit graphics. The challenge is interesting as well and I actually

Tell us your 3 favorite games for Pokitto My most played games on the Pokitto are Canabalto (mainly because we had a small score competition for a while on the Pokitto Discord channel), Planet Escape, and Galaxy Fighters.

Any advice for the newcomers in Pokittoland? For anyone wanting to learn programming or just share ideas or even team up with people making games, just make the leap, come and talk to us on the forum. It’s all about doing what we like and having fun doing so. Are we going to see more great games from you for Pokitto ? Some games that I am working on should be released soon, Dark Ritual is one of them.

19


Hey JOE! Hanski interviews Spinal, the winner of our PUNK GAME JAM From Diesels to Bagels

The 2nd jam was called Punk Jam, and it was held in April-May 2020. This time the game entries had to use the brand new TAS mode (TilesAnd-Sprites) in C++ or Python. The theme was to be something punk: steampunk, cyberpunk, dielselpunk, bagelpunk, you name it.

The punk jam was won by the Joe game by a forum member Spinal. JOE is a 1-bit platform game with simple and beautiful graphics.

Spinal, tell us something about yourself

I am most famous on the internet due to a lump I use to have on my foot and I often don’t finish games or hardware projects that I start. How did you get to know Pokitto and the Punk Jam? I learnt about the Pokitto thanks to watching videos about the colourizing Gamebuino games. The idea behind the Pokitto interested me so I backed the Kickstarter project and became an active part of the community. I learnt about the Punk Jam through the forum and discord channel and decided to enter as a way to motivate me to actually finish

20

building a game. Why did you choose to make a 1-bit platformer game, Joe? I had been wanting to make a platform game for the Pokitto for a while and the Punk Jam seemed the ideal time to do it. Joe is a character I had inherited from a member of a different community many years ago, although his look has evolved slightly since his adoption his 1-bit styling has remained the same. He has featured in a few games I have created for different platforms such as Nintendo DS, SNES and Arduboy. The Pokitto version is a reimagining of a game I had created for the OUYA, although that version wasn’t so punk and the story tweaked slightly to help lead the way for the planned sequel.


How did the development go (time, easiest and hardest things,etc.)? I spent quite a bit of time on the game, especially the music and sound effects selection. The most difficult part was getting the right balance to ensure the game would be seen as fitting into the Punk parameters of the Jam, adding subtle music, background graphics and collectables were all carefully considered to create a world that had a slight Punk Rock feel to it.

How was the development environment (IDE, documentation, etc.)? I’ve been using the Femto IDE for a little while now and from all of the choices for coding on Pokitto, I think this is by far the best. I can’t really comment on the documentation much, I tend to only read it when I get stuck.

How do you feel about Pokitto Community? The community has always been a great place full of enthusiasm, especially during the Jam as it helped steer a few decisions I made while creating Joe. What other platforms are you coding games for? Currently none. I had tried out the Arduboy for a little while, but it didn’t hold much excitement for me.

still a game I play quite a lot. 2. Cutie Critters - Nice gfx, very simple gameplay, you can play for ages or just have one go if you like. 3. PiCross - You can’t beat the classics and I enjoy a good puzzle game How do you think Pokitto is different from the rest of the handhelds? It reminds me of the old 8-bit computer of the 70’s and 80’s where it isn’t just about gaming. The Pokitto is about learning more than anything else, it encourages experimentation with both the software and hardware. If you want to monitor how fast your bike is moving, if you want to listen to the radio, if you want to add a joystick and extra buttons the Pokitto will let you try and the Pokitto community will help and encourage you to do so.

e? bit gatm 8 a ! r n e e a k bet d of y ma Q: Whgame insteoauld be a bit 9-bit cause it w A: Be

Any advice for the newcomers in Pokittoland? Just jump in with both feet. Whether you come just to play a few games, to build some kind of addon device or to try your hand at programming. The community will always help you out if you get stuck. Are we going to see more great games from you for Pokitto ? Will you see more games, yes, will they be good, maybe, as for great Who knows.

Tell us your 3 favourite games for Pokitto 1. Noggin - Even though it is something that I created, it is 21


IR remote controller Torbuntu hypnotizes your TV “Isn’t IR an outdated technology?”

Many folks may be thinking this, but how many use a TV remote control, Or a Blu-ray/DVD player? Those are IR controllers. If you look hard enough, I bet you’ll find all sorts of devices which use IR controllers. I first started playing with IR when I got the HTC One with an IR blaster. I wrote an application to collect codes from remotes that I could then use later, for instance at noisy restaurants or shopping centers. Good times, feeling like a wizard. I transferred my obsession with IR to the Pokitto in this project. It was simple to setup on Pokitto thanks to a library called IRremote http://z3t0.github.io/Arduino-IRremote/

Hardware

A few Hardware requirements: - 1x Pokitto - 1x breadboard - 1x IR LED - 1x IR Receiver (such as vs1838b) - 5x jumper wires (2 ground, 1 data, 2 power) - 1x 220 Ohm resistor (red, red, brown)

Pic. 1. All IR controller components wired on a small breadboard

22


Recommended reading

Before getting started, for simplicity sake, I highly recommend checking out the very well written tutorial by Pharaph over on the forums: https://talk.pokitto.com/t/wiki-using-the-pex-01-a-simple-led-project this tutorial will get you half way setup with the equipment used in this article.

Software Setup

Generate a new C++ project in FemtoIDE. If you’d rather use a different setup that’s fine, but this tutorial assumes the FemtoIDE editor is being used.

InfraRed

ote m e r rol t n co

Download the IRremote library and add it to the root of your project. It will be assumed that the project is in a folder called IRremote. Before we start writing the code in main.cpp, we need to configure the project for a few things. So open up My_settings.h and add the following: #define PROJ_SCREENMODE 15 #define PROJ_EXT0_PWM_ENABLE

This will tell Pokitto to use the screen mode 15 which is Hi-res 16-color mode, you can read more about screen modes here: https://talk.pokitto.com/t/wiki-5-pokitto-screen-modes EXT0 PWM ENABLE tells Pokitto that we want to use PWM on the header EXT0. PWM is what we will need in order to send IR codes. You can read about the headers here: https://talk.pokitto.com/t/wiki-3-pex-the-pokitto-extension-header

The Code

Now with the setup out of the way, we can start writing out program! Open up main.cpp and delete the template code. We will be writing this from scratch.

Includes

Since this demo is tiny, we only need to include 2 items. #include <Pokitto.h> #include <Irremote/IRremote.h>

We now have the Pokitto and IRremote libraries in our project and ready to be used.

Pic. 2. Flowchart of the IR software in operation

23


// PWM output for IR blaster IRsend irSender(EXT0); // Currently only 3+ works for the receiver. IRrecv irReceiver(EXT3); // Results of reading an incoming code decode_results results; // The duration of the raw code unsigned int rawCode[RAWBUF]; // The length of the code std::size_t codeLength;

Variables irSender and irReceiver are the IRremote objects we will need for, as the names imply, sending and receiving infrared codes. We initialize the irSender on EXT0 (which we set in PWM mode in the My_settings.h) and the irReceiver on EXT3.

// The type denoting the current operation modes enum class Mode { Send, Scan, };

decode_results comes from the IRremote library, it holds the values received from the incoming infrared codes.

// The variable containing the currently set operation mode, // defaulting to Send Mode mode = Mode::Send;

rawCode[] and codeLength are used together to store information of the ir codes. The rawCode is the array of the incoming code signal, and the length is how long that array is.

// Stores the code for later sending void storeCode(decode_results results) { using Pokitto::Display; // codeLength is used again when sending the code, // so we set it here codeLength = results.rawlen - 1; // To store raw codes: // Drop first value (gap) // Convert from ticks to microseconds for (int i = 1; i <= codeLength; ++i) { rawCode[i - 1] = results.rawbuf[i] * USECPERTICK; Display::print(rawCode[i - 1]); Display::print(“ “);

}

} Display::print(“\n”);

// Prints the code being sent to the screen void printSentCode() { using Pokitto::Display; for (int i = 1; i < results.rawlen; ++i) { if ((i % 2) != 0) { Display::print(results.rawbuf[i] * USECPERTICK); } else { Display::print(‘-’); Display::print(static_cast<unsigned long>(results.rawbuf[i]) * USECPERTICK); } Display::print(“ “); } }

24

Mode is used to determine which operation is being performed. We don’t want the program to Scan incoming codes while we are attempting to send them.

Methods storeCode is run when we receive a code in Scan mode. It sets the variables we need in order to send them later. printSentCode does what the name implies, it displays the code being sent to the screen.

InfraRed

te o m re ol r t con


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.