Unity 3D Game Project

5. March 2012 13:11 by Cameron in Programming  //  Tags: , , , , , , , ,   //   Comments

This semester, at Louisiana State University, I'm taking a video game design class and our goal is to make a 3D stereoscopic game using the Unity 3D engine. I'm working with a group of students from the University of Illinois at Chicago and one other member from LSU. So far, it's proven to be a very interesting class. We've pitched our storyboard ideas in front of our peers and our professors to get a good sense of what we should do next. Ultimately, we decided on doing a hang gliding game influenced by the PilotWings series. I have always loved the Pilot Wings games and I can remember the hours of fun I used to have playing PilotWings for the SNES. Today, I have Pilot Wings Resort for the Nintendo 3DS and thoroughly enjoy the game play. Our game, while having some similarities to Pilot Wings, will be unique and have its own twist. We're still working out all of the logistics of the game play, but we have some good ideas thus far.

I've been focusing on simulating hang glider flight physics using Unity 3D's physics engine and later I will help with composing the soundtrack of the game. I've setup a prototype of the game where the player is positioned in the middle of a canyon and has the ability to tilt left and right as well as climb and descend. I'm still working on making the movement more fluid, but the basic concept of flight is represented in the prototype. My colleagues are working on randomizing the terrain and managing the world objects for powerups and obstacles.

Once we have a presentable prototype, it will be fun to compose the soundtrack for the game. I've been playing piano for the past 15 years and I love to compose my own music. Some of the songs I compose are strictly solo piano while others have multiple parts to add depth to the sound.

I will keep this blog updated as more progress is made on the game project front. I'll also be sure to upload some images of the prototype at some point.

Qt Application Development in Mac OS X Lion

1. February 2012 01:52 by Cameron in Qt, Mac OS X, C++  //  Tags: , , , , ,   //   Comments

I've been working on some code using the QtSDK lately and I've been researching how to deploy applications for Mac OS X 10.6 and above. Luckily, it's pretty simple to deploy applications as the QtSDK includes a tool called macdeployqt. The tool copies all required Qt frameworks to the app bundle and re-assigns the library reference paths for the app to use the libraries within the app bundle and not the user's system directory (/usr/lib). It doesn't copy 3rd party libraries that aren't in the /usr/lib directory so you will have to manually add those.

Please note that macdeployqt on Qt 4.7.x doesn't seem to assign the correct library paths when linking against QtWebKit. This is a known bug that was fixed in Qt 4.8.0.

Also, if you want to insure that your app will not have problems on Snow Leopard, be sure to add this to your .pro file: 


This tells Qt to use the Snow Leopard SDK instead of the Lion SDK. If you build your application with the 10.6 SDK, it will work with Mac OS X 10.6 or higher.

One last thing is that there seems to be a problem with Xcode 4 and Qt Creator not being able to find g++-4.2 which is installed with older versions of Xcode. A work around for this until a new version of Qt Creator:

sudo ln -s /usr/bin/g++ /usr/bin/g++-4.2

sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2

I hope this helps anyone experiencing the same issues.


As of the February 1, 2012 QtSDK update, it appears as though the problems with g++ and using macdeployqt have been fixed. Please be sure to update to the latest SDK release. 

Convert JavaScript Escaped Characters to HTML/XML Entities

11. January 2012 01:44 by Cameron in javascript  //  Tags: , , , , , ,   //   Comments

Recently, I needed a way to convert JavaScript escaped characters to HTML/XML entities for saving files in UTF-8 encoding without saving the special characters to disk. Luckily this was pretty easy. I used JavaScript's built-in function escape() to escape the input text and used regular expressions to find each escaped value and replace them in the input text with their new HTML/XML entity equivalent. For example, the text "Copyright Some Company ©" would escape to "Copyright%20Some%20Company%20%A9" using JavaScript's built-in function escape(). After converting the escaped characters to entities, the result would be "Copyright Some Company ©". When saved in a database and rendered as HTML to a webpage, it would display the original message "Copyright Some Company ©". Here's the code for anyone interested:

// convert escaped characters to html/xml entities
function normalizeText(text)
	// escape text for special characters
	var esc = escape(text);
	var simpleCharsRegex = /%[0-9A-Fa-f][0-9A-Fa-f]/g;
	var specialCharsRegex = /%u[0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f]/g;
	var simpleCharsMatch = esc.match(simpleCharsRegex);
	var specialCharsMatch = esc.match(specialCharsRegex);
		for(var i = 0; i < simpleCharsMatch.length; i++)
			var temp = simpleCharsMatch[i];
			simpleCharsMatch[i] = simpleCharsMatch[i].replace(/%/, 'x') + ';';
			esc = esc.replace(temp, simpleCharsMatch[i]);
		for(var i = 0; i < specialCharsMatch.length; i++)
			var temp = specialCharsMatch[i];
			specialCharsMatch[i] = specialCharsMatch[i].replace(/%u/, 'x') + ';';
			esc = esc.replace(temp, specialCharsMatch[i]);
	return esc;

I understand there may be a more efficient way to do this, but this code does work in a pinch. Please let me know in the comments if you have any suggestions for improving this code.

Beginning Desktop Client for IGA

2. January 2012 18:45 by Cameron in PSN, Xbox Live  //  Tags: , , , , , , , , , , ,   //   Comments

After some time to think about the most secure method for processing achievements and trophies for an individual user using the user's account credentials, I've decided that using a desktop client rather than server side technology for collecting achievements and trophies is the best approach. Not only is it more secure, but it also reduces the load on my server by turning each user's computer into a node on the IGA network for processing small parts of achievements and trophy data as a whole. The combined data from each user will be uploaded to the IGA dedicated server for importing into the central database. Then data can be viewed from the web interface or smart phone applications.

The web interface and smart phone applications will merely serve as a way to interact with the data from the database rather than pulling data down from the various sources and taking up bandwidth. This is good for smart phone users as data charges can apply for checking for updates frequently.

I'm using a Qt, a cross platform GUI library, for designing the user interface so that the client may run on Windows, Mac OS X, and Linux out of the box. I will post some screen shots as they become available.

Latest updates on Xbox LIVE script

2. January 2012 13:28 by Cameron in Xbox Live  //  Tags: , , , , , , ,   //   Comments

I have recently added support for collecting data for an Xbox user's friend list to my Xbox LIVE script. Also, since my last blog update, I've changed all dates in the data to use epoch time stamps. I've attached an updated sample:

pcmantinker-xbox.xml (528.72 kb)

First version of PSN trophy collector finished

2. January 2012 13:17 by Cameron in PSN  //  Tags: , , , , , ,   //   Comments

Today I finished the first version of my PSN trophy collector. In this version, my script is able to pull down detailed information about a person's basic profile information and their full online game list with trophies. Note: the script only pulls games that play online and participate in trophies. Any games that don't have trophies are not scanned. For each game, a full list of trophies is collected showing the dates of each earned trophy. I've attached a sample of my PSN trophy data.

pcmantinker-ps3.xml (234.28 kb)

Be watchful of what you eat

6. December 2011 12:29 by Cameron in Misc  //  Tags: , , , , , ,   //   Comments

I'm fine, but I had an interesting night at the emergency room last night. I ate my regular broccoli beef meal from Chinese Combo King, a local Chinese food restaurant near campus, and shortly afterwards I had an allergic reaction to something in the food. I have been eating at Chinese Combo King since I was a freshman at LSU and have had no issues with the ingredients of the food. However, last night, I noticed that the food tasted differently like it was cooked with a different spice than I was used to. At the time, I didn't think anything of the difference in taste. I just thought there was a different chef cooking the food last night that used a different recipe. It took about 10 minutes for me to notice that I had begun breaking out in hives. Prior to last night's incident, I had never really broken out in hives so it was a bit alarming to see it develop so rapidly. I received a professional opinion from a nurse from my healthcare provider that I should check in to the emergency room to get appropriate care for my condition. 

Once I got to the emergency room, the visit lasted about 5 hours. They were pretty packed when I arrived. I am definitely thankful to have gone to the ER though. I'm feeling much better today. Sadly, I think that last night will be the last time I eat at Chinese Combo King. It's strange that after 21 years, I have discovered an unknown allergy that causes me to break out in hives. I will be getting tested by an allergist over the winter break to narrow down the root cause.

My recommendations for everyone is to always be aware of the foods that you eat. Sometimes we cannot know the ingredients in the food we eat or in my case, not even know you were allergic to something. I'm no medical doctor, but something that they recommended me was to take Benadryl and Zantac simultaneously to help reduce inflammation. Zantac acts as an antihistamine like Benadryl but works differently so they can be taken together. These can be purchased over the counter and will definitely help with immediate relief. If after you've taken these you aren't seeing any results, consult a professional opinion about your condition. I hope this helps anyone with a similar case in the future.

