October 29, 2013

HLSL noise effect for UDK

Sometimes we need to have the noise effect inside our shaders. Unfortunately it can be not a trivial task in some cases.

For my FFT-based ocean shader I used the solution that I've found on Stack Overflow (thanks, Michael!).

I'll dublicate it here to save the solution:

To understand how this works if we break the formula down into its constituent parts it becomes easier to visualize what is going on:

Paste the above into: https://www.shadertoy.com/new

It can be simply used for materials in UDK. You just need to create a custom HLSL node:

Noise effect as simple post-effect

It's a fast example how this trick can be used. But it will be better to use it in the material of particular mesh rather than post effect! Use UVs as p param and it'll be cool.

Captured screens with different noise scale:


October 26, 2013

Marine adventures on abandoned space base

Just few screenshots of our new deathmatch map for Doominator. All pics are "as is" screens from my iPad 4.

Being in a WIP state, map is deserted and empty, so marine walks around unarmed :) No monsters here. For a while.

By the way, most of textures are created by GameTextures team (thanks, guys!).

October 7, 2013

Doomstalker UI source released

Keywords: sci-fi, cool, interface, HUD, source, PSD, free, download :)

We've decided to release the source of the UI we've used in Doomstalker some time ago (summer 2012). The game concept was changed a lot, so we don't use this screens anymore. But now you can use it as you want!

You can get it here: download

There are no restrictions. It's free for both commercial and uncommercial use. You can modify any screens as you want.

Screens layout by me, graphic design by admirable Irina Narykova.

September 29, 2013

Parse deploy UnicodeDecodeError fix

I've met an amusing bug just right now. My projects are based on Parse Cloud service, and today I've tried to deploy my code from my main Win7 machine. I'm russian guy and my OS has russian localization. So..

Previously I've never met this error, because Python is not my favorite language (and I worked with it on English OSX before). I've instantly googled and found that I should change the code to fix it. Unfortunately I couldn't make it this way - Parse CLT is a binary only.

Then the magic happened.

Fix is very simple - you should delete all non-latin Mime types from your system (f.e. I have few them in Russian). The location is:

And Then John Was A Zombie it works ok now.

September 28, 2013

UDK logging tips (1)

Game logging is a very important thing. So, I want to share some things I'm using to make it comfortable and informative.

1. `Location macros

Use 'Location macros to get actor instance name and class/function location of log event. F.e.:

2. Custom log macroses

In Globals.uci file of your game package (it should be placed in .\Development\Src\MyGame\ folder, not inside Classes folder!) you can add macros like that:

Now you'll be able to use `LogAI(...) when you want to log some AI events (for example). Of course you can customize message as you want.

The great point of using this macros is that you can suppress its output into console by adding simple config in DefaultEngine.ini file:

Once you've decided that you needn't this type config in console all the time anymore (f.e. you've finished hard debug work on AI), you can suppress it, and vice versa.

3. Remember Object's debug functions

ScriptTrace()GetFuncName()DebugBreak(..) are your best friends!

UDK build system for Sublime 2

I'm using Sublime 2 to work on my projects. It's very cool editor which saves my eyes and time a lot.

It can be easily used for building Unreal Engine 3 projects (and UDK projects too).

You have two basic variants:
  1. Use great UnrealScript IDE Plug-in for Sublime Text 2
  2. Create your own simple build system
I strongly recommend new Sublime users to choose the first variant. It has nice syntax highlight for unreal code and good editor integration.

Personally I prefer the second variant, because I like C++ syntax highlighter colors to be used with my code, and I really dislike that Zinggi's plugin changes some key binds and sequences I'm using.

So, if you want to use just a build system for your UDK game, you should:

1. Go to Tools -> Build system -> New build system
2. Add following config:

3. Save it to the ".\AppData\Roaming\Sublime Text 2\Packages\User" folder (should be opened by Sublime by default).
4. Select new build system in Tools -> Build system menu.

Now you'll be able to use Ctrl+B and etc key binds for script building.

Please note that I'm using "shell" : true config to launch UDK as separate process in new window. Unfortunately I can't receive UDK's output into Sublime's console after its update.

September 22, 2013

Publishing UDK game with iCloud in AppStore

If you'll try to upload you UDK-based game with enabled iCloud for review into iTunes you'll met few errors, and official Epic's documentation will tell you nothing.

You just need to add entitlements config to your build. It's very simple, see below.
  1. Download UDKGame.entitlements
  2. Save it to the \UDKGame\Build\IPhone\ folder
  3. Fill it with your own values:
    1. UNIQUESEED is the app seed of your application on Provisioning portal (10 letters)
    2. com.MYCOMPANY.MYGAME is your app's BundleIndentifier. It should be the same you're using in Info.plist and on provisioning portal ("com" can be changed to your own domain, f.e. i'm using "ru")
  4. Rebuild the .ipa
Pay attention to com.apple.developer.ubiquity-container-identifiers block. Its value contains "save" postfix!

If template link is broken you can use this:

Doomstalker reborn

In time, but Doomstalker is alive. First public release to get initial feedback from players even is in AppStore now.

It will be multiplayer game in style of Quake 3 and Unreal Tournament (but presudo-isometric). I've made a lot of work on game balance now, and next update will be very pleasant and interesting to play. Single-player mode included.

Game style was changed and improved too. You can compare it with old screens.

Also, it's the ticket for SeaCraft to be ported to iOS. Rock'n'roll!

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.

April 27, 2013

UDK Ocean WIP (2) + shader source

Few days ago I've created ocean shader for UDK based on nVidia Island11 demo. You can find it here:

Not a ready solution - it shouldn't be used for production, but it's a good point to start. I think it's a good idea to share my work with you :)

Download UDK Ocean shader (packages saved with February 2013 UDK).

Brief description
  • Designed for DirectX11 tesselation (flat version for DX9);
  • Opacity with dynamic shadows on ocean surface (can be used with dynamic lighting and has bug-free DOF);
  • Subsurface scattering (SSS) simulation;
  • All the data is generated from one 256x256x32b normal map.

Should be added/fixed for production (shader):
  • Height displacement and normal disturbance fading near the shore;
  • Render targets square resolution support (independent from screen resolution);
  • Z-displacement for reflections is wrong when camera is close to surface;
  • Wind vector/speed dependence (if you need);
  • Skyline tiling issues fix (ripple);
  • Performance optimization, quality switches, etc.

Other improvements to do:
  • Ocean mesh/LOD system;
  • SceneCapture actors and player's FOV should be dynamically related;
  • Disable capture actors when refraction feature isn't used;

It's just a common directions of development, there are a lot ot them more. First of all you should understand what you want to get from ocean. F.e. today I'm using simplified shader to get optimal performance and organic view exactly for my game.


You'll find three files in archive above:
  1. SC_PlayerController.uc - contains Unreal Script code for fake opacity control. You should integrate it into your PC class (you can use my class for tests also);
  2. SC_OceanTest.upk - shader resources, materials, etc.;
  3. SC_Island11.udk - test mapl
There are four key actors on map:

1. Ocean surface mesh. You must set two options for it:
  • Object tag is "MyBelovedOcean";
  • "Only owner can see" is on;
2-3. Render targets for scene depth ("DepthTrickster" tag) and scene color ("ColorTrickster" tag) capturing. FOV must be the same as used for player.

4. Reflection capture actor. Simple one, but important. No special tags required.

Main idea of "opaque material with opacity" is to use scene capture actors to get scene depth and color behind surface from scene "without ocean". 

We've made ocean mesh visible only for owner, and capture actors don't see it. Position and rotation of these actors are synced with player controller's position and rotation, FOV is the same, so we can easily make projection of render targets to screen space. Profit :)

Of course, this trick has its limitations and bottlenecks, but it's useful for my game, and I'm happy about it. If you needn't dynamic lighting for your water surface you can always modify material to be truly traslucent.

to FFT or not to FFT?

I know that one of the frequent requests is "how to make FFT Ocean", f.e. like this one. It's really possible to do it with UDK (you should use ScriptedTextures), but:
  1. it'll work only with DirectX11 - tesselation displacement is only one solution for heightmap from texture, even generated on the flow;
  2. FFT passes work relatively slow, 'cause you have to use script buffers, not a solid shader;
  3. You can try to make it faster using sets of pre-calculated FFT data (like in Assasin Creed 3), but you have to use float textures. Their support (.float) in UDK is something from Hell.
I want to say that FFT algorythm is not useful for in-game ocean with UDK. It's better to use Gerstner-based solutions. But for portfolio demos it would be a great thing. It looks pretty cool.


There are a lot of different approaches for ocean simulation in games. This shader is just only one of them. Hope you'll find it useful, and you're free to use it as you want.