Monday 22 December 2014

New Release: DayTrackFelixW

I have recently released a fitness app for Windows Phone as part of one of my final year modules, the app will track your route as you record a session of exercise, this can include; walking, running or both. For my module, I was given a specification with features that must be included, including the use of polyline to show the route taken and using the sensors in the phone. The name was as defined in the original specification for the module, hence the standard nature of it.

DayTrackFelixW Screen
The app took a total of 6 weeks to make, along with designs and programming in the app. This is my first app to be released, where all of the assets and work is my own. The app has a fully working session tracking screen, where it will tell you how much energy you have used, the distance you have traveled and the time elapsed. There is also a history screen that will show detailed accounts for every session you completed along with the ability to share a session on Facebook. The app also makes use of live tiles for background updates and the ability to mark your favourite locations on a map for easy planning of routes.

The development started after creating and defining the specification that would be needed, and the development would take a back seat to other modules for the first 3-4 weeks, due to the more intensive nature of the others. I was using Visual Studio along with the Windows Phone 8.0 SDK for this project, software I had used before and understood the tools available. The actual development of the app was very smooth and ran into very few problems during the process. Once again, I would have to integrate Facebook, but with previous experience using the API, it was not so bad this time, and I had it working within a few hours.

With all the data being saved locally, through isolated storage, there was a slight issue with my naming conventions to allow me to get data back to the app, but after re-thinking and evaluating how it would be used, I was able to figure this out before the app was due to be published.

Whilst I have created other apps before this one, the experience gained from this one has been really helpful to learn the whole process further, from design, to implementation and to publication, for this module I was responsible for all parts of the development as I was the only person to work on the project.

App available to download on Windows Phone now

Windows Phone Link

Frozen Fishy out.

Friday 21 November 2014

New Release: Democracy: The Board Game


Its got climate change, human rights, the economy, civil unrest, social stability and elections.  You can control and develop your education, health, agriculture, transport, housing or military.  You can defeat the Dictator, or you can be the Dictator.

Dictatorship or Democracy … YOU DECIDE!

You are playing for Votes, and Votes mean Power.  So will you gain Votes through co-operation or domination?  Votes can be lost as well as won.  Will an economic collapse take away all your votes, or will a natural disaster wipe out all your developments?

Play DEMOCRACY... The fate of the world is in YOUR hands.

In August 2014 we were tasked with recreating the board game into an app for iOS devices with local multiplayer as a necessity and the opportunity to develop into network multiplayer. Once the project was given the all clear work began on it quickly.

The development of Democracy: The Board Game was always going to be different to any other that I had done before. This was a mobile game based off of a real board game, so a lot of the key features and core gameplay was already set up and figured out. This meant we would have to recreate the board game for mobile devices as closely as possible.

We started by actually playing the board game, this meant sitting down round a table and playing a board game the old fashioned way to give ourselves a chance to understand the game better and start to figure out the process to make the app. After a good 3 hours, and some bad luck from the dictator, the delegates had won and the game was over.

The models had been created already when the concepts for the game were made a few months ago in the pitch for development, so now we had to add models to the game and start making the game. It was important to get a good set of base code to work from and develop as we introduced more and more features. The basic code structure was in place by the end of the second week and we were able to start looking at adding in AI behaviours to make sure every game is full of players.

It was 4 weeks before we got the basic gameplay sorted and working with the menus created within NGUI, the players animating, the ability to control facilities and developments, handling receiving votes (currency) from players and selling facilities when needed. Now we had to make sure everything was animating, the sounds were in and adding in a tutorial for new players to understand the game better.

By the 5th week we were in a very strong position and the game had come along really well, we could now focus on fine tuning the game and making sure the player understands what they are doing and how to play the game.

As it came closer to the end of my work at Troll inc and the start of my final year in university. It became closer and closer to getting the game finished in time, with small bugs needing removed and polishing added. We had just a week of working later to make sure we had the project finished before we were to head back to uni.

Democracy: The Board Game Development
The game itself was fully functional with audio and all core functionality included and was beginning to look like a full game. The week of testing proved to be important for the development and great for the look and feel of the game. In the final week we were able to create a full tutorial system for the app and the board game, along with some finishing touches that add to the quality and feel of the app.

It wasn't for a further 6 weeks that the app was sent for submission to the app store, this was due to a few bugs that were being found from specific scenarios being played out. These bugs could have only been found by countless hours of testing. Therefore, the delay from app completion to app store submission has been vital in insuring the app with polished.
Democracy: The Board Game

Democracy: The Board Game is now available to download on the app store.

Download Here

Frozen Fishy out.




Sunday 16 November 2014

Autumn 2014 Update

I did a summer update recently, and as I don't have much in terms of actual news at the moment, I thought I would do a simple update. I am still at uni, working on an app, a mobile game and my final year project, all of which I will talk about in more detail in other blog posts closer to Christmas and early next year.
University of Ulster

On the side of university work, which doesn't offer much time, I work at the uni for 3 hours a week,
helping 1st year students in their first programming module. I help a group of 14 game developers every week by going through a tutorial, then by helping them with their own work and practical questions they have been given.

