RaspberryBoy – BuildLog #4

The screen and the case

Firstly I have to apologize but I’m not working so much on this project and the articles are posted rarely. Anyway, my idea is to proceed component by component and talk about how I managed the issue of fitting all the stuff in the case and making it work. In case you didn’t read the previous posts, here they areThis post is about how I’ve prepared the screen and the case.


The screen

My choice for the screen was similar to this one (link), apparently used for car parking as monitor for not bumping obstacles. This type of screen is often used in projects like this because it’s very small, compact and cheap, but some of them need some electronic modification to run the screen to a different voltage, but fortunately was not my case. I started to unmount the screen to take only the panel, and it was pretty easy, I have to admit. After replacing its cable with thicker ones, I’ve placed some black tape to cover the metal to avoid unwanted contacts. I try and tested the screen with the Raspberry with temporary soldering and it worked! It’s just a little bit noisy but I think it depends on the quality of the fast soldering I’ve done.

The case

To modify the case, I used a rotary tool with different heads, and following the tutorial of wermy on sudomod(link) I cut out all the unneeded parts  for this build. This processes are probably the most difficult of the project, and after finishing the work I was not really happy with the results. I will change the case in the future maybe.


The next post will be on audio and how I will settle the audio components in order to work. Stay tuned 🙂



I define myself as a creative developer.

Steady Drop – Log #8

The value of the tutorial

It’s been awhile since the last devlog and from there I’ve been struggling so much in the project to create a proper tutorial.

At some point in the development (probably too late) I started thinking a way to explain to the player the main mechanics and  what are the goals of the game. There are a lot of ways of doing that (I’ve done my homework) and I thought that a short tutorial, at the first try, before starting the game, could be a good way to proceed.

I wanted a tutorial to explain the input basics and the main mechanics to the player, so in this section all the points and the game logics (talked here) and the spawn logic (talked here) have to work in a different way.


I started to work on this with a specific approach where the entire tutorial is a level slot (here I talk what I mean for slot) but this wasn’t really suitable for what I had in mind, so after almost forcing myself to try and develop a tutorial system that works in that way, I realize that it ain’t gonna work, so I deleted everything and started the tutorial system from scratch. After some time and some struggling, I finally have a tutorial system that “kinda” works. It’s still pretty rough but It does its job so I can refine it after the launch of the game alpha.


The biggest advice I want to leave is to consider designing the game and the code with a tutorial in mind, if you want one. The fact I didn’t think at all to the tutorial at the beginning of the development made me waste a lot of time to refactoring my code and redesign the levels. So, keep the rules simple and keep a simple way to explain it to the player right from the beginning of the development.


I think the alpha version of the game will be available in early january 2017. Stay tuned 🙂

I define myself as a creative developer.

RaspberryBoy – BuildLog #3


Little and short update: finally I think I have all the parts for my RaspberryBoy!

  1. DMG-01 case – green transparent
  2. TFT screen, for car parking
  3. Optical fiber 
  4. Buttons and controls
  5. External USB audio card (Sabrent)
  6. Micro Switches
  7. Speaker and audio jack from an original DMG-01
  8. Cartridge reader from an original DMG-01
  9. Original cartridge
  10. Micro USB board (Adafruit) 
  11. Power Board (Adafruit) 
  12. Audio Amplifier (Adafruit)
  13. Micro SD breadboard (Adafruit)
  14. Empty modular breadboard
  15. Raspberry 0
  16. Battery 2700 mAh
  17. Old DMG-01 mother board



The tools I’m using basically are:

  • Screwdrivers
  • Rotary tool with different heads
  • Soldering iron
  • Solder sucker
  • Hot glue
  • Cables of different sizes


Now the hard work. I will start modifying the actual case. I’ll have to work very carefully because it is a transparent one. I’m not sure on the results, I think it will be clearly noticeable that the case has been modified but since it’s my first work and I won’t have to sell it, sadly I have to sacrifice the beauty and concentrate on the functionality.

Once the case is done I will unmount the screen and set it up to fit in the new case. I will devote a specific post on that. Stay tuned 🙂

I define myself as a creative developer.

LD36 Post Mortem


With a little delay, I will write a short post-mortem for my first Ludum Dare I’ve ever done.

Preparing for the jam

