LéBlog(string stories){

          return blog;

}

So back in this post I explained how to get started developing iOS apps on a windows machine, using FlashDevelop and AS3.

So I recently had to submit my own game to the App Store and then and only then did I look into the steps to submitting to them. I thought I'd outline them here quickly for anyone else who needs help.

When you are done working on your code, change the build drop down option at the top of FlashDevelop to Release instead of Debug.

ReleaseDropDown

Build your project (F8).

At this point, you need to get Distribution p12 and mobileprovision files. On a mac, this is really easy. It's well documented and covered by Apple here, so I won't go into the process myself. For those of us working on a windows machine you need to go through OpenSSL once again. A lot of those details are covered in my previous post so I won't go into it too much. In a nutshell, you need to download and install OpenSSL. When installing it, if you get an error due to some missing C++ redistributables, download them from the list and install that first, then re-run the OpenSSL installer. Install to all default settings.

After you've installed OpenSSL, open a command prompt window enter these commands in order. This will take you into the bin folder in the OpenSSL directory, and from there you will issue commands to generate the files needed. NOTE: if you install the 64 bit version, change "Win32" to "Win64" in number 1 and 2.

  1. cd C:\OpenSSL-Win32\bin
  2. set OPENSSL_CONF=c:\OpenSSL-Win32\bin\openssl.cfg
  3. set RANDFILE=.rnd
  4. openssl genrsa -out mykey.key 2048 (This generates a key that you will need later on).
  5. openssl req -new -key mykey.key -out CertificateSigningRequest.certSigningRequest -subj "/emailAddress=yourAddress@example.com, CN=John Doe, C=US" (Change the email address to your own, the CN to your name, and the country ( C ) to your country.)

Don't close the CMD window, but at this point you need to go to your iOS developer portal to upload that certificate signing request (CSR) file to get a distribution certificate. Follow the first step in these Apple instructions to create the certificate. After you create the certificate you need to download it. If it is not available for download immediately, refresh the page and the download button should now be there. Click download and save the file to the bin folder in your OpenSSL directory.

After you've created and downloaded the certificate, you can go back to the provisioning tab in your developer portal and then into the distribution section and finish creating your distribution provisioning profile. Download the file when it is available and put it into your cert folder in your app's directory.