I have been working at Troll inc on the odd day during the last weeks, working on any games that have bugs, testing and getting help on my own projects.

I guess the biggest thing for me since my last blog post, has been the purchase of an Oculus Rift DK2 for use on my final year project, whilst development has not begun yet, I will be sure to update with full details once it has.

There are still games which I have worked on at Troll inc awaiting release, each of which will receive its own blog post from myself. There will be plenty of blog posts in the coming weeks and months as apps get released, apps are completed and my final year project starts development.

Frozen Fishy out.

Saturday 27 September 2014

First Week of Final Year

After being a year out of university working 5 days a week, its back to the old routine of lectures and labs that university brings. After my first week I have had a small taster of stress and work needed to get me through the next 8 months, Juggling my modules and my final year project at the same time along with work on the side. It will be very stressful for sure, but I'm sure once I come out the other end there will be a lot of pride and relief that comes with it.

I have recently got a job at the university helping the 1st Year students with their first programming module and helping them to understand the module a bit easier for those that struggle. This will take some of my time during the year, but will be invaluable experience for me in developing my ability of what code does and ways to explain to others how it works.

My final year project will be officially decided in the coming weeks, and when it does, I will be sure to post on here about it. I also hope to do updates about progress as I go through my implementation stage, lets just hope the work doesn't get too much for me.

My work at Troll inc is not quite over yet either, I finished working full time on Monday but I'm sure I will be back in the office before I know it, making more games, apps and testing existing ones.

Now its time to get to work and get my final year started in a strong way, updates will follow soon about my project and the premise.

Frozen Fishy out.

Tuesday 9 September 2014

New Release: My Mind Western Trust

My Mind is an app designed by the Western Health and Social Trust that would aid people with mental illnesses and offer support to such people. The app features descriptions of illness, help, useful contacts, videos to support content and some advice for friends and family of those with mental illness to help them cope.


There was already an app for My Mind created by Tom Brewster, but it was not fully compatible for all major mobile devices, so it was decided that the best way to have a finished product that looks the same was to recreate the iOS version and create Android and Windows Phone as we go.

When it came to start on My Mind, I was given all the assets that I needed from the beginning, so I had to organise the previous app, figure out menus and find all the pages that were needed to be created. I was expecting development of the project to be smooth and relatively easy, but with most development projects there will be something that delays you. In this case, it delayed me in the beginning, but shortly became a worth-while investment of time.

About a week before development for the app started, Xamarin released Xamarin.Forms, which would allow for development on iOS, Android and Windows Phone devices using the same base code, this would mean that you can "write once and run everywhere". This added some difficulty in the beginning of trying to learn some of the new references and libraries.

As with new software there will always be a lack of documentation and a few bugs, this added a few days to production time, but once I had figured out the base code that I needed, development started to pick up and the app was full of most of the content it needed within the first week. This left the rest of the week and the next week time to test on all devices and make sure that all was working correctly, was aligned correctly and we had all the features needed.

Two weeks after starting the project I was due to be on holiday for 2 weeks, so it was important as the only developer to get as much of the app working and in a good position to send it to another developer if it needed to. At the end of the two weeks, the app had not been finalised as some of the content and use of features was in dispute. This meant that I had to give the source code to the CTO of Troll Inc, so that he could finish off whilst I was away on Holiday.

The app is now finished and available on iOS, Android and Windows Phone.

Check it out;
iOS Download Link.
Android Download Link.
Windows Phone Download Link.

Frozen Fishy out.

Friday 29 August 2014

New Release: St. Mary's College Derry

St. Mary's College Derry is a school situated in Derry, Northern Ireland, they had asked us for an app to reflect their school website, that could be used by pupil, teacher and parent alike to know what is going on in the school news and could find out more information about the school. This blog will be looking at the development process from the start to the end and some of the troubles we faced.

After completion of Medical Me, I was put onto helping to complete the St. Mary's College Derry app along with 2 other programmers. The app had already had a firm start by one of the developers at Troll Inc. It was a smooth transition as I was still using Xamarin, and all the code and menus were fresh in my mind.

However we shortly ran into problems with our server where some of us were losing files in Xamarin by either not committing work often or other updates overriding our files, which lead to us losing progress and being forced to recreate .xib files and sometimes even re-write code. We were originally focussing on getting the iOS build complete and then focus on Android and then eventually Windows Phone.

It became clear, with the problems that we were having with the server that we would need to start development on the other devices to avoid further problems occurring. With this I was given development of Windows phone using Visual Studio, on the sole reasoning that I actually have a Windows phone for testing on.

As I began to develop on the Windows Phone, I was now using a .xaml files in Visual Studio, something I had little experience with. But after a few hours familiarising myself and reviewing other apps on Windows Phone. I had decided the set up on Android and iOS would be a waste on the Windows Phone which has the built in panoramic feature that makes navigation easier and reduces the number of pages by about 60%. It was a fast progress of recreating menus on Windows Phone and quickly got to a stage where the app was up to date with the iOS version, and we would have to start implementing new features to our respective platforms. This meant adding media galleries, videos, maps and making tweaks to match the requests of the school.

