Since my last update Escape from Alcatraz update I have implemented rudimentary conversation and inventory systems, both of which make exclusive use of Flash and Scaleform for their visual components.
Please ignore the flamboyant inventory colour scheme, the various dialogue typos, the completely unrelated audio, and the implausibility of a spoon and newspaper merging into straws. That’s really all just proof of concept for now – with these fundamentals in place I can start looking into putting some puzzles and scenarios together in the hopes of getting things feeling a little more like an actual game.
This was my first foray into the realm of Scaleform, and it definitely took me a while to wrap my head around syncing Swf files with UnrealScript. The process is actually quite straightforward, though, and the UDN (Unreal Developer Network) has a couple of great resource on the subject. The first is a general overview of Scaleform and how to get it up and running with UDK, while the second is a more technical guide that details the classes required for UnrealScript integration.
Under the hood my conversation system is represented as a linear progression of stages – each containing its own dialogue, NPC responses, sound cues, and so on. Progression between stages is purely linear – once the player selects a certain dialogue option or provides an NPC with a desired item, the conversation moves to the next stage – there is no real tree structure to speak of. While this may sound limiting, it is suitable for my purposes and easy to understand.
Scaleform is pretty flexible in terms of integrating ActionScript and UnrealScript. But given that I am not very familiar with ActionScript I opted to use UnrealScript as much as possible. In fact, at no point outside of testing and debugging did I have to write a single line of ActionScript in order to implement all of the functionality you can see in the video above. While I’d love to brush up on AS one day, given the time constraints on this project I felt it was best not to get too sidetracked.
My conversation system UI is built almost exclusively using CLIK components – mostly buttons. CLIK components are provided along with Scaleform in order to offer functionality out of the box that prevents you from having reinvent the wheel. They also tie up nicely in UnrealScript terms – with initialization and event callbacks built in, amongst other bonuses. Each CLIK component has an underlying ActionScript class which you can hook up to your own custom components, too.
I rather foolishly began creating a completely custom inventory UI before I discovered that UDK comes with a lovely Inventory example flash file, complete with components for inventory slots that support drag and drop operations. By using these elements in place of my original creations I shaved a good chunk of time off my development schedule, and was able to focus on extra features, such as item merging/combination, instead.
Syncing up Swf file data and UnrealScript variables was a fair sight more complicated for the inventory system than it was for the conversation system. The order of items can be re-jiggled freely, items can be removed entirely when merged with others, and so on. Most of this work is done in a class that extends from GFxMoviePlayer (which handles Swf files directly) with item data passed in via an Inventory class that is owned by the player.
With a user interface for the inventory in place I went back to the conversation system and extended it to allow the player to give items to NPCs during a conversation. Eventually I would like for the player to be able to give items in a more conventional point-and-click fashion – by selecting an item and clicking on an NPC in the world – but this system will suffice for now, and it should streamline interactions (no need for jumping in and out of conversations) in the final game, too.
What’s next? Puzzles! With most of the core mechanics of my adventure game in place I can start to look into interesting things for the player to actually do.