I live in Italy and August is a “ghost month” since everyone are in vacation… After some unfortunate team searching I decided to partecipate to the compo (which lasts 48 hours) also because the jam was 72 hour long and I had to work until Monday night which was not possible for me. The main rule of the compo is that all the work has to be done by one person, so I jumped in the compo by myself.

Since I was doing all the work, I started to set up my workstation at home and my software environment for coding with Unity, making 2D assets with Gimp, making sound effects with Sfxr and making music with LMMS. Ok ready, all set. Let’s start! The theme? Ancient technology.


What went right

It was my first time on doing all the work (programming, art, music & sfx) and I’m pretty happy on how I faced this challenge, but not completely on the final results. The workflow I used was very smooth and I scheduled all the task with meaning. I’ve the opportunity once again to test my skills and expose all the things I’m good at, and also the things I need to work on. After all the experience was very challenging in a good way and I’ve learned new concepts that I can reuse in my future projects.


What went wrong

First of all the time, but not the remaining time. I mean the time zone: in this jam everyone starts at the same time regardless of your time zone, and since I live in Europe I started my jam at 3am. So the lack of sleep influenced the rest of the jam for sure.

Secondly the theme was a hard one for me, so I struggled in the beginning for finding an idea, and I end up with using a poor game-logic idea. At some point during the event I thought to quit the jam and rest, I felt really stressed and I wasn’t sure if I was able to continue, but fortunately after a little nap I carried on.

I was recording my screen to do a time lapse (like I did for the last GGJ) but sadly after some hours of work since I thought to quit I stopped the recording and I hadn’t turned on again, so no time-lapse video this time.


Tips for the future:

  • Concentrate more on the theme.
  • Try to come up with a game logic that has the theme involved, not just mentioned.
  • Spend more time on choosing the graphic style.
  • Sleep more during the event.


Final Result

This time the results of all the efforts was Titus Discovery (ld36 entry). I think I won’t work on new features or bugs, we will see.



I define myself as a creative developer.

Steady Drop – Log #7


In this post I will talk about how I put everything together and a little bit of code management.

Code versioning

Let’s begin with some things to remember: use a versioning system…and again, use a versioning system. I can’t stress this enough. Really, for every project you’re working on, use a versioning system like Git, SVN or Mercurial. It really helps keeping the project managed and it’s necessary for collaboration with other people. If you don’t know what is a repository you can start here.

My habit is to use repositories especially for work and since I saw more benefit using it I decided to use them on my side projects. For Steady Drop I used Git on BitBucket with only one branch (for now) it really helped me also giving more value of what I developed and I will develop.


Project structure

In the beginning the files are not well organized and the project was a little mess. At the time the code was really messed up and disorganized, since I started from a prototype. After some refactoring sessions, the code was more readable and clear but I still had one problem: the organization of the files (both scripts and assets).

I started to re-organize the project (with some Unity guidelines) doing a lot of folders to separate logically the assets and the scripts, but I wanted more for the scripts. So, I started to separate the scripts and to do a lot of folders. I was not sure if this approach could work out but then I started to separate the “core” scripts and the game specific scripts, finally giving a more meaningful project structure.


Reuse core modules

All that core scripts are inside a specific package so in the future I can take this package and use it in another project. But what is the best way to do it without going crazy on maintaining a “fork-like” package? Recently at work I started to use the git submodules which basically are repository that can be inserted in an existing repository (like an inception of repositories 😀 ), and I thought that I can create a module with all the core stuff and reuse it in different projects. This change will be the next “project-side” improvement and since I have already experience with multiple submodules in one project so, it will be a piece of cake to set things up for only one module.


Alpha is coming

The alpha of the game is going to be released in the next couple of months. The best way for me to release it is to give it to a restricted set of people, (like friends and relatives) and gather feedbacks from them. Then I will iterate once again to make things better and put some others features in the game to create (some day) a beta version.



I define myself as a creative developer.

Third Person Camera with Unity


The third person camera

The camera in a game is the eye that the player use to see inside the virtual world created for the game itself. There are tons of different types of camera, but the one we are going to analyze is the third person camera (TPC from now on) which allows to see the main character moving around in the world. In our case it’s a camera that follows the player. Great examples of games that use this type of camera are Super Mario 64, Zelda – The Wind Waker, Metal Gear Solid and Assassin’s Creed.