After a few days of adding new content, we were asked to redesign the main app, for the other devices this was more of a problem due to them sharing styles, but I had made the Windows Phone app using a lot of standard layouts and assets to save memory and make it easier to use.

Our last milestone to creating the final app you see today was to add a link to the server from the school rather than the private one we were using, whilst this was set up by the school to meet our requirements, I had time to experiment with the windows app further. From this, the only feature that stayed was the speech recognition to launch the app, which I am sure will hardly be used.

After a few weeks of developing on Windows Phone, it was finished and checked for any final bugs, before being given to the school and is now released on all major devices after their own official launch. It was a well developed project with support throughout, we had our issues and problems early on, but once we had got those ironed out. The development really picked up and I am really happy with the finished product.

Frozen Fishy out.

Friday 18 July 2014

Summer 2014 Update

It has been a while since my last update, since then I have created more Apps and Games for mobile. And apart from the work side of things I have been taking my holiday easy before moving into final year and the stress I expect to get.

I am still working at Troll Inc, and will continue to do so over the summer and leading up to the start of university, where I will gain more experience in making both games and apps and will have more releases to app stores to add to my portfolio of work.

An update of all the projects and apps that are available are as follows:
Escape Harmony - Available September 2013
Chicken Jumper - Released April 2014
Medical Me - Released May 2014
Jellyflug: Antibody Assault - Released May 2014
Including another two apps complete waiting for release and a game in the works. I will soon have a healthy looking portfolio of games and apps that I have been a part of making.

I now have the task of finalising my final year idea into something that I can work with for 8 months and be able to create a finished product by the end of it. It will be a struggle, but one I feel that I am prepared for especially after my year of placement. I have been working on simple side projects and experimenting with plugins in Unity and other Engines to widen my knowledge for final year and help me to make a realistic time plan.

I will keep this update short as there are a few more to come in the coming weeks with new releases to talk about and eventually the start of my final year project, which I intend to give regular updates on progress over the next year.

Frozen Fishy out.

Friday 30 May 2014

The End of Placement

Its coming to the time for the end of my placement, and in this post, I want to talk about the benefits I feel that exist with doing a placement during a degree in an indie games company. I am fully aware that there are many cases of students disliking placement, but in my case, I have had a really good time.
My placement started 11 months ago in July 2013, and since then I have developed my abilities more than I could have imagined I would and have been offered a great deal of experience. At the time of writing this, I have been a major contributor in developing 4 games/apps, of which 3 have been released for mobile devices: Chicken Jumper, Medical Me and Jellyflug Antibody Assault, and helped testing in 3 other games. As soon as I joined Troll Inc, it became apparent how much I needed to pick up and learn, and with that, I feel that I have learnt so much in a short space of time.

At the start, as with every new placement student at Troll inc, I was instructed to refresh my skills in Unity3D, a simple start, to what was going to become 11 months of hard and rewarding work. At the end of making videos for Unity3D, I was thrown in the deep end where I was given Jellyflug Antibody Assault to work on with 5 other developers at the time. This was to be the first big project I ever worked on. Working on the game covered almost all aspects of making a game for mobile, including getting involved with some art.

As the year went on, and programmers finished placements, Jellyflug Antibody Assault was finished and it was time to move on to another project, this was when I started working on Chicken Jumper and Medical Me, and then not before long working on another app yet to be released.

Working at Troll Inc has been great, not only has it given me amazing experience and helped me develop my skills, it has given me the opportunity to release games and apps to the market, allowed me to work closely with different aspects of the game development team and cemented the idea of working in the games industry. It has also given me the confidence to work on apps and games by myself, which will surely help me a lot in my final year in uni, where I am to design and create a game by myself.

For the report for my placement, I constructed a graph that shows a self analysis of skills learnt over the course of the 11 months and my perspective of their importance to working in the games industry and my degree. I feel it is interesting to look at as a 'look back' at the previous year, as it clearly shows that over the whole year I have learnt new aspects and techniques of creating games and apps for mobile development. It is important to keep in mind that this is a graph with values decided by me based on their importance, with key skills ranging from creating level art to testing and performance optimisation. For each of the new skills I learnt week by week, I rated them on a scale of 1-5, 1 being a minor skill, and 5 being a major skill learnt.

Before I started at Troll Inc, I had only been programming for 2 years, with little knowledge in various languages, and now I feel more competent and have been introduced to new languages and software(for me). I have become really comfortable with C# and the Unity Engine, but I was also given the opportunity to try out Xamarin for app development and explore app development for Windows Phone 8 using Visual Studio. This is something I was not necessarily expecting to do when I signed my contract with Troll Inc, but now I feel comfortable in games and apps development, I will not complain. It also gave me a chance to look at some HTML scripting.

