Development Blog
Mastering UDK Game Development
I recently read a book on UDK game development called "Mastering UDK Game Development" by John P. Doran. I've typically focused on Unrealscript given that I'm a programmer, but the examples in this book cover some of the other tools available in the UDK, such as Matinee, Cascade, and especially Kismet. Overall, I thought the book wasn't that well written. Doran is inconsistent with his level of instruction, ranging from nearly patronizing to overly vague within only a few paragraphs. I was however impressed with how much was done without ever touching Unrealscript. I'm not saying that you could make a full game using nothing but Kismet, but Doran shows several examples of scripting together complex systems that I wouldn't have thought could be done in Kismet. Of course, this begs the question "should these things really be done in Kismet?" The answer is no. Kismet is a visual language for scripting in levels, not a gameplay design tool, but the examples do show the range of Kismet's capabilities and will probably open a designer's eyes to techniques and tricks that they may not have known about. One thing to be aware of though, this book is not intended for beginners. Not that the examples delve deeply into the capabilities of the UDK or show advanced techniques for gameplay creation, but you really already have to know what you're doing in order to get anything out of them. There's a phrase in the beginning of the book that says that it should be possible for someone with no prior experience to complete the projects. While that may be true, I felt like there wasn't nearly enough instruction during each project to fully explain what all was going on. It seemed the projects were more like lists of steps to follow in order to recreate the cool things Doran did rather than teaching you how to create your own unique cool things, which is fine for more advanced users, but terrible for someone just starting out. That being said, I think this book does a decent job of doing what it was meant to do: showing tips, tricks and cool ways of using the tools in the UDK that you might not have thought of. If you're an experienced UDK user and want to expand your knowledge of the capabilities of the UDK, I think this book is worth looking into, but don't expect to actually "Master" UDK game development. |
Recruiters and Freelance Work
I realized today that it's been over a month since my last post. Things have gone sort of crazy for me in that time and a lot has been happening, so I haven't really had time to post what I've been up to. It all started a little over a month ago, around the time I finished writing the Scaleform Menu System tutorial. Shortly after, I was contacted by a recruiter from a game company about the tools I've written and provided on this site. He asked if I would be interested in applying for a position with their company writing tools for their engine. The position was in another state however, and being unable to relocate, I had to turn down the opportunity to interview with them. Fortunately for me, they happened to have a studio in Utah where I live, but they didn't think that writing tools for their engine would really work out from a remote location. The studio in Utah was hiring for another position though, so the recruiter set up an interview with the Technical Director there. I've gone through two interviews now, and their biggest concern is my lack of "real-world" game studio experience (being none whatsoever :)). I think the only reason I've managed to make it this far at all is the fact that I do have a game released on the XBox Live Indie Games Marketplace. I haven't heard back from them yet, but I hope to soon! :) I also had to convert the ViewStack Scaleform component from AS2 to AS3, as Autodesk did not provide it for Scaleform 4. This was a lot more work than I expected it to be, and I still have a bug in there that I haven't quite been able to ferret out yet. Again, it seems to work fine on some machines but not on others (for the three I've tested it on anyway). So that's what's been going on and I apologize for neglecting this blog, but it has been an insanely busy month for me. |
Whew!
As I mentioned in my last post, I've spent the last little while writing the Scaleform Menu Tutorial, and it was quite an undertaking. When I started, I didn't know anything about CLIK components, so I had to figure that out since I knew it would make the tutorial way too long if I went over creating custom button classes in ActionScript. As I started to write it, I realized that there was a massive amount of information that I had to convey. I considered cutting parts of it out, but I wanted to cover as much as I reasonably could so that anyone else learning this stuff could have all the information they needed in one place. I added a few things to the web site as well, such as the "Featured Items" list on the home page that scrolls through...well, you guessed it, Featured Items! I also added the capability for anonymous comments at the bottom of each tutorial. I'd add comments to every page, but I have to create a spreadsheet in Google Docs for each one, so it's not very convenient. These components come from Google gadgets that I found and modified, which took me a couple of days as well. The documentation for writing your own Google gadget is next to non-existent, so you just have to look at the source for gadgets that have already been made and do your best. Once you get all the setup out of the way though, the meat of the gadget is just html and javascript, so it's pretty easy to customize them. Now that I'm finally done with the Scaleform Menu Tutorial, I think I'll work on creating a HUD for Astra. I also have a few updates I want to make to the Project Suite Management Utility, and I've been asked by the founder of Aelian Base Entertainment to help with their new game Vitaelian, which I think I'm finally ready to start on. I also have another game which is in the planning stages, so be on the lookout for that.
|
Good Things Come to Those Who Wait
I know it's been a really long time since I've posted any development updates, but that's not because I haven't been doing anything. True, I took a little vacation recently and preparing for it took up a lot of my spare time, but I've also been working on another (rather extensive) tutorial. If you've been reading this development blog, you'll know that I've been learning how to use Scaleform in the UDK, and I decided I wanted to share the things I learned in the hopes that others might find the information useful. As of right now, I'm a little less than a third of the way done with it, but now that my vacation's over, I'm hoping to wrap it up within a week or two. I'll be going through the process I used to create a simple menu system with three screens and CLIK components. It's going to cover how to set up your Flash projects, Actionscript 3, resource sharing, using CLIK components in Flash and Unrealscript and loading saved game data using DLL Bind and the modified Save Game State gem. So sorry for the hiatus, but give me just a little while longer and I'll be back into the full swing of things. |
Hosting a Domain and a Subdomain from Different Hosting Service Providers
A few months ago, I wrote a post about my disappointment with Google Sites' inability to host dynamic web pages (namely, php). I had written a time clock application in php, in part to keep track of the amount of time I spend on various projects, but mostly because I wanted to learn a little php. After I finished it, I found out that there's no way for Google Sites to host that application. I thought about using a different hosting company, but I didn't want to move this site off of Google Sites because, one, I've spent so much time and effort creating all the content here, and two, I didn't want to have to pay to host it. A friend of mine told me about Freehostia, but there was still the matter of having to basically re-create the website over there. I could have purchased a new domain name, but that seemed silly just to host one simple application, so I decided to give up on it. A few weeks ago though, I started wondering if I could just create a subdomain of mavrikgames.com and host it on Freehostia without transferring the entire website. As it turns out, you can, but after quite a bit of research, I really couldn't find any instructions that were all that helpful for a website novice such as myself. Sure, I found lots of posts telling how to do it, but they were all written as if you owned both hosting servers, not that you were trying to do it using two separate hosting companies (like Google Sites and Freehostia) and a DNS manager from yet another company (Godaddy). Also, for one who isn't totally familiar with DNS records (A records, CNAME records, etc), it can be very difficult to find a straight answer in plain English! Eventually, through mostly experimentation and the few resources I could find (and after studying DNS records and management), I was able to piece together the system. I thought I'd write this post to help others who may be attempting to do the same thing. I'm not writing this as a tutorial or anything (there's not nearly enough content for that), but a few simple instructions should help. Lets say you already have a domain called "domain.com" hosted with one company (ie: Google Sites) and you want to add a subdomain: "subdomain.domain.com" and host it with another company (ie: Freehostia). The first thing you should do is host the subdomain with the second hosting provider (Freehostia). You'll have to figure out how to do that with your hosting provider, but with Freehostia, you just have to click on the "Host Domain" button in the "Hosted Domains" tab. You have to specify the whole subdomain name (ie: "subdomain.domain.com") in the field where you enter the domain name to be hosted. If the Hosting service provider has an option to manage the DNS records, you can disable it because you manage the DNS records from the same place as the base domain. Once the subdomain is registered, you should see an IP address associated with it. Copy that IP address and head over to your DNS manager (ie: Godaddy). In your DNS manager, you should see entries for A records and CNAME records. A CNAME record is just an alias for your domain, so typically (when you're hosting the subdomain with the same hosting company as the domain), any subdomains go there. When you're hosting the subdomain with a separate hosting company though, you actually need to add an A record. This is different in different DNS managers, but in Godaddy's, you just have to click on the "Quick Add" button. Under the "Host" column, just type in the subdomain name (ie: "subdomain"), and under the "Points To" column, you enter the IP address you copied earlier. That should be it. It can take up to 48 hours, but that's not typically the case. With any luck, you should be able to test your new subdomain within an hour or two. |
Scaleform Game Menu
It's been a few weeks since I've posted anything, but I've been quite busy learning how Scaleform works with the UDK. I've been setting up a rough draft of a menu system for Astra, and the learning curve was a little steeper than I imagined it would be, especially since I already had so much experience using Actionscript 3.0. My Flash skills were a little rusty (I think the last time I did anything with Flash was five or six years ago), but it all came back to me once I got into the swing of things. It did take me quite a while to figure out how to structure everything though. I wanted a menu system with three different screens:
I started out by trying to include all three screens in one SWF, but the code as well as the layout quickly became cluttered and messy. I thought about splitting the screens up into their own SWFs, but they all shared the same "theme", so I didn't want to duplicate any of my images or other resources. I then came across UDN's page about resource sharing and decided that I would make one resource SWF and a separate SWF for each screen. I made them all inherit from a "FrontEnd" class, and that cleaned things up nicely. Now I had separate SWFs without duplicating any images. The next hurdle was trying to decide what should be handled in Actionscript/Flash and what should go in Unrealscript. The UDN recommends that you don't do any heavy lifting with Actionscript and avoid putting it on the timeline as much as possible. Also, never use code based animations unless you have to (coded tweens, animation loops, etc.). I decided to keep all the animation stuff in Flash, and I would handle the logic in Unrealscript. I also decided against using CLIK components for now, but I'll study up on those later. Finally, it was time to plug my SWFs into the UDK. Importing was easy and setting up the level for the front end wasn't too bad, though I did have to watch a few tutorials and read some documentation. The hardest part came when I tried switching the SWF that the level was playing. I'd made different SWFs for each screen, and the Open GFx Movie Kismet node only lets you plug in one SWF to play. I debated trying to set up a Kismet system to do it (like using a command line event or something to start a second and third Open GFx Movie node), but I wanted to see if it could be done in code first. I studied the UDK FrontEnd classes, but they use a view stack system that seems completely proprietary to their own front end. I couldn't reuse a lot of their stuff for what I wanted. I looked at the UTHUD system too, and what I found was promising. It has a separate class for the PauseMenu SWF that extends GFxMoviePlayer, and it creates a new instance when the player pauses the game. I dug around to see how they added the PauseMenu SWF to the display, but couldn't find anything. I thought that it had something to do with it being a HUD class, so I didn't bother trying it before I dismissed it. I also tried changing the MovieInfo variable of my GFxMoviePlayer class, but it didn't seem to have any effect. Then I found this post on the forums. It seems that in order to load a different SWF and actually get it playing, you have to create a new instance of a GFxMoviePlayer (or a subclass). I decided to give it a try and eureka! My guess is it's built into the GFxMoviePlayer class somehow to add itself to the display when a new instance is created. Finally, I wanted to populate the Load Menu buttons with names of saved games that actually existed. I needed a way to read file names, but I couldn't find anything on how to do that with Unrealscript. I knew exactly how to do this with C#, having used similar functionality for PSMU, so I wrote a quick little function in C# and used dll binding instead. There's still a lot of work to be done as far as making the menu look better (I've never claimed to be a very good artist :) ), but at least the functionality is in place and I've learned a butt load about how to use Scaleform with the UDK. |
Scaleform
For the last few weeks I've been researching the Scaleform UI system. Mostly, I've been trying to figure out a good way of doing it without using Flash Professional, since I don't feel like forking out seven hundred dollars just to make my UI's. I tried Vectorian Giotto, but was disappointed to find that it only supports Actionscript 2.0 and Flash 8. Given my past experience with Actionscript 3.0, I just can't stomach trying to use AS2. Next up was FlashDevelop, which is a very handy little IDE. It's basically a free version of FlashBuilder, which I've used extensively in my professional career. I played with FD for a while, but I couldn't get UDK to recognize anything I was creating. The SWF files I was compiling played just fine when I launched them, but I couldn't get them to play in UDK. I don't know for sure, but it seems that Scaleform doesn't support MXML, which is the main method of creating content in FlashBuilder/FlashDevelop. Since creating everything through Actionscript would be kind of a nightmare (not to mention, a little slow at runtime), I decided to give SWF Quicker a try. I really was hoping for a free solution, but the price of SWF Quicker is a fraction of Flash Professional, so I thought I could handle it. SWF Quicker seemed to work just fine until I tried creating some custom classes (namely a button class) so that I wouldn't have to keep repeating all my code, then it started crashing. I played with the symbol linkage for hours with very little luck. Although I'm very hesitant to purchase such buggy software, SWF Quicker was the only one that gave me any results at all, so I might be stuck with it. I'm going to have to overcome my discomfort at placing all my code on the timeline too, since I can't link anything to a class. I guess it's time to decide what leaves a worse taste in my mouth: Vectorian Giotto with AS2 or buggy SWF Quicker with all my code on the timeline. :( |
Heightmaps and Landscape
I've been exploring the landscape system in UDK for the last week and a half or so, and discovered that you can import heightmap data to create a landscape. I knew about the concept of heightmaps - I read a tutorial once for XNA that created terrain from grayscale images - but the UDK uses a file format that isn't actually an image. It's called "raw 16", which is just a binary file containing a continuous string of 16-bit numbers. UDK reads the file from left to right, top to bottom and assigns each 16-bit number as the height for the "next" voxel. I wanted to try editing a basic heightmap and importing it to UDK so I'd have a starting point for my overworld map. Well as much as I love computers, trying to edit binary files is just no fun, and even passing the file through a hex decoder just leaves you with what appears to be a hellaciously long number. I knew that heightmap data could be represented as a grayscale image, so I did a few google searches for software to convert raw files to images and vice versa, but I came up with nothing. As is usually the case when I can't find the software to do what I want, I make it! :) After a few days, I had the HIC ready to go. It wasn't too difficult, once I understood the format of the raw files and how to convert binary data to grayscale images in C#. Well wouldn't you know it, not even a week after I uploaded the installer to this website, I found Li'l Chips Software's HMCS. I guess my google-fu is getting weak! I found that it did almost everything I needed, and even a few things I didn't. I think it was originally designed for the UDK terrain system, so it has a 513 x 513 cap on image size, and it doesn't support 8-bit layer data conversion, but it's still a really good tool. I definitely would not have gone through the trouble of writing my own tool had I known it was out there. So if you need heightmaps bigger than 513 x 513 or if you want to create the layer alpha maps in an image file, feel free to use the HIC. If you don't need those features though, the HMCS is a tool that's had much more thought and hard work put into it, so I'd try it first. |
Level Editing
This weekend, I made my first attempt at creating a world for Astra. My idea is to make an "overworld" map so the player could walk around from place to place and when they get to points of interest, I'll switch from the overworld map to that place's map - Final Fantasy/Zelda: Twilight Princess style. The first system I tried used streaming Terrain components. I split up the overworld terrain into several smaller maps and I streamed them in by distance. The problem was, they were each way too big, and streaming them in caused the game to hang for
a noticeable amount of time while they loaded. The terrain has to be big though so that it actually takes a little time to get around. I started searching for suggestions about how to best load giant maps, and I found out about what UDK calls Landscapes. Landscapes are basically the same idea as Terrains, but they're implemented via heightmap textures instead of mesh data. As the page states, this allows the levels to be much, much larger and still be efficient. It uses an interesting LOD system as well. Each LOD is a separate mipmap texture, and they use HLSL to interpolate between LOD's, creating smooth and seamless transitions. I used HLSL extensively when working on the graphics system for The Last Pod Fighter, so it's exciting for me to see other systems using it as well (meaning I didn't just waste my time learning it, but it's actually being used in the industry!). The good thing is, my work with Terrains isn't completely worthless. You can convert a Terrain into a Landscape, so I won't have to completely redesign the world again. I haven't had a chance to experiment yet, but I'll post again when I do. I'm quickly realizing that this is the area of game development that's going to be the toughest for me. I'm a fairly experienced programmer and I'm getting very comfortable with Unrealscript. I also have quite a bit of experience with 3D modeling and texturing (though due to my limited artistic ability, I have to resort to less complex/detailed assets and stylized characters). Unfortunately, I have zero experience designing levels, since The Last Pod Fighter is a dog-fighting game that takes place in space. I've never actually had to design a level before, much less use the complex system in UDK. Not only do I need to learn how to use the system, but the amount of time required to create anything interesting can be staggering. I think as long as I keep my expectations in check and don't get too carried away with the project though, I should be able to learn what I need to. |
C#, nFringe and DllBind
I know it hasn't been very long since my last post, but I've found out a lot of interesting things in the last 24 hours and I thought I would share to make it easier for anyone else searching for some answers. First of all, if you haven't heard of DllBind, go check it out. It's a way for UDK (non licensee) developers to implement external C code into UnrealScript. I wanted to try using this to encode the Json data from the UDK Gem save system so that it would be harder for players to cheat. As I started looking into it, I read that any language that can be passed through a C compiler could be used, so I wondered if there was any reason I couldn't use C# instead of C++, given that I'm much more familiar with it due to my work with XNA on The Last Pod Fighter. I found out that the DllBind functionality in UnrealScript is only able to use un-managed dlls, and C# of course uses managed binaries and a JIT compiler (just like Java). I wasn't too discouraged as I actually do have a fair amount of experience with C++, but I'm just more comfortable with C#. Just as I had given up on the idea, I ran across a tutorial that talked about using C# for DllBinding in UDK. It shows how to use a Visual Studio template created by Robert Giesecke to export your managed code to un-managed dlls. He also shows how to marshal string parameters and return values so that they're compatible with UDK's strings (as mentioned on the DllBind page, UDK's strings are quirky). As far as I know, you don't need to marshal other data types though, as these are the same in both languages. I downloaded Robert's template according to the instructions on his page, but it didn't work exactly like it was supposed to. After some debugging though, I figured out why. In the archive, there are seven or eight files in the DllExport folder that need to be copied over to the DllExport folder in your project. I suspect that the process of creating a new project using the template is supposed to do this for you, but for whatever reason it didn't (maybe because I'm using VS C# Express edition?). Also, in order to compile the dll for my class, I had to install Visual Studio C++ Express as well because there are some binaries that his system uses that aren't included with the C# version. I finally had a dll that compiled without any errors or warnings, so I opened up my UnrealScript project and started to add a DllBind to my save class. Apparently, you're not allowed to have anything else in the class other than the function declarations, so I cleared it out of the save class and made a new class with only the function declarations. This is where I hit another hurdle. The IDE I use for my scripts is Pixel Mine's Visual Studio based IDE nFringe, and even though I have the latest version, its parser didn't recognize the dllimport keyword so my script wouldn't compile. I was afraid that I would have to resort to compiling via command line, but I did some Googling and found out that they've included a way to add keywords to their parser by adding the keyword in a file called ScriptModifiers.xml in the Development/Src/Core folder. The xml file isn't there to begin with - you can download an example from their website, which includes a whole bunch of extra keywords, or just write your own following the proper schema - but once you have it, you just add your keyword to the appropriate section and restart Visual Studio. After adding the dllimport and dllbind keywords to the "function" category, my scripts compiled just fine and I was able to call my C# functions from UnrealScript! It was a lot of trouble to go through just to encode the save data and discourage cheating, but I think that there's a real possibility that I'll use DllBinds in the future, so it was totally worth it. |