Now go back to your CMD window and enter these commands:

  1. openssl x509 -in developer_identity.cer -inform DER -out developer_identity.pem -outform PEM (Change the developer_identity.cer filename, to your certificate's filename. This command will create a .pem file called developer_identity.pem, unless you change the name in the command.)
  2. openssl pkcs12 -export -inkey mykey.key -in developer_identity.pem -out iphone_dev.p12 (This uses the .key file you created earlier and creates your distribution .p12 file)

From there, put the .p12 file in your cert folder, and now that you have your distribution .p12 and provisioning profile in your cert folder, you can package your app as an App Store package (option 9 when you run the PackageApp.bat file in FlashDevelop). This takes a little while depending on the size of your app. When it's done compiling, that's it. You're ready to upload that .ipa file to Apple.

And here is where your Windows adventure ends. At this point, you NEED to use a mac to upload the file. When you get a mac, you can go to your iTunes connect page, and follow the links at the bottom of the page for a guide to how to upload the application.

itunesConnect

If you did everything right (providing also that I explained everything right), then you should be all set. Good luck, and if you find any problems please let me know!

Cheers!

-Nicholas.

Posted on by Nicholas | Posted in Adobe Air, AS3, General Information, Helpfulness | Tagged , , , , , , , , , ,

1 Comment

Sometimes you want/need to make numbers more readable by adding commas. I.E. instead of 10000 you want to write 10,000. Just looks better.

I was going to write my own little for loop, but I figured, why reinvent the wheel. I found this page and tried it out, and it works perfectly. So you can find the code there, or for simplicity's sake, I'll paste it here as well.

public function formatNumber(value:int):String {
	var vt:String = _votes.toString();
	var count:int = (vt.length - 1) % 3;
	var formatted:String = "";
	for (var i:int = 0; i < vt.length; i++) {
		formatted += vt.substr(i, 1);
		if ((i - count) % 3 == 0 && (i+1) != vt.length) {
			formatted += ",";
		}			
	}
	return formatted;
}

-Nicholas.

Posted on by Nicholas | Posted in AS3, General Information, Helpfulness | Tagged , , , , , ,

Leave a comment

 

So a couple of weekends ago, January 25-27th 2012, the Global Game Jam happened. If you don't know, GGJ is a worldwide game jam, where they give participants a theme, and they have 48 hours to create a game.

I worked with three very cool guys that I hadn't had the pleasure of working with before that weekend. Mike Doucet, Jonathan Phillips and Rhett Fester. We went into the jam with a game idea that we hoped would be able to work with the theme. We had a lot of ideas and concepts that got out of hand based on the time frame that we had to work with, but we eventually figured out what we needed to do and what we didn't have time to put into the game.

Luckily, the theme was "Heartbeat" and we implemented that easily into our game concept.

The main idea of the game was to make it a multiplayer, LAN game. Something top down, shooter, point based game. We also had ideas about lighting and the lack thereof. Both of these features I have never really messed with before, so it was a great learning experience for me, and I enjoyed every minute of it.

I hit a couple of walls based around the networking over the weekend, and it really killed a lot of the production time of the game, but in the end I think we finished a very solid game.

Sadly, there is no single player mode, so you can only play it really if you have another person to play with, or two computers that you could run a client on each machine to at least see the network interaction.

We have plans to work on the game some more, and add some more features to the game, but for now we all got other things going on.

It was built in AS3 wrapped in AIR, so you can download the .air file here. Just run the .air file and it'll install the client and that's it.

Hope you enjoy it, please feel free to leave your comments or concerns below, or contact me with any questions you may have.

UPDATE

The download link is now a zip file containing two clients. You can run both clients on one machine to see the networking functionality.

Also just as a quick guide to get the game started. When you enter the game and enter your usernames, you will then be in the lobby screen. At this point, one user needs to click  the "Join Game" button, which then makes that client the "server". At that point, if the other user clicks the "Join Game" button, they are now connected. The server then needs to click the "Start" button to start the game.

Before the game is actually started, if any user connects to the server, and then disconnects, and then tries to reconnect and play the game, the server will still think that the first user that connected is there. This is a bug that I never got around to fixing. So if some odd connectivity stuff occurs in the lobby, the safest thing to do is to recreate the server and try again. Hopefully one day I'll get around to fixing that.

-Nicholas.

Posted on by Nicholas | Posted in Adobe Air, AS3 | Tagged , , , , , ,

Leave a comment

reabsorbSS

 

GPCv16 started last week Monday. If you don't know, GPC is a monthly, week long game jam. They provide two themes, and you have a week to create a prototype around those themes. There is no competition or contest, it's purely for your own benefit.

This month's themes were ABSORPTION & FOUR COLORS.

A few thoughts ran through my mind as a game concept. Some fairly obvious choices that I think most developers would lean towards, so I wanted to slightly stay away from it.

THE GAME CONCEPT

The player controls four "players", each with a different aura color of light around them. Tiles in the level can be colored in the same color as the four players. The tiles are only visible if they are inside the radius of the corresponding light from the player. EXAMPLE: The red player show where the red tiles are, and as long as the tile is visible, any player can use it to move through the level.

So the player would have to use all four players to help each other throughout the level by showing tiles in a path to a goal. If one of the players get to the goal, the goal absorbs the player, and then shows all the tiles of that color permanently.

So thinking about it, that description seems kind of confusing, so how about you just go here and download the game, install it, and play it yo!

There are currently only three maps in the game. The first being very simple and straightforward, which would act as a kind of tutorial. The other two were made by two friends of mine that I worked on the GGJ with, Mike and Jonathan. There are also a couple of collision detection issues, but nothing too game breaking or major. I really need to work on a proper collision detection framework.

It's packaged as an AIR application. So just install and run it and all should be well. There is an updater built in as well, so when there are any updates or new maps, the client should prompt you to update.

There is also a MapCreator that I built separately to the game. It's technically an application that the user can use to simply create a 2D array. It helps a lot, cause I hate managing and editing a 2D array in a text file. The MapCreator also allows the user to create a tile preset including adding .png files to better represent the tiles and map that you are building in the application. If you are by chance interested in using this application, let me know. I could try to clean it up and make it a little more general user friendly.

If there are any issues, please let me know!

Have fun!

-Nicholas.

Posted on by Nicholas | Posted in Adobe Air, AS3, Flash, Game Prototype Challenge, Gaming | Tagged , , , , , , , ,

2 Comments

So after searching quite some time for an "easy" and to-the-point tutorial on how to add code that would allow my application to check my server for any updates to the client, I finally found one that set me along a path that made sense. Now besides his code text being super small and a close to un-readable, there were one or two errors in his code, at least I think there were. I had to tweak stuff to get it to work.

This is what I used...

 

*NOTE*

The ApplicationUpdaterUI class wasn't "found" by intellisense or the IDE inside of the API for some reason. But the code compiles and runs perfectly fine. If anyone knows why this is, and how I can fix it, please let me know. My O.D.D would like the class name to change color in Flash Develop.

package  {
 
	import air.update.ApplicationUpdaterUI;
	import air.update.events.DownloadErrorEvent;
	import air.update.events.StatusUpdateErrorEvent;
	import air.update.events.UpdateEvent;
	import flash.events.ErrorEvent;
	import flash.filesystem.File;
 
	public class AppUpdater {
 
		private var appUpdater:ApplicationUpdaterUI;
 
		public function AppUpdater() {
 
		}
 
		private function onStatusUpdateError(evt:StatusUpdateErrorEvent):void {
			trace(evt.toString());
		}
 
		private function onDownloadError(evt:DownloadErrorEvent):void {
			trace(evt.toString());
		}
 
		public function checkForUpdate():void {
			trace("checking for new application");
 
			appUpdater = new ApplicationUpdaterUI();
			appUpdater.configurationFile = File.applicationDirectory.resolvePath("xml/update_config.xml");
			appUpdater.addEventListener(UpdateEvent.INITIALIZED, updaterInitialized);
			appUpdater.addEventListener(ErrorEvent.ERROR, onError);
			appUpdater.addEventListener(StatusUpdateErrorEvent.UPDATE_ERROR, onStatusUpdateError);
			appUpdater.addEventListener(DownloadErrorEvent.DOWNLOAD_ERROR, onDownloadError);
			appUpdater.initialize();
		}
 
		private function onError(event:ErrorEvent):void {
			trace(event.toString());
		}
 
		private function updaterInitialized(e:UpdateEvent):void {
			trace("checking for updates");
			appUpdater.checkNow();
		}
 
	}
}

So you need to create the "update_config.xml" file and place it somewhere in your project's file system. Basically that xml file tells the application where to look for a new version.

update_config.xml:

<configuration xmlns="http://ns.adobe.com/air/framework/update/configuration/1.0">
	<url>http://mysite.com/versions/update_descriptor.xml</url>
	<delay>1</delay>
	<defaultUI>
		<dialog name="checkForUpdate" visible="true" />
		<dialog name="downloadUpdate" visible="true" />
		<dialog name="downloadProgress" visible="true" />
		<dialog name="installUpdate" visible="true" />
		<dialog name="fileUpdate" visible="true" />
		<dialog name="unexpectedError" visible="true" />
	</defaultUI>
</configuration>

 

And once again, this xml file references another xml file. This time, this "update_descriptor.xml" file is stored on your server. So you put the update_descriptor.xml file at the path that you have declared in the update_config.xml.

update_descriptor.xml:

<update xmlns="http://ns.adobe.com/air/framework/update/description/1.0">
	<versionNumber>1.1</versionNumber>
	<url>http://mysite.com/versions/MyGame.air</url>
	<description>Version notes go here</description>
</update>

This xml file sets the url that the AIR file should be located at on your server.

****IMPORTANT***

Make sure that you build your applications with the <versionNumber> in the application.xml file being the same as the versionNumber that you use in the update_descriptor.xml.

Hope this helps you out and works for you. Makes updating builds such a breeze.

-Nicholas.

Posted on by Nicholas | Posted in Adobe Air, AS3, Helpfulness | Tagged , , , , , ,

4 Comments

So in preparation for Global Game Jam in a couple of weeks, I started looking into multiplayer capabilities using AS3/AIR.

It was a tiring search among many different blogs, videos, sites and presentations... there were many blank stares from me at very early hours of the morning. But in efforts to keep this to the point and make it maybe a bit easier for others who are searching for information on this topic, I'll get right to my point.

I have FINALLY gotten my P2P (Peer to Peer) connection issues sorted. I initially started looking at the ServerSocket(TCP) instead of RTMFP(UDP) within AS3, but I quickly realized that a) P2P would be much easier, and b) more applicable for my needs. I wanted to get LAN connectivity going for the purpose of a game, but to get used to the whole system, I built a chat client first (which will be later implemented into the game).