Where it has been difficult financially this year, I will never look back in regret about the experience I gained at Troll Inc, and I will encourage anybody who is thinking of applying for placement, or even a degree with a sandwich course, to give it a go as you only have something to gain. Working in a small indie team of people is really exciting, often with new projects to work on, and surrounded by talented people is a big encouragement to stay up to speed with everyone else where everyday there is a new challenge to face.

I now look forward to working for Troll Inc over the summer, working on another game title and more, then move into final year of university.

Here are the apps I have made at Troll Inc that are released:
Jellyflug: Antibody Assault (Available for iOS and Android)
Chicken Jumper (Available for iOS, Android and Windows Phone)
Medical Me (Available for iOS)

Frozen Fishy out.

Monday 19 May 2014

New Release: Jellyflug Antibody Assault


Finally, the game is complete and can be downloaded today on iOS and Android. This game has been in development for a very long time, and was the first game to be released that I have worked on. Originally developed by a fellow student and co-worker at Troll Inc, Lewis Farrall. The game is an arcade style game, where you Collect all the germs to win the level and find how far you can reach without being caught by the enemies, but luckily there are powerups to help you. Powerups include; time freeze, magnet and invisibility, all of which can be upgraded through the in game shop, allowing you to spend your hard earned coins.
_________________________________________________________________________________

Eat all the germs! Dodge the enemies! You are the body's first line of defence!!

Play as an Antibody defending the body from outside bacteria in Jellyflug Antibody Assault!!
Collect all the germs to win the level and find how far you can reach but watch out as there enemies out to catch you too!!! Collect Powerups including Time Freeze, Magnets and Invisibility to help you reach as far as you can!!!
_________________________________________________________________________________

When I first joined Troll Inc on my placement, I was set to work on this game, it was definitely a straight in the deep end situation, that taught me so much in the months that followed in developing the game. I was straight into a project which was using a modular grid for AI control, something I had never used before, and hundreds of lines of code for me to start to understand.

When I first began on the project there were 5 of us in the office working on it, so support was always there for when I needed it, but as time went by, placement and employment schemes ended and as that happened, the number of people working on the project were reduced. This meant I had gone from trying to get used to the code and the system in place, to working in the core development of the game, even creating menu art and level art.

Development was to last a long time on this project, from first getting a build onto the iPad to the first round of playtesting. On the first round of playtesting we knew we had a game we were happy with, but the results from playtesting showed that some of the features were not very clear. This added an extra couple of months onto development, but in retrospect, those changes we made in those months, made the game so much stronger. 

We also needed to add in a few plugins to help with integration, starting with in app purchases, Facebook and Twitter, this further increased the time of development.

We also found we had a problem with performance on less powerful devices, so this was an urgent problem we needed to fix, as we compressed textures, reduced objects in the scene, tweaked physics and tried everything possible, we finally have the frame rate at a steady rate. Through all the testing and building to devices, I accumulated over 500 separate builds, which will be a relief to delete the ones which are no longer needed.

I am currently the high score holder for the app, holding a score of 596900 after playing for 41 minutes testing the game, trying to see if the frame rate was a problem, thankfully it wasn't, but that score will always remind me of the problems we had with performance over time playing the game.

But after a long development, I am happy with the end result and happy for it to finally be available to download. From the feedback we got the majority of players enjoyed playing it, and would always come back for more. They wanted to beat their friends and the more they played they understood the game better and had fun playing it.

It is near the end of my placement now, so it is a relief to see the game released and not passed on through another programmer or artist.

iOS Link
Frozen Fishy out.

Tuesday 6 May 2014

New Release: Medical Me

Welcome to Medical Me!

As with Chicken Jumper, Medical Me is an app designed by local school children as part of the Creative Schools App Challenge and developed by us at Troll Inc.

Medical Me was designed by Amy Mullan and Rachel McGivern of Thornhill College, and is intended to make sure that you never lose any medical documents and information again. The app will keep all your medical information in one place and under a secure password to make sure that no one else will be able to access your information.

Development of this app began shortly after getting Chicken Jumper ready, with a reduced size team, of only two developers, and new software there were to be struggles ahead. We were using the Xamarin development suite to create the app, and Xcode for the visual design.

It was important for us to find a balance between a professional and a fun to use app, with a lot of changes early on in the development on the setup, we eventually found the best way to navigate through the app was to use a split view controller to have a master view to control the navigation and have a detail view to handle all the content.

After the second week, we had a working app for iPad with all data entry saving and all emails and passwords working efficiently.  We started to look at extending compatibility and started to get the app working on iPhone. This was to include redesigning all the .xib files in Xcode to make the view actually contain data fields, we also needed to add in a scroll view to nearly every page, to allow all the data to be able to fit on the page, another step we had to learn. This added a week onto the project completion date, but was a necessary step to make sure that users are not only limited to using an iPad, especially considering the design was from local school girls who are more likely to have an iPhone than an iPad.

Now we have a fully complete and functional app that allows you to enter you contact details, register appointments onto the device, keep all your previous and ongoing conditions in easy access, keep your doctors information handy and even add photos to the app if you have photos of prescriptions or dosage instruction you can’t risk losing.

