May 28, 2013

Book review: "UnrealScript Game Programming Cookbook" by Dave Voyles

Few days ago I was kindly asked to give my opinion on the UnrealScript Game Programming Cookbook by Dave Voyles. I've read the entire book and can surely say – the recipes inside will be really helpful to anyone who started to work with the UDK and want to get the philosophy of the engine.

The main advantage of the book is that it contains strong practical recipes. Whatever game you develop, you'll meet the camera creation, weapons, AI, navigation and HUD tasks and connection between them in the most cases.

Technology like Unreal Engine 3 requires your knowledge about how it works inside, what are the paradigms and principles. Every recipe by David has detailed step-by-step description how it works and why the author chose the way he used. It's a concentrated info, and it's cool, because the examples in the book are more than just an examples – they also show the direction of development, the key ideas. Once you read it, you'll be able easily to extend them.

It's nice to see the basics of archetypes and prefabs use, also as some useful tricks like advanced aiming and debug advices. It makes the book solid.

All the receipts from the book contain not only an unreal script source code, but also downloadable maps and UDK packages. I found it really helpful, because you can try the examples, test them and use.

I was really surprised that Dave wrote about even four IDEs! It's very important to have a comfortable development environment, and the author shows examples of setup for the most popular variants. Some of them is very difficult to setup for the first time, so it's a pleasant surprise. Though, personally I'm using Sublime 2 IDE now, and it could be good to see its configuration for UE3 in the cookbook too.

The author mentioned Remote Control tool use. It's right thing, because many programmers don't know about it (unfortunately for their teams – so, if you're a game designer, and your programmer didn't give you info about this tool, make him read the book! :) ).

For my mind, it'll be cool to have the "Cookbook vol. 2" with recipes on vehicles and network in UDK too. Scaleform notes will be nice also.

I like the book and I'll advice it. Thanks Dave for that.

May 18, 2013

ScreenPos align for RenderTarget

Sometimes we need to project texture from object to screen space. Default ScreenPos node in UDK has option "screen aligned", and it seemed to work ok - texture is really aligned to screen.

But in some cases it doesn't work as we want. For example, when you're using SceneCaptureActor which duplicates position and location of main camera (I use this trick to draw transparent ocean). By default render target is square, let's say that your screen resolution is 1280 x 720, the result is:

It's ok only when the camera's pitch is zero. More pitch - more deformation.

The simplest way to fix it is to set resolution of render target with the same dimensions as screen resoliton has. It's rude, and can't be used for production if you expect user will change the resolution.

Solution is very simple. We should use only part of texture we need. I've prepared simple hlsl code to be used in Custom node:

It'll work only with square render targets! I think that key idea is clear, so if you have to use non-square RTs, you can modify it on your own.

It looks pretty good, and we don't scare screen resolution changes now.