For an online example you can go here.

For an AIR client, you can download this.

This works strictly on LAN only, so opening multiple clients across multiple machines on the same network should work. AS3 uses RTMFP to connect P2P. You can read all about it on your own time, but one issue you may need to look at is, if your devices/machines can connect due to some UDP and other possible firewall restrictions. The easiest way is to check this site. If the very first light at the top is green, then you should be good to go. Or if your lights look like the below screenshot, all should also be well.

RTMFP Connectivity Check

I have two machines on my network, and for some reason connecting my laptop second takes a little while before the clients see each other. But they definitely do eventually connect. But if I connect the laptop first, and anything else after, then all works immediately. I do believe this problem lies with the desktop, but I cannot figure it out, and don't have much desire to just yet. So you may or may not run into problems like that, but trust that it does work providing your firewalls allow it.

There are a lot of little details that you should know when working within RTMFP, and I won't go into it in detail here as it is very well documented all over the internetz, but of course if you do need any advice/help, please feel free to leave some comments below.

I will post the source code for the client soon, as soon as I clean it up and maybe add some comments. The client uses Minimal Comps for the UI. I found this library while searching for information on P2P, and I love it. It's very much made for just quick prototyping stuff. I did alter a couple of things for text color and whatnot, but the base classes don't need to be altered. They work very well. I highly recommend it.