The app is available for download on iOS devices and can be downloaded now off of the app store, if you are constantly having to try and remember your medical details or you just keep forgetting appointments, this app could be perfect for you, to help you keep all that information in one place

Link for iOS Download

Frozen Fishy out.

Tuesday 8 April 2014

New Release: Chicken Jumper


Meet Chicken Jumper, the first and definitely not the last game that I have worked on to be released for mobile platforms, out now on Android, iOS and Windows phone

RUN! The crazy Felix the Fox is HUNGRY! And he has a massive craving for CHICKEN! Jump between the clouds and use the super power-ups to escape Felix's grasp! How long can YOU survive!? High speed arcade action! Fun, colourful graphics! Collect super power-ups!



Working with Unity2D, this side scrolling endless runner will have you fighting over high scores as you try to be the best out of your friends. Development of this game was relatively short compared the the other game that is awaiting release as I write this.

The game itself has been designed by 5 girls from a local school, who had the chance to design a game that would be made by Troll inc with the original aim to be released solely on iOS. 

Development on this game really began three weeks ago, where we all sat down and read through the application for the game and tried to figure out how the game would play and recognise the limits we had with the time given.

It was originally planned to use the 2D toolkit to speed up production time, but after some discussion it was decided by the programmers that we would rather start from scratch and adapt code from the toolkit, rather than trying to understand the sample code, without guarantee that it would have been what we needed or wanted the game to feel like. 

After two days we were starting to get somewhere with the game, controls were coming together, level design was starting to come together, sounds had been recorded and art for the chicken and the fox was complete. It was starting to become a real game. With the original challenge of getting the app finished within one week it was a real rush to try and get the game finished "on time and under budget".

We were soon looking at focusing the gameplay, working on enemies and working on menu integration. On the right is a look at some early development for the game, almost past the clipart stage (clouds are still using clipart) and moving into artwork created by the artists at troll Inc. As you can may notice if you play the game, some of the artwork has changed since this time, where we changed the background art, sorted out the UI, added in full powerup abilities and costumes and made the clouds to actually match the art work of the rest of the game.

After the first week of development all the art was completed for the game, and we could focus on getting the rest of the game working as we needed, making sure all controls were consistent, making sure all powerups worked properly and efficiently and getting some feedback. By midweek of the second week, all core functionality had been completed, with everything as we wanted, and the project had been left to work on another app developed by some local school children. However, when it came to play the game, it became apparent that not everything was working as we wanted. Things were falling apart and a lot of the game had to be rebuilt.

A lot of the problems came from using a new server that we weren't all familiar with that made it difficult to work on the same things as other people, as it seemed to struggle to merge all the files. It was left to one programmer to handle the problem, so as to work on one machine to remove any differences that occurred. After this point it took a further week to find and fix problems that arose and made the game what it is now and ready for release to iOS

After sending the game up to the app store for verification, it was then built for android where the problems that arose were not too large to make it difficult to port over to Android, the same case applied to the windows phone build. 

I have been playing the game on my windows phone for the last week, trying to get the best score I can, but so far I have only managed to get a score of 7618 but i'm sure it won't be too long until someone passes me again and I feel the urge to beat them and be the best. 

Go now and download the game, try to beat my score and try to be the best out of all your friends!
Frozen Fishy out.

Thursday 27 March 2014

A Positive Post

I have felt that the last two posts have been a bit negative with not much to show for them, but this month has become a little more exciting. Having finished the development work on a bigger project at Troll inc, we started on new smaller projects, one of which (a game) which is nearly finished now, and the other (an app) that I am currently working to completion and will be finished soon.

It has been a time of working hard with a new core game system and even new software for me, we are developing the app in Xamarin Studio and the game in Unity using its built in 2D environment. Both the games will be released to the app store, the bigger project will be on Android and iOS and the smaller one only on iOS. More specific details of these will come closer to their individual release to the app stores.

My plan was to expand my portfolio, and through working on smaller projects, I now have a few more full scale projects to add to that list and more to come. It has been a very rewarding time for me to see games that I have worked on be played by others and the majority of the feedback being positive and no game breaking problems within the game. Im sure it will be more exciting for me when they are closer to release and they are open to full scrutiny.

My next step is to start developing a professional portfolio of all my work to send to potential employers and to start to really focus on my final year project at university. I will be looking to have a personal website full of games that I have been involved in making and a little extra information about me, including links to my contact information and online networks where they can find me. This will mean looking back into web development having not done it for a couple years.

I'm excited for the next months to follow, there will be a lot of hard work and a lot of pride to come from it, hopefully I will soon be able to share with you some more games that I have helped make.

Frozen Fishy out.

Wednesday 5 March 2014

March so far

My intentions for March have been to create some game demos to add to my portfolio of work, but in the process of thinking of new game ideas, I have started thinking of my final year project for university, I have since got an idea which I can see myself making next year and therefore I am writing a game design document for this idea. I will not be sharing this game on here yet, I want to keep this one for myself for now.