The purpose of this article is to show how to do a camera system in Unity, with basic intelligence that follows the player and avoids to hit walls by doing auto-adjustments of the distance from the player and the ground as well. The final results are not the best ones and there are certainly other and better ways to do it, and yes, I know there are some improvements that can be done, but the main purpose of this demonstration is to give a simple starting point.


The Unity script is located here. The only things you have to do in order to test the script are:

  • In a new Unity scene add a third person controller. You can use the standard ones
  • Add at least one floor.
  • Add a child GameObject to the controller called “target” for example, and position it where you want the camera to look.
  • Add a child GameObject to the controller called “position” to identify the position of the character: some meshes may have the anchor point positioned differently, so in this way you can decide the correct position of the anchor point. It’s a optional step but it makes things a little easier.
  • Add the script to the camera and put the child objects just created under the camera script parameters in the inspector.

The code is commented and contains also a function to draw lines in the inspector to better see what is going on with the offsets and positions.

Camera position and movements

Without further ado, let’s begin with the fun stuff. The wanted position for the camera is a point that has a distanceUp and a distanceAway from the target identifying a specific point. Obviously if there is a rotation of the character, this point rotate along with it keeping its distances. Now this point is only the wanted position and we want the camera to follow this point with a little of smoothness. Simple, in positioning phase I’ve multiplied Time.deltaTime for a smoothness value.

public void Update()
//For collision avoidance we need 2 values:
// the distanceUp of the camera and the wanted position

Vector3 characterOffset = m_target.position +
new Vector3(0f, m_distanceUp - m_heightOffset, 0f);

drawDebugLines (characterOffset);
m_camPosWanted = m_target.position +
(m_target.up * (m_distanceUp - m_heightOffset)) -
(m_target.forward * m_distanceAway);

collisionAvoidance(characterOffset, ref m_camPosWanted);

//Positionig and orienting the camera
transform.position = Vector3.Lerp(transform.position,
m_camPosWanted, Time.deltaTime * m_smooth);



The collision avoidance

To keep the camera in the correct position and avoid walls that can hide the character or collide, the script makes some tests:

  • Wall avoidance: if there’s a collider near the back of the character or between the camera and the character, the camera takes the position of the collision point (improvable).
  • Ceiling avoidance: if there’s a collider above the character or above the camera, the camera changes its y coordinates to stay under the collider.
//Camera Wall avoidance - raycast from the back of the character and from
//characterOffset to camPosWanted
if(Physics.Linecast(fromObject, toTarget, out m_hitWall) ||
-m_characterPos.transform.forward, out m_hitWall, 3.0f))
toTarget = new Vector3(m_hitWall.point.x, toTarget.y, m_hitWall.point.z);

//Camera Ceil avoidance - raycast from the up of the character and from
//the up of the camera
if (Physics.Raycast(transform.position, Vector3.up,out m_hitUp, 1.0f) ||
Physics.Raycast (m_characterPos.transform.position, Vector3.up, out m_hitUp, 2.0f))
if (m_hitUp.collider.gameObject.layer != LayerMask.NameToLayer("Player"))
if (m_camPosWanted.y > m_hitUp.distance)
m_heightOffset += 0.2f; //adjusting the height


Improvements that can be surely done are:

  • Making a FSM and attaching it to the camera: for example the camera has state like colliding, shaking, bouncing and a following common state.
  • Improving the wall collision not to see parts of the world behind the wall.
  • Adding a colliding sphere to the camera.


Consider also to watching this GDC video on which a creator of the game Journey talks about common mistakes and tips on creating a third person camera.

Third Person Camera (Gist)



I define myself as a creative developer.

From C++ to Python


This post is more theoretic than usual and I will analyze briefly my experience on passing from C++ to Python and what I found interesting to notice when learning another programming language is needed.



After working with C++ for a while, I had to learn Python for the first time and use it with Panda3D engine. Right from the beginning I’ve found myself thinking in C++ style a lot of times while programming in Python, especially for the first couple of weeks. Finally I realized that the first programming language you master (or maybe your favorite one), can affect the way you program and think in other programming languages. Probably this thing is also true for the spoken languages.

When you learn your first programming language, you are learning also all the best practices and the techniques of the language itself. This type of notions aren’t merely syntactical and they belong to “programming theory” or “IT theory” rather than a specific language. But when you starting to master this language you create common mind paths for creating instructions and more complex modules that belong only to the specific language you’ve mastered. Obviously these are my opinions, I’m not an expert in psychology.


