Tuesday, January 31, 2012

UDK Woes

So yesterday I buckled down and spent the whole day working on getting the main menu hooked up for my senior project game. Needless to say, I didn't get anywhere near as far with it as I would have liked, but I really figured a lot of stuff out - stuff I didn't expect to be quite so challenging. Granted, some of those things were due to my own stupidity (accidentally saving maps in the folder of an older UDK release and wondering why it kept complaining about external packages, and also not noticing when my debug log statements were showing up in the window amongst all of the other crap UDK feels like printing).

So it seems that taking the ActionScript 3 route was not the greatest decision - it's only been supported in UDK since the November release, so needless to say they're still working out the kinks, and some of the AS3 specific details are sparsely documented. Still, I truck on.

I ran into a couple major issues - one of those being that my custom GFxMoviePlayer class' WidgetInitialized method not being called. At all. Funny thing! This is supposed to be the official, supported method of having UnrealScript recognize the initialization of various components within a flash file (buttons, for example - so you can hook up event listeners and have UnrealScript handle the clicks). Totally busted. The developers are aware of this, however, and the problem's fixed on their end - so it should be out in the next release. Unfortunately, I have to get these things working now. More info here.

Thankfully, the link above suggested a convenient workaround, which brings us to the very rudimentary elements of flash-unreal communication. Using ExternalInterface.call lets you call any UnrealScript method within the custom GFxMoviePlayer class from ActionScript. Generally used as follows: ExternalInterface.call("myFunctionName","firstParameter","secondParameter",...)

Unfortunately, I hit another speed bump soon after - Adding event listeners in UnrealScript doesn't seem to work! So I could (I think) send the button objects to unreal, but couldn't do anything with them. Some forum posts suggested that the name of the event type had changed from 'CLIK_press' to 'CLIK_buttonPress', but it still didn't work for me. So at the end of the day, I decided to rely on the flash end to handle everything to do with the input, and just send data to unreal using ExternalInterface.call. I'm not sure how this would affect performance, but since it's a relatively unintensive menu system, it shouldn't be too bad.

At the end of the day, I ended up only managing to get a menu system with the Quit button working... but it's something.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.