Although I am holding back a game idea, I still want to make some game demos this week and will look at least one demo done before the end of the month, its a big task for me, but I hope I can get this done. I have currently got two games that I would like to make demos of, and am looking to implement these as soon as possible.

Watch this space and bear with me while I figure out which game to make and write up documentation for my final year project. I will keep this one short.

Frozen Fishy out.

Sunday 23 February 2014

Plans for February?

I mentioned before that I had plans for February, but due to other things getting in the way and a lack of time to do what I had planned, I had to delay. I will hopefully be able to start my plan fully in March and look forward to doing so, but what is the plan.....

I am getting close to the release of my first credited game for iOS and Android and it is a very exciting time for me, but with this also comes the realisation that my portfolio is lacking content. With this in mind I am looking to create short game demos over the weeks in March of a few game ideas that I have. These game ideas vary from all types of games, whilst I will be working during the day, the time I have to create the demos will be shorter than I would have liked, but I am determined to create something in March that can be added to my portfolio and may even influence my final year project for University.

I aim to document my progress in regular updates over the course of the month and provide videos of gameplay and maybe even an embedded player to let you have a go and offer any feedback. The art for these demos may not be the best, but as a programmer, I will try my best to make the games look good.

I will keep this post short, as it is just an introduction of things to come, watch this space...

Frozen Fishy out.

Monday 17 February 2014

Technical Post 1: Integrating Facebook into unity C# Part 3

<< Part 2

Please Note: This shows the high scores system that I am currently using, it works where it will show the top 10 players if the player who is signed in is within the top 10, if the player is outside the top 10 it shows the top 5 players, there is then a break in the table and it shows the 2 players above you, you and then the 2 players below you. This is in C#.

I do not show the entirety of the script for all 10 positions on our table, I am using 3D Text, so all text assigned is using the TextMesh object, and Textures are assigned to OTSprites (Orthello).
Where the below code has "....." it means that the code continues to fill in the rest of the fields in similar fashion to that shown

//List used for FBResult from HTTP GET Request for scores
private static List<object> scoresFacebook = null; 
//Is the player in the top 10
bool PlayerTopTen = false; //used to align the table once
bool DoOnce = false; //used to remove any unused entries once
bool OneTime = false; //used to get profile pictures once
bool getProfilePics = false; 
//variable to take the number of entries to indicate the last position taken up //in the table, used to remove empty entries to our table
int lastPos; 

//Update function, where our methods are called
void Update()
{
    if (!DoOnce){
        friendsScore ();
        DoOnce = true; //make it so that the method is only called once
    }
    if (PlayerTopTen) {
        Divider.SetActive(false); 

        //the player is in the top 10, no break in table needed
        if (!OneTime) 

        {
            removeNames(lastPos); 

            //remove any names on table that are empty entries
            OneTime = true;
        }
    }

}