Here are a couple of good tutorials and sources of information on P2P in AS3. Again, any questions or comments, please feel free to leave them below.

*UPDATE*

So originally my laptop was connected to the network via wifi, and my desktop was plugged directly into the router. And connecting was very hit or miss. Sometimes connecting with the laptop first, then the desktop would be instant, and other times connecting with the desktop first, then laptop, was instant. It was very odd.

I just plugged the laptop in, so now both machines are wired, and both orders of connecting was instant. So looks like having devices connected differently seems to throw a snag into the connectivity. Let me know if you have any of your own experiences with this and let's try to figure it out together!

- Nicholas.

Posted on by Nicholas | Posted in Adobe Air, AS3, Flash, General Information, Helpfulness | Tagged , , , , , , , , , , , , , , , ,

17 Comments

Okay, so it's been like... years. So firstly, HAPPY NEW YEAR!! I hope the holidays were fun and full of good times!

This post is going to simply be a basic update on me. I do have technical stuff to post about, but that deserves it's own separate post.

So I think the last time I made a post I spoke about Pollinate, and working on it. Sadly that didn't really pan out. I didn't really work on it, totally my fault. I did however start a completely new project that I am determined to finish and release on the App Store within the next month. I hope.

I finally got my work permit in December, and shortly after I went back to Trinidad till just before the New Year. So the job hunt is now on. I have to scour the country looking for people who want to pay me to mess around with their games and IPs. That should be fun. Let's hope I find that soon, cause I am OVER broke.

Other than that, I've just been here working on the aforementioned game. I hope to "announce" it soon, but right now my time is being taken up in preparations for Global Game Jam. I am working with three guys that I have never worked with before, and before last week, never met before. But that's what it's all about, and I am very excited to see what comes from it. Very very cool guys and I think some good stuff could come out of this adventure.

Specifics about the GGJ preparations will be in the following post that I am going to post right after posting this one. That one should be fun. :)

For now, that's it for my life updates. Nothing going on but being broke and trying to find a way to be un-broke. Wish me luck.

Cheers!

- Nicholas

Posted on by Nicholas | Posted in General Information | Tagged , , , , ,

Leave a comment

So it's been quite a while. Months in fact. So I figured I'd write up a quick update post. I do have a piece of helpful knowledge to post, but I'm leaving that for another day... maybe tomorrow.

Since finishing my internship at Untold Entertainment on August 3rd, I've been slumming it at home mainly for the reason that I cannot work legally up here in Canada. So the week after I finished my internship, I applied for a work permit and was told that it would take 52 calendar days, which by now has definitely been passed, but yet no work permit. First World Problems...

When I left Untold, I actually got a job offer at a very well known and highly regarded mobile game company which I subsequently lost due to my lack of a work permit. It sucked pretty bad cause it was a very good position to get straight out of school technically. But at least it wasn't due to any negligence on my part. So I just need to sit here and wait for the government to do their thing. Hopefully it comes soon, cause I'm super broke and I need to get my job on soon.