Programming mind path

To help passing from the C++ “mind path” to the Python ones to me has been pretty easy after all, but I recalled some struggling at the beginning. Now let’s analyze the two languages to try to facilitate the journey.

First of all, let’s talk about some actual differences from Python and C++:

  • Python is run through an interpreter and is interpreted each time it runs., whilst C++ is pre-compiled
  • In Python, there is no need to declare types explicitly
  • Python uses Garbage Collection whereas C++ does not.
  • C++ supports pointers and low-level memory management.
  • C++ is a statically typed language, while Python is a dynamically typed language.


As you can see in the previous short list Python and C++ are both object oriented languages but they are ruled by different philosophies. Beside these strict differences that are also some intrinsic principles and styles of coding that belong to the specific language and find place in the deepest part of a programmer’s mind, the mind paths. This more “abstract” side of the differences of usage is difficult to manage at the beginning and I think it takes some time to deal with it.


Things to remember

Fortunately the syntactic side of the differences is less deep-rooted and can be managed more easily: there are only some little things that can make you struggle, especially at beginning of the switch. I’ve listed a series of things I found useful to “easily” switch from C++ to Python.

  • Indentation and curly brackets: in Python there are no curly brackets to define a block of code but instead of this it use indentation
  • Loops with float: in Python you can’t easily define a loop with a float increment
  • Data structure declaration: Python has built-in lists and dictionaries and you can declare it simply with “[]” for lists and “{}” for dictionaries
  • There’s no separate char in Python
  • No switch: Python doesn’t have switch statement and you have to implement it with if, elif blocks
  • While-Else: the loops have the else statement which allows to do something when you go out of the switch
  • Use less lines: Python allows you do simple things in less lines than C++. For example: a = 5 if b == 4 else 6
  • Python allows to write if statement in a single line inside an assignment. It’s not mandatory to use this feature but since you have the chance, why shouldn’t you?
  • Function pointers: in Python there are no control on pointers in general, but since the assignment works on reference, you can do similar things. When you have to use something that works like a function pointer, all you have to do is to declare a variable and assign to a function name (without the brackets) and that’s it. Since everything is a class in Python (even functions) and everything is “callable” when you have to call the function pointer, all you have to do is to call the variable.



  • A Byte of Python – Swaroop


I define myself as a creative developer.

Steady Drop – Log #6


This post on Steady Drop development is about the art process and choices I’ve made.

Minimal style

During the pre-production phase I wrote down all the possible styles I could develop for Steady Drop, and like I said in one of the first posts, I was thinking to give to my game a cartoonish-like style, similar to Cut The Rope, just to mention a famous example. I finally chose a minimal style in order to emphasize the gameplay and reduce the distractions and also because it is easy to maintain.

Since the style I wanted was really simple and minimalistic, I started to create the assets on my own. I’m not an artist, but this type of style is something I’m able to work with. I wanted the main focus to be game logic and gameplay so I eliminated the unneeded and went back to the roots: the shapes and the colors. I think that sometimes all we need to recognize an object is its shape and its color, so every element in Steady Drop has its particular (geometric) shape and its inner color. I regret a bit this choice but it makes possible to speed up the assets production and allows me to concentrate more on the development.


The need of using a vectorial format

Having a minimalistic and geometric style for all the graphic assets led me to think using a vectorial format. The pros of using a vectorial instead of a lossy format are quite important on both technical and design side:

  • Smaller file size.
  • Changing resolution without loosing details.
  • The sharpness of the shapes are always very neat.


Obviously this pros are applied for my project, you don’t always need a vectorial format. I grabbed my favourite vectorial editor and I created some ideas of objects and actors of the game. And after some concepts and a lot of inspiration sessions, I came up with the (almost) final version (posted here). The problem at this stage was: I could possibly take advantage of a vectorial format in Unity?


Using the SVG importer

To solve this issue, I tried to find a way to use natively a vectorial format in Unity but unfortunately Unity (version 5.4) does not support vectorial formats, at least I haven’t found a native support. So, I started looking on the assets store and I found this (SVG Importer). Basically this tool imports a SVG file and convert it in meshes (I think one for any visible closed path), keeping the quality of the shapes at any resolution, I thinks even retina displays. The integration was very easy with no code required and the results are very good and I’m happy with it. I’ve only one little issue on replacing a svg texture at runtime but I solved it with a little workaround.