Happy Holidays!

Nearly finished with my XBL Scraper and starting my PSN Scraper

3. December 2011 14:31 by Cameron in PhantomJS, Xbox Live, PSN  //  Tags: , , , , , , , , , ,   //   Comments

I've made a ton of progress on my XBL scraper over the past couple of months and am nearing completion. Features include grabbing a user's full list of games and achievements for all time as well as pulling a subset of information based on a date range. I implemented the date range feature because I wanted to speed up incremental updates. One of my beta testers has reported it takes about 15-20 minutes to do a full dump of his information. He also has over 100 games with about 40-60 achievements each.

Right now, my XBL scraper only pulls down information for the currently logged in user. I had thought about having my users on my site provide their login information for pulling down their achievements and recently played games, but there are huge security concerns with me storing Xbox LIVE user names and passwords in my database. One disadvantage to me pulling information from other user profiles is that any achievement that I have not unlocked the image will be returned as a grayscale image. This is not a huge issue though. I'm more leaning towards using my own account to get user data instead of other users' accounts because I don't want to be burdened with security of storing their credentials on my server. If people want color images for achievements, I will just need the community to submit their color images for their achievements to the database. I have also been thinking of a way to have my script run idle on my server while waiting for input from the caller. This will hopefully speed up processing of the data.

On the PSN front, I have begun analyzing various data sources for getting trophy data and recently played games for a PSNID. I've started developing a similar script for pulling information for a PSNID. The PSN scraper is still in its infancy, but it is making steady progress. With my analysis of PSN trophy images, it appears that images for trophies will be returned as color images for public trophy profiles and personal trophy profiles. However, the locked trophies show a locked image next to the trophy. I'm hoping to get community involvement to submit complete trophy images for the locked images. With the way that PSN shows earned trophies, with enough people in the community, the missing images should easily be filled in automatically.

I plan to release premium subscritpion APIs for these scripts in the future. Please stay tuned for more information.

Simple Options Parser for PhantomJS

18. November 2011 14:33 by Cameron in javascript, PhantomJS, Programming  //  Tags: , , ,   //   Comments

Recently I needed a way to parse command line options with PhantomJS. I didn't see anything else on the web that allowed for abitrary ordering of command line arguments to PhantomJS scripts so I made my own. Here's the code for those interested:

// argument results
var a1, a2, a3, a4;

function optionParser() {	
	var opt = 0;
	while((opt < phantom.args.length) && (phantom.args[opt][0]=='-')) {
		var sw = phantom.args[opt];
		switch(sw) {
			case '-a1':
				a1 = phantom.args[opt];
			case '-a2':
				a2 = phantom.args[opt];
			case '-a3':
				a3 = phantom.args[opt];
			case '-a4':
				a4 = phantom.args[opt];
				console.log('Unknown switch: ' + phantom.args[opt]);

This can easily be modified to work with an array of argument results or you can simply read in each argument into its own variable. Also, you can read in integers and in your application logic, use isNaN() to check if the input is a valid integer.

Newest Progress on my XBL data scraper

31. October 2011 17:09 by Cameron in Xbox Live  //  Tags: , , , , , , ,   //   Comments

It's been a while since I last posted, but I have made some great progress on my XBL data scraper. I made some additions to include CDATA tags in the descriptions of achievements as some sample data that I ran into contained ampersand (&) as well as other xml entities in the text and it was creating xml parser errors. Also, I had to add some code to replace ampersand (&) with the xml entity &amp; in xml attributes as I was getting more parser errors with my sample data. This goes the same for other xml entities. Now that these issues have been resolved, I believe my data collector can pull anyone's profile information, given enough time. After testing the scraper with one of my friend's profiles, he has nearly 100 games with 900+ achievements, the initial import into my database took on the order of 7-10 minutes. To deal with manageable updates, I will have to scan a subset of the most recent games played as I don't want it to take as long with incremental updates. The question is how frequently I should do these updates. The incremental updates have not been implemented yet, but will be put into effect soon. I have setup a test site for processing user profiles and viewing collected sample data. I will not make this link public, but if you're interested, shoot me an email and I can share the link with you.

Month List

Tag cloud