Tuesday, 19 January 2016

My Bacon2D extension library

Hey there fellow engineers and coders! Guess who's back??? :D

First of all, introduction

In August 2015, while browsing through GitHub, I stumbled upon an open source project called Bacon2D. It is basically a framework created "to ease 2D game development, providing ready-to-use QML elements representing basic game entities needed by most games". The framework has only 2 dependencies: the Qt framework and the Box2D QML plugin, which is also available on GitHub. Since it is based on Qt, the framework is also cross-platform (although I haven't tested that theory yet ;)).

The problem

After using Bacon2D for some days, I discovered a few drawbacks, the most annoying of which was the level building. If you wanted to build a 2D platformer (like Mario or Sonic), you would spend a whole lot of time building the level. You would have to manually position each platform and each object. At first, I was using relative positions by getting the X and Y coordinates of nearby platforms to position new platforms but it was too much work. Also, it was not a scalable or modular way of writing code. In other words, if I had to create a new level, I would have to go through the stress all over again.

After googling on the issue, I discovered that the creators of Bacon2D actually have already started working on a solution to this, but stopped because they wanted to release a stable version of the framework first. So, after digging through GitHub, I found their code.

I took the code and wrote a few extra classes. These classes constitute the extension.

The solution

The solution I conceived after googling online was to create a level loader. The coder would create the level using a different application, generate a file, and this file would be used by the game to build the level. Easy breezy! Well kinda.

I discovered an application commonly used to build levels called Tiled. It is an open source tile map editor and luckily for me, it was developed in Qt. So after seeing this, the plan was lucid:

1. Use Tiled to build the level.
2. Generate a TMX file for the level.
3. Get Bacon2D to understand the TMX file and build the level.
4. Make wonderful games!


The implementation

First, I downloaded the Tiled source code on GitHub. I found a way to compile it together with Bacon2D. After that was done, Bacon2D had the "ability" to understand TMX files. I could use the information from the TMX file to position objects and define the fixtures that would be used with the objects. I could also load background information from the TMX file. The code can be viewed here.

The result

I am currently using this extended version of Bacon2D to make a 2D platformer. My efficiency has improved by 1000%. Building levels is so easy compared to before, and I still get to use the Bacon2D framework so I think I can call this a win-win. See the screenshots below.

The first level:


The main menu screen:


The first level with a hint requested:


Don't let the ice blocks hit you:


How the heck did I get in this situation again:


The Tiled interface (the tile map editor where I do my level editing and building):


Right now I want to develop the game to a certain extent and release the code on GitHub as an open source game. I also am going to try to write full documentation on the extension so they may consider putting it in future versions of Bacon2D. (Wish me luck on that.)

And never forget:

“Imagination is more important than knowledge. For knowledge is limited to all we now know and understand, while imagination embraces the entire world, and all there ever will be to know and understand.”
I'm out!


Tuesday, 12 January 2016

Raspberry Pi 2, Qt Embedded 5.5 and more

Hey fellow techies!!!

I am having a wonderful start for the new year. But before I get to that, let me start with where I left off.

Since last year, I have been trying to delve into different languages. My first (and only) choice language was C++, but now I am trying to learn new ones. Bjarne Stroustrup once said, "You can't be a master in programming by knowing only one language". However, it pains me to say that I am not just doing it for the fun of it. I am doing it to make myself more "employable". Knowing one language really doesn't get you that far in this software industry, so it's best to know some more languages.

Towards the end of last year, I started learning Java and Javascript. I was able to complete two projects that involved HTML5, CSS, Javascript and jQuery, thanks to Free Code Camp. For y'all that are interested in web development, I would suggest you go through those online classes. They are the bomb! As for Java, I just completed only ONE Android app, and even that app is not complete *crying*. Anyway, as long as I am making progress, right?

Since Sunday, I have resumed a project from last year called the EZ Park project, and so far so good! It's not really my project. I like to call it a "collective project". Just a few moments ago, I became the second person I know to have cross compiled a Qt application for Raspberry Pi 2! I actually followed this tutorial online from here like every lazy programmer would do, but I'm surprised it actually worked. It definitely wasn't straightforward, and I still don't completely understand the process, but it works so....I'm not complaining.

I just tried to post some pictures, but Google Blogger had some errors, so I'd probably post them later.

Peace out peeps!

Monday, 4 January 2016

Happy New Year All!!!!!!!!!!



Waddup folks!!!!

It's 2016! New year, new projects! And new blog!!!

Let me start off by saying I have never done this before. So I am naturally going to be terrible at it. At least for a while, so pardon the next 10 posts. On second thought, better make that the next 40 posts. Here it goes.......*clears throat*

Now that we've gotten that out of the way, let me continue with the preface of this "book". Me and my buddy, Mc Vian (don't know why he calls himself that) are going to try to complete a whole bunch of projects this year and we thought "Hey, it would be pretty fun to document everything!" And taa-daa!!!! This blog was created.

Stay tuned and we will keep you posted!!!

Beginning Android Development

Android is an operating system that has become ubiquitous due to its vibrant developer community and it comes at probably no cost.