public void friendsScore()
{
    FB.API("/app/scoresfields=score", 

            Facebook.HttpMethod.GET, CallbackFriendScores);
    //HTTP GET request for the scores
}
public void CallbackFriendScores(FBResult result)
{
    scoresFacebook = new List<object>();

    //Our lists of objects and assigned list of object using the Util.cs script
    List<object> scoresList = Util.DeserializeScores(result.Text);

    int i = 0; //count the number of objects as we go through the foreach
    foreach(object score in scoresList)
    {
        var entry = (Dictionary<string,object>) score;
        var user = (Dictionary<string,object>) entry["user"];
        string name = (string)user["name"];
        string userId = (string)user["id"];

        //extract relevant data from objects to assign to text in game
        if (string.Equals(userId,FB.UserId)) 

        {
            playerScoreFound = true;
            //we have found the player
            myScore = "" + entry["score"];
        }
        //set the top 10 names regardless of player position
        if (i<10)
        {
            if (i==0)
            {
                firstRank.text = "#1";
                firstNameFB.text = name;
                firstScoreFB.text = "" + entry["score"];
                idPos1 = userId; //take a reference for the players id
                pic1.SetActive(true); //make sure their profile picture is active
            }
            else if (i==1) //repeat for first 10 objects in the list
            {
                secondRank.text = "#2";
                secondNameFB.text = name;
                secondScoreFB.text = "" + entry["score"];
                idPos2 = userId;
                pic2.SetActive(true);
            }
            else if (i==2)
            {
                thirdRank.text = "#3";
                thirdNameFB.text = name;
                thirdScoreFB.text = "" + entry["score"];
                idPos3 = userId;
                pic3.SetActive(true);
            }

.....

//now check if the player was found within the first 10 entries, if so only show //top 10 players from friends list
if (playerScoreFound && i<10)
{
    PlayerTopTen = true;
    tableFormed = true; //the table has been formed
    
//set the ranks for position 6-10 to their corresponding numbers
    if(i>=6)
        sixthRank.text = "#6";
    if(i>=7)
        seventhRank.text = "#7";

    if(i>=8)
        eighthRank.text = "#8";

    if(i>=9)
        ninethRank.text = "#9";

    if(i>=10)
        tenthRank.text = "#10";

}
//our player has not been found yet, so we need to keep looking through the //objects and move up the positions to make space for the new object data to be //added to position 10
else if (!tableFormed)
{
    //keep sorting for new places as player has not been found yet
    
//get the data at position 7 for storing in position 6
    tempName = seventhNameFB.text;
    tempScore = seventhScoreFB.text;
    rank = seventhRank.text;
    sixthRank.text = rank;
    sixthNameFB.text = tempName;
    sixthScoreFB.text = tempScore;
    idPos6 = idPos7; //change id position references for profile pictures
    //repeat for position 8 and 7

    tempName = eighthNameFB.text;         
    tempScore = eighthScoreFB.text;
    rank = eighthRank.text;
    seventhRank.text = rank;
    seventhNameFB.text = tempName;
    seventhScoreFB.text = tempScore; 
    idPos7 = idPos8; //change id position references
    //repeat for position 9 and 8
    tempName = ninethNameFB.text;          
    tempScore = ninethScoreFB.text;
    rank = ninethRank.text;
    eighthRank.text = rank;
    eighthNameFB.text = tempName;
    eighthScoreFB.text = tempScore; 
    idPos8 = idPos9; //change id position references
    //repeat for position 10 and 9
    tempName = tenthNameFB.text;          
    tempScore = tenthScoreFB.text;
    rank = tenthRank.text;
    ninethRank.text = rank;
    ninethNameFB.text = tempName;
    ninethScoreFB.text = tempScore;
    idPos9 = idPos10; //change id position references

    //update the tenth name with the current object
    tenthNameFB.text = name;
    tenthScoreFB.text = "" + entry["score"];
    tenthRank.text = "#" + (i+1);
    idPos10 = userId; //take the id for reference from the object
}


//if the player was not in the top 10 we need to see that their data is stored at //position 8 in the table to stop any further changes, 2 players above and 2 //below. If there are not 2 players below, the table will stop updating due to //there not being anymore objects in our foreach() loop
if (i>9) {
    if (myScore == eighthScoreFB.text)
    {

        //break needed as player is outside top 10
        Divider.SetActive(true);
        //sorting is complete
        tableFormed = true;
    }
}



//table sorting is complete, now to get profile pictures
if (tableFormed)
{
    if (!getProfilePics)
    {
        StartCoroutine(getFacebookProfile(0));
        StartCoroutine(getFacebookProfile(1));
        StartCoroutine(getFacebookProfile(2));

.....

IEnumerator getFacebookProfile(int key)
{
    if (key==0) //use the key to see which position to assign the texture

    {
        string url = "http://graph.facebook.com/" + idPos1 + "/picture";
        WWW www = new WWW(url);
        yield return www;
        Pic1Script.image = www.texture;
    }
    if (key==1) 

    {
        string url = "http://graph.facebook.com/" + idPos2 + "/picture";
        WWW www = new WWW(url);
        yield return www;
        Pic2Script.image = www.texture;
    }
    if (key==2) 

    {
        string url = "http://graph.facebook.com/" + idPos3 + "/picture";
        WWW www = new WWW(url);
        yield return www;
        Pic3Script.image = www.texture;

.....

//we need to check if we need to remove any names if the player is in the top 10
//do this by sending the lastPos value which should take the value of i+1 at the //end of each foreach() loop
public void removeNames (int j)
{

    //if j is 1, we want to remove the rest of the entries as well so check if       //doTheRest is true
    if (j == 1 || doTheRest) 
    {
        //remove all text and set objects renders to false
        firstRank.text = "";
        firstNameFB.text = "";
        firstScoreFB.text = "";
        pic1.SetActive(false);
        Pic1Script.image = null;
        doTheRest = true; 

        //it was true, so do the others so we don't need a new key value
    }
    if (j == 2 || doTheRest) //repeat process for all the positions possible

    {
        secondRank.text = "";
        secondNameFB.text = "";
        secondScoreFB.text = "";
        pic2.SetActive(false);

        Pic2Script.image = null;
        doTheRest = true;

    }
    if (j == 3 || doTheRest)
    {
        thirdRank.text = "";
        thirdNameFB.text = "";
        thirdScoreFB.text = "";
        pic3.SetActive(false);
        Pic3Script.image = null;
        doTheRest = true;
    }

....

I am aware that this may not be the best way to get high scores and put them in a table, I am open to any improvements that you may offer to my code, as I said I am relatively new to programming

Technical Post 1: Integrating Facebook into unity C# Part 2

<< Part 1
Note: This is in C#
We should now have the players name from Facebook, so now we will look at how to POST something to Facebook like a score. Where in our game, when the player dies we want to check if their new score is their highest and then we call the HTTP POST method to send their score to Facebook to compare with their friends. We use the following code;
public void setScore()
{
    int score = currentScore;
    var ScoreData =  new Dictionary<string, string>() {{"score", score.ToString()}};
    FB.API("/me/scores", Facebook.HttpMethod.POST, publishActionCallback, ScoreData);
    print ("Score data" + ScoreData);
}
void publishActionCallback(FBResult result)
{
    print ("say something");
}

When the setScore() Method is called a local variable is given the value of the players' score, and then a new variable is created under the Dictionary type which creates the value in a way that the Facebook SDK understands the value that is being sent up. Then we use FB.API to send the value to Facebook, with similar parameters before, but using a HTTP POST instead and adding the var created to the request that will be sent up to Facebook, on successful completion the method will call the Callback method in this case "publishActionCallback(FBResult result)" where FBResult is the data returned by Facebook on completion and the method tells the console to print something to show that the request was successful.

So now we can post scores and get scores, feel free to ask if you are having problems with this, (changing "me?fields=name" for "me/scores") we can now look at getting our friends scores from Facebook. First of all, we must make sure that the permissions for our game allow us to access our friends game data, so we must go to the Facebook Graph explorer and make sure that we have all the needed permissions. (Facebook Graph Link)

If we start by creating an access token for our app, simply by clicking "Get Access Token" and making sure the fields "user_games_activity" and "friends_games_activity" are checked, then create the access token. If we now set the request type to GET and type "me/permissions" and submit, we should see a list of permissions including the ones we just added with a value of 1(meaning true).

The easiest way to find the code for this to work, is to take the Util.cs script for the friend smash (script Link) and copy it into your own project so that you can access the Util directory and use this with MiniJSON to parse the data returned by Facebook and extract only the information you want. It is possible to search the return value as it was a string and look for a string before the one you want and take the string at the end, this would return the section of the string you want, but is not the best for using when you have more than one persons piece of data.

Using the Util.cs script, we can also look at the MainMenu.cs script from the same example (Link) and see how it is implemented into the game. In this case when we call our friends who use the app and have a score we use the following HTTP GET request;
FB.API("/app/scores?fields=score"Facebook.HttpMethod.GETCallbackFriendScores);
This will return an array of our friends scores and Facebook returns the values in descending order where the first value returned has the highest score. This makes it easier for assigning the return values to text within your game or UI.

We now want to look at how we can actually access the array of data, as a relatively beginner programmer, this was difficult for me, as there was little documentation that outlined exactly what I had to do in order to access the information I wanted. The answer is really simple in practice, even if you don't understand what exactly you are doing, if you follow this there should be no problem.

Using the Util.cs script, in our callback method, we create a list of objects to contain the parsed data from the Util method that we are about to call.
We can now use Util.DeserializeScores(result.Text) and assign the result to the list of objects that we have declared. This method will return the scores and names of the players and with that we can start to assemble a high scores table.
Next we can simply go through the list of objects using a "foreach(object score in [Enter list name])" method that will go through the data and write allow us to access it for manipulation and use in our game.
The code below is used within our foreach loop to get and assign the users name, id and score as a local string variable to make it easier to use.
var entry = (Dictionary<string,object>) score;
var user = (Dictionary<string,object>) entry["user"];
string name = (string)user["name"];
string userId = (string)user["id"];
string score = (string)entry["score"];

I have added some of my script to the next page for reference, if you want an example of how this will work, I cannot add screen shots of it working at this time, but will add them when available

Check the full method to get scores and post scores below

public void getScore()
{
    FB.API("me/scores", Facebook.HttpMethod.GET, CallbackMyScore);
}
public void CallbackMyScore(FBResult result)
{
    FriendScores = new List<object>();
    List<object> FriendScoresList = Util.DeserializeScores(result.Text);
      
    foreach(object score in FriendScoresList)
    {

        bool fbScoreExists = false;
        var entry = (Dictionary<string,object>) score;
        var user = (Dictionary<string,object>) entry["user"];
          
        string userId = (string)user["id"];
        if (string.Equals(userId,FB.UserId)) {

            fbScoreExists = true;
            int playerHighScore = getScoreFromEntry(entry);
            if (currentScore > playerHighScore)
            {
                setMyScore();
            }
            else return;

        }
    }

    if(!fbScoreExists)
        setMyScore();
}



Now that we have players names and scores used in our game, we wanted to get their profile picture within the high scores table, so that our players could recognise who they had beat easier, to do this using a HTTP GET method every time would have been a lot more complex than it needed to be, so what I did was use a simple url get request using the WWW object type and receive a texture directly from Facebook. With the way that our high scores table is written we had to wait until the table was formed and formatted until the pictures were assigned to reduce calls to the web, so I added in some temp string variables that will hold the id of each position in the table.

string url = "http://graph.facebook.com/" + idPos1 + "/picture";
WWW www = new WWW(url);
yield return www;
Pic1Script.image = www.texture;

*this is using OTSprite, the texture assign for other systems can be found online easily
This simply uses the id for position 1 in the table to get a texture from Facebook and assign that texture to the desired object in the scene.

One last piece of code that is useful is the check to see if the current object being looked at is the current player. To do this we take the userId string and compare it using our FB.userId method to see if they are identical.

See next post for full example code