Anyway, other than sitting at home and doing nothing, I recently got introduced to a very cool artist named Nicole who is looking to get into the game development business and needs some games to put in her portfolio. So basically, I got an artist to work with for at least one project, if not a couple after. It's a good thing cause now I have incentive to finish this project to completion. Makes me be a little more productive than I've been the past couple of weeks.

Anyway, that's it for now really... in a nutshell.

Below is the first art concept piece that Nicole gave me tonight.

- Nicholas.

Posted on by Nicholas | Posted in General Information, Pollinate | Tagged , , ,

Leave a comment

Or more specifically, its center point.

A lot of times you may have a sprite with its registration point at the top left, or maybe somewhere else that isn't in the center, and you want to scale it from the center point. You can't just move the x and y, scale, and then move it back. It doesn't work like that. Think about it for a little while and you'll understand why.

Instead you need to use Matrices. And if you're anything like me and a lot of other programmers out there, FUCK Matrices!

But this one isn't too bad. In fact you could probably copy pasta this shit.

I wanted to scale this object evenly along the x and y axis and when it got to a scaleX and scaleY of 1, then stop. So this is what I did. If you want to just simply scale it to a value, then don't increment the mScaleFactor, and instead just set it to the value that you want to set the scale at. You'll understand...

On to the code!

if (!bSpawned) {
	if (!startLocation) {
		startLocation = new Point(x, y);
	}
	bitmapScaleMatrix.identity();
	mScaleFactor += scaleY;
	bitmapScaleMatrix.translate(-16,-16);
	bitmapScaleMatrix.scale(mScaleFactor, mScaleFactor);
	bitmapScaleMatrix.translate(startLocation.x + 16, startLocation.y + 16);
	this.transform.matrix = bitmapScaleMatrix;
	mScaleFactor = 0.02;
	if (scaleY >= 1) {
		scaleX = 1;
		scaleY = 1;
		bSpawned = true;
	}
}

So obviously most of these variables are class variables, and all of this code is also inside an Update() loop. I set my startLocation in this fashion because of how I had stuff set up. Generally you would probably set that up in the constructor. Also, in my case the sprites were 32 x 32 hence the translations by 16.

Hope this helps someone else, it took me a while to find it online.

Cheers!

-Nicholas.

Posted on by Nicholas | Posted in AS3, Helpfulness | Tagged , , , , , , , ,

Leave a comment

I've always been a little wary of using sprite sheets. Not cause it seems complicated or any other valid reason, but mainly because I didn't know how to do it and in Flash and AS3, it's easy enough to stick everything into a movieclip and manipulate it through code. I recently hit a lot of optimization problems in some mobile games that I was making and I realized that sprite sheets would probably save a lot of resource power.

So recently I started building some "systems" that I hope to one day be able to put together into an engine that I could probably use to expedite development. So in starting that, I decided to look into sprite sheet manipulation. I found these two posts which basically give you all the code to do it. It's very cool, and obviously if you read through the code it will all make sense. There are a couple things that I would probably change or do differently for my applications, but for the most part it's a very helpful start.

Part One & Part Two.

One key difference that I had to do for my application was dynamically load the .png file that I was using as the sprite sheet.

I believe his code is done directly in flash, possibly on the frames, so he doesn't need to load the assets. Because I am working in Flash Develop and normally load assets through a .swc, I had to get the .png file in there somehow. I couldn't make a bitmap out of the .png in flash, add it to a .swc, and then import that. ( I'm actually not sure how come, but I couldn't get this method to work, if anyone knows please let me know. )

So instead I had to embed the file at compile. This is achieved with:

		private var currentSprite:SpriteSheet;
		[Embed(source = "/../bin/spriteSheet.png")]
		public var sheetClass:Class;
		private var sheet:Bitmap;
 
		sheet = Bitmap(new sheetClass());
 
		currentSprite = new SpriteSheet(sheet, 24, 32);

Note that the sheetClass declaration is the line directly below the embed. This tells the compiler that the embed will be put into that variable.

That's it. As simple as that. If there are any questions, feel free to leave a comment.

Also, if you want a simple top down type of character sprite sheet, this is a pretty handy tool. It's not the best, but it gets the idea and job done as initial artwork.]

-Nicholas.

Posted on by Nicholas | Posted in Adobe Air, AS3, Helpfulness | Tagged , , , , , , ,

2 Comments

Copyright © 2012 Nicholas Ng-A-Fook | All Rights Reserved