Friday, March 1, 2013

Getting Flash to Talk to UDK - part 1

Introduction -

I've been working on different Flash UIs in UDK for a few months now, and the evolution of what I could do before to now is pretty astounding. This is my third foray into the world of Scaleform and I have to say that I am feeling better and better about what I am doing.

My goal with this next series of posts will be to detail HOW I got Flash to work with UDK, and then go into what I did in Flash and what I did in UDK.

If anything, I'm hoping that I can have a series of tutorials that will guide would be newbie UI creators into what its like to create a HUD in Flash for use in their own UDK game.

There will be certain assumptions made during this process:

1) I assume that you have Flash. This is unfortunately an expensive requirement. Luckily, if you are a student, you can purchase Flash Professional 6 for $200. Or, if you are taking a one month class, you can "rent" flash for $20 a month.

2) I assume that you have a pretty recent version of UDK installed. As far as I am aware, this will work on version of November 2012 and February 2013. Those are the two version I've been using on these projects. This could work with an earlier version, but I have no guarantee of that.

3) I assume you have a good script editor for coding uScript. I use Note++. Some people use different IDEs, but I tend to hate how big they are. Note++ is fast, and does what I want it to do.

4) I assume you have done something in UDK and Flash before. Though I will do my best to tackle all that is absolutely necessary.

5) I assume basic coding/scripting and computer knowledge. If you have never scripted before, this may not be a good entry point. I will do my best to cover what is needed.

6) I assume you have an image editor that can output PNG files. Such as paint.net, gimp, or Photoshop. This tutorial will NOT cover this at all. The focus here is for Flash to UDK communications.

Setting Up Flash -

Setting up your Flash work environment is very important. Though future version of UDK may be able to work with Actionscript 3, the current set up, as far as I am aware, requires Actionscript 2.0 and Flash 8. This limits what can be done a bit, and also makes something more difficult. When looking for hints and additional help in Google, remember to ad AS2, Actionscript 2.0 or Flash to UDK to whatever it is you are searching for.

Under File, go to Publish Settings, and click the second tab on that option dialogue that opens up. Set the player version to Flash 8 and set actionscript to 2.0. It should be okay to leave the rest alone.



Next, you need to set up the canvas. The canvas should be at 30 fps, and the size I use is 1980x1080 (in uScript, you'll be making it scale). The size of all object should be to the power of 2 (2, 4, 8, 16, 32, 64, 128, 256, 512 etc). This is because UDK deals with it better. Example make an image 64x128.

I'll begin by adding base functionality to the menu, and once we have it working we'll move on to connecting it with UDK through uScript. Note, that my set up is different, as I own Flash on a Mac, and cannot test the way you could if you had it on a PC.

Creating the Flash file will be on the next installment.