The next post will be on putting everything together and on code management. Stay tuned 🙂

I define myself as a creative developer.

RaspberryBoy – BuildLog #2

Disassemble the DMG-01

In the last post I talked about the beginning of the project and what I will have to do in the future weeks which is starting to disassemble an original (not functioning) DMG-01 and starting to modifying the case using a rotary tool. I did it, and I did a good job, not perfect by the way, which is why I ordered an extra case to make the official modifications only when I’m sure of all the matters I can encounter doing it.

Meanwhile I’m waiting for the last few parts to arrive and I started to disassemble the motherboard, for taking the parts I can reuse in my build, which are: the audio speaker, some switches and (most importantly) the cartridge reader. The final goal of using the original cartridge reader is to modify a cartridge and put inside of it the micro SD for the Raspberry SO, in a removable fashion, and use the cartridge itself as an external “cartridge SD”.

I was able to remove all the components not needed like the old screen, some capacitors and resistors since I’m gonna replace the screen and use the circuit just for the controls. The next step for the motherboard will be to cut it and to keep just the part near the controls and modify it allowing to have four buttons instead of the standard two. Recently the guy that created this build uploaded a video showing all the custom motherboards created by usersof his forum (video). If I can’t get my motherboard working these are good alternatives.

I’m also taking a look at the forum and some other videos. There are lots of new inputs for a custom project like mine. Just to mention one extra thing I can add, is to use an optical fiber to bring outside the lights of the charging module to make the charging state visible.

In the next post I will show you all the parts I have (hopefully the complete set) and all the things I’m planning to do (and what I’ve already done). The build state is still pretty rough right now but I’m going to refine all the details.

Stay tuned for future posts 🙂


I define myself as a creative developer.

Steady Drop – Log #5


Gyroscope handling

I want to talk a little bit about the first things I developed when I got the idea for Steady Drop. Just from the beginning I had this idea to use the gyroscope data from a mobile device and to do something with it. I started developing a first prototype which uses the gyroscope quaternion given by the “attitude” property and elaborating it to get the gravity direction using euler angles. The class doing all this stuff was (and is) called GyroTilt and for some time the name of the game/project was GyroTilt until I came up with Steady Drop. For a prototype it worked fine, and I started developing the game on top of this logic. At the time I wasn’t testing everything so often on a real device and for a reason or another I finished up screwing part of the logic and all the rotations were broken.

Recently I’ve changed the method to compute the gravity direction by simply getting the gravity directly from the the gyroscope class. This property returns a vector (with magnitude one) with the direction of the gravity in world space. I can take this vector and go on and use it with the rest of the logic which wants only the gravity direction and ignores how it is computed. Unexpectedly this gravity vector is much more stable that the attitude and I think it is not more CPU expensive that the other.

One issue I will have to resolve will probably be the device compatibility, since I’m developing this game for Android, there are hundreds of different devices with different mounted sensors. I haven’t tested my game on different devices yet, so I’m thinking to give the game build to some friends and people who can test it out, a sort of “closed alpha”.


Gravity direction, now what?

Ok, now that I have the gravity direction I use it for adding the increasing force (like I said in devlog #4) with its logic ruled by user inputs, and for rotating the object. To rotate the object correctly, I tried in the first place to use the RigidBody rotation caused by the force I add, which is nice but I could not find the right level of responsiveness I want. So I decided to freeze the rotation on the RigidBody component and to apply the rotation manually to the Transform. In this way the rotations are very responsive and the fact that I’m not using the rotation from the RigidBody is not a problem, since the physic system is all custom and ruled from my scripts.


Future uses

Since now the gravity direction seems stable I’m thinking to use the gravity for different purposes that can add gameplay variationsRight now the only object that react to gravity is the avatar of the player, what about some special enemy that reacts to gravity? I’m not sure to use the pendulum that I have right now, but I’m thinking a new type of walls maybe, that reacts to gravity. Maybe the gravity can affect some physics parameters of an object or an obstacle. I will decide what to do about this matter in the future, surely after the beta release.
Stay tuned for future posts 🙂

I define myself as a creative developer.