Cocos2d -> Cocos2dx rewrite Update 1 (4 Hours)

I am 4 hours into the conversion. I decided to just go scene by scene, so I began by loading in my splash screen and loading scene. The loading scene is something I wrote for cocos2d a while ago and use it in many apps, it’s available on github (although I do need to update that one as I’ve made a couple small enhancements). So I took that and ported it all to cocos2d-x. This was a great place to start because it has some file reading / parsing code in there.

I haven’t done this before on cocos2d-x, and I must say they’ve done a great job. I am able to use all my existing dictionaries (plist) files and parse them just as I did previously, so it was just a matter of updating the syntax to C++ from OBJC and away I went. So in my loading class I do a few things, first I cache all my sprite sheets, sounds, images, etc, then for this game I generate the dictionary which will be used for the game. This is some custom code I have, so it needed to be converted as well. Thankfully most of the code was in C++ already, as that’s usually how I write my performance code. So it was simply going from NSArrays to CCArrays, and changing a few types here and there.

All in all, after 4 hours, I did the whole loading screen, splash screen, and 90% of the core engine. So by going this path, I’ve actually tackled the more technical bits first, as displaying things on the screen is much easier code to migrate. So I think at 8% done I’m making great time.

Next Post:

Rewrite a cocos2d application in cocos2dx in 48 hours

We have an app that is on the iOS store and still waiting review for Mac store. Word Jumblerama Blitz. It’s a quick word game that was a lot of fun to make, and people seem to enjoy playing it. We made the initial release in a week, and now are thinking of porting it to a wider platform to support more devices.

Originally it was written in Objective-C using cocos2d (v2.0). We will now rewrite and migrate the app to c++ using cocos2dx (v2.0). We have done cocos2dx work before, and migrated a smaller app. There are a lot of nuances with this app, such as file reading, writing, parsing huge dictionaries on the fly, etc. So it’s a learning exercise as well as an excuse to do a little android work (which is truly punishing, it’s really not our favorite platform by miles), but cocos2dx does help a lot. Along the way we’ll probably do some JNI to talk to java, but at the same time we don’t just want to do an android port. I want the whole app to be on cocos2d-x, so the next version for Apple will be on the cocos2d-x (C++) code.

The goal is to truly have a cross development / cross platform solution. I always dev iPhone/iPad/Mac on the same code, this time we’ll push it to more platforms including Android, and Windows. Our target is a complete app feature set to our latest release, (minus the iOS specific game center, iAd, etc) running on cocos2dx. Initially we’ll just aim for a iOS version in this first pass of the code, then use that to migrate to other platforms.

And we’ll time cap this at 48 hours (however, it may be broken apart in multiple days, depending on other work).

First Update (4 Hours)

Word Jumblerama Blitz for iOS Released

Word Jumblerama Blitz Icon

Our new iOS game is released! Word Jumblerama Blitz, is a fast paced word searching game. The game is a free download from iTunes, and supports Game Center.

If you like word games, and are a quick word finder then give the game a shot and see how you fare on the game center leaderboards! This is the first release, and we are planning to incorporate two player vs match making very soon.

Game information Page

Word Jumblerama Blitz - Six Foot Three Foot

Retro Art Studio 1.3.0 for iOS Released – New Features

Retro Art Studio has just received it’s latest milestone for iOS. This release was a quick release after 1.2.0 to address some additional customer feedback.

Most importantly, our top requested feature was a way to purchase the app. It seems Retro Art Studio is a hit with young ones and others alike, so to stop those small hands from accidentally clicking on ads, they can now be disabled via in app purchase. We also added a way to blend colors together, by clicking on two different colors on the color bar. (Click Red then Green to get a gradient between the two).

Also a request on iPhone was the ability to have larger LED / Pixels for the smaller device. Now on all devices you can select the size of the LED / Pixel via a configuration menu.

We removed the ‘undo’ button as well to make room for the configuration, also it was not really necessary as we have a nice eraser that’s ready to use.

Thank you so much for all your feedback, and we hope you enjoy playing our games.

Retro Art Studio 1.2.0 for iOS Released

Retro Art Studio 1.2.0 has been released on the Apple App Store. This includes a whole bunch of fun things, mainly new colors! Every color now has a gradient, so you can get different shades of each color, we we went from 8-64 colors! That should unleash some more creativity from our users.

Full iPad Retina support! All the graphics have been redone to support the Retina in full resolution, we even prettied up some of the graphics for all devices. There are more dots on the Led Brite game as well.

We also fixed Facebook integration, so now it will post to your photo album (if you are logged into Facebook). Your posts are just for your wall, not ours. However we have added a link to the Facebook page for Retro Art Studio ‘Retro Art Studio Community’, where you can like us and please upload any work you’d like to share! We’d love to see what you’re able to make.

Retro Art Studio for iOS is a Free application replicating classic art toys, including Etch-A-Sketch ™ and Lite Brite ™, we also have a 8-bit pixel painting program to make cool pixel art. People seem to be using it for creative ways as well such as cross stitching pattern making as well as quilt designs. We love the creativity of our users.

If you have any ideas, issues, or suggestions please use our support page on the website, we’ll get back to you asap.

Looking forward to seeing some of your work!

Retro Art Studio – Android

We’ve been very busy working on some new applications, but we took a little break to finish off a port of our very popular art program for iOS to android. Retro Art Studio for Android is available now from the google play store. This is our first Android application and we hope it is as successful as it’s iOS counterpart, we look forward to bringing both new feature soon.

If you’re an android (or other non-ios) user and would like to see more from us on the platform let us know, we’ll see what we can do!

Using AFNetworking with PHP to post to your own webserver (Example included)

Hello all,

I thought I’d start adding some bits of knowledge on here to help fellow developers. Every now and then I hit a hurdle that takes longer than expected to jump over, today it was with AFNetworking, an amazing little class for iOS/Mac development for doing network communications. I just have been a bit rusty on my php (7 years since last used), so it took me a little head banging to figure this out. It was extremely simple, but I had to go through a few herrings to get there.

Problem:
I wanted a way for my beta testers to send me reports via the application, including autogenerated debug data.

Solutions:
#1) Have testers take screen shots and upload them. (Not user friendly, and lots of extra work for me to recreate the scenarios).
#2) Use a NSData of all the information I needed and upload it to my webserver. (ideal, just haven’t done that yet)

A little digging pointed me to AFNetworking, .

This looked great. Very easy to integrate, and seemingly easy to get up and running. But a couple caveats. Now like I said my php knowledge is long retired, I love the language, I just haven’t used it in years. So this would take a little head scratching. But the basics of what we’re doing is this.

#1 Install AFNetworking in your project (follow instructions from code, very simple, copy files, #include header, done).
#2 Create NSData to send (in this example a simple image)
#3 Package the data up in a JSON request with AFNetworking
#4 Send the request to webserver which has a php file to process the request. (in this case, take the file and copy it to a directory).

Ok, well #1 was easy we already do this in other parts of our code. But here’s the snippet for using an image bundled with your project. Oh and since we’re using UIImage, you need to import UIKit framework to your project if you haven’t already. UIImage is for iOS only, mac uses NSImage, but it’s very similar.

//This will look for a file called Default.png in your bundle
NSString *imgPath = [[NSBundle mainBundle] pathForResource:@"Default" ofType:@"png"];
//This loads the image into a NSData variable we'll use to send the message with
NSData *imgData = UIImagePNGRepresentation([UIImage imageWithContentsOfFile:imgPath]);

NSString *imgFileName = @"myDynamicFile.png";

Great. So we have that done. Now we construct the package from AFNetworking.

AFHTTPClient *client= [AFHTTPClient clientWithBaseURL:[NSURL URLWithString:@"http://myownwebserver.com/appUploads/"]];;
        
NSMutableURLRequest *myRequest = [client multipartFormRequestWithMethod:@"POST" path:@"upload.php" 
                                                             parameters:nil constructingBodyWithBlock: ^(id <AFMultipartFormData>formData) {
   [formData appendPartWithFileData:imgData name:@"uploadedfile" fileName:imgFileName mimeType:@"images/png"];
	}];

AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:myRequest];
[operation setUploadProgressBlock:^(NSInteger bytesWritten, NSInteger totalBytesWritten, NSInteger totalBytesExpectedToWrite) {
            
	NSLog(@"Sent %d of %d bytes", totalBytesWritten, totalBytesExpectedToWrite);
            
	}];
        
	[operation setCompletionBlock:^{
		NSLog(@"%@", operation.responseString); //Lets us know the result including failures
	}];
        
NSOperationQueue *queue = [[[NSOperationQueue alloc] init] autorelease];
[queue addOperation:operation];

Great! Now what I’ll point out is a bit I got stuck on.
This command:

   [formData appendPartWithFileData:imgData name:@"uploadedfile" fileName:imgFileName mimeType:@"images/png"];

The first argument is the NSData* we will pass, the next ‘name’ field is important. I was confused on the difference between this and filename, the last is the mimeType, make sure it’s appropriate for your file type, you can go here for valid types: .

So like I said I was confused on ‘name’ and ‘filename’, the filename is self explanitory, but the ‘name’ wasn’t, I later found in debugging that is going to be the name of the post object, so on our php script we’ll be iterating through that object (which comes as an associative array). So just hold that thought for now, we’ll show in the next step.

Now we need our PHP script setup on our server. A couple red herrings, make sure you have folder access and write access to your folders. Sometimes things like WordPress do a bunch of redirects which can cause your scripts to fail, we had this issue at one point, and had to modify .htaccess (I won’t cover that here, just googlie “wordpress exclude redirect”).

The script will be located in the path specified in the URL above, and it’ll be called ‘upload.php’ in this example. After a post is received, the script simply copies that to a subfolder called ‘uploads’ in this example.

Contents of upload.php


<?php
$filename="uploaded";
$target_path = "uploads/";

$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 

if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
    echo "The file ".  basename( $_FILES['uploadedfile']['name']). 
    " has been uploaded";
} else{
    echo "There was an error uploading the file, please try again!";
}
?%gt;

Ok remember that bit I got stuck on? That was the ‘uploadedfile’ which was the name we were passing from the JSON request. Initially I had a mismatch which would cause the php to not see any file as it was looking inside of $_Files[‘uploadedfile’], when in fact I sent something like $_Files[‘attachment’]. The truth is you can have it named anything, just make sure they match! a small doh moment, but once I remembered how to debug a little php I sorted it out.

This is very simple… but hopefully it helps someone, if anything it’ll help me when I have to revisit this code. I wouldn’t use this code as-is, there is no type checking at all on the php, you may want that to validate your data and not crash your server (large files, etc).

I have to get back to work now to implement this in our new apps, highly likely there’s a typo in the code so feel free to correct it.

Retro Art Studio – Now Universal with Facebook

Retro Art Studio 1.1.0 has been release.

New Features:

  • Universal supporting iOS devices running 4.3+ , (iPhone 3GS+, iPod Touch 3rd Gen+)
  • Facebook photo album posting.  You can now use facebook connect within the application to sign into facebook and post your artwork to your photo album.

* Note we do not request / log any information from your facebook account.  We just enable you to post to your own wall.

We would love to see some great artwork created by our users, if you have made something great email it to us and we will publish it on our facebook page!

 

Welcome to the New Year – 2012

Well the New Year is here. This year we plan on working hard to build up our brand and get more product out the door. We have some exciting projects in progress, we’re looking forward to working with some 3rd parties, and of course we will be updating our existing applications with new features.

A wrap up of last year:

Releases:
March – Mojo Video Poker for Mac, the app has remained in the top 10 in Casino games on OSX since it’s release.
October – Mojo Video Poker HD for iPad.
December – Retro Art Studio for iPad.

Updates:
We continuously updated our products throughout the year adding functionality and fixing issues. We released a total of 10 updates across all our apps.

Development:
We prototyped in house and for 3rd parties over 30 games and apps in 2011. Some of these ideas will be realized in 2012 as new releases, either by us or by a 3rd party publishing company. We have a lot of exciting projects lying around, and now we have to filter some out to release in 2012.

Our outlook:
We have a lot of sticks in the fire this year, and now we’re looking to move some projects ahead. We hope to pick up some new contacts and partnerships along the way. This is what we currently have planned.

  1. Mojo Video Poker (OSX/iPAD) update, this will bring new features to both applications, including auto-hold for all games. This is currently in testing.
  2. WJ – (iOS/OSX) This is a new application that has been in development for 9 months. We are getting close to the polishing stage. We are very excited for this release and hope we can get it to the finish line before end of Q1.
  3. Retro Art Studio (All) this is an update to Retro Art Studio our free to play retro art game collection. We are expanding our platforms and looking at touching new platforms we haven’t yet delivered to. This is hopefully in line for release in Feb / March. We also plan on a latter release adding new themes and art programs to the mix
  4. BS – (iOS/OSX) This is a new puzzle game we are currently developing. We hope to find the time to build up some levels to make it interesting and get it to users this year.
  5. Episode 9 – (iOS) This is a very large title we hope to do this year. This is bringing to life a popular series of cartoons we published years ago. We plan to make an interactive game / story that will take players through the adventures of our fearless hero.
  6. Finance Apps – (iOS/TBD) A collection of apps to manage different aspects of finances. A collection of tools we’ve had internally we’ve found useful over the years.

If we have time projects, these are ones we’ve started and would love to work more on.

  1. GORB – (iOS) The gravity based action puzzle
  2. The Adventurers – (iOS) A retro-ish point and click adventure
  3. TnP – (iOS/Other) A collection of musical toys for children
  4. Color With Me – (iOS/Other) A coloring program for children
  5. Money Match Extreme – (All) A revisit to our original mobile title, Money Match Advance. An fast action thinking puzzler. This is a labour of love an hope one day to bring it back.
  6. Many Many more…

That doesn’t touch on our 3rd party partnerships… All in all it’s going to be a busy year! We can’t promise it all, but we hope we’ll be bringing everyone some great apps this year.

Retro Art Studio – Available for iPad

Retra Art Studio is now available for iPad. This is a free app which is a collection of retro themed art programs. Including Etch A Doodle based on (Etch-A-Sketch tm), LED Brite (based on Lite Brite tm), and Pixel Painter, an 8-bit style drawing program. The app supports saving images to your photo library.

Retro Art Studio - Six Foot Three Foot

Grab the app, and if you make an amazing drawing you’d like to share, email it to us via our support page!