Category Archives: Tutorials

[TIP] Renaming C++ Classes without breaking your project


Ever wondered how to rename your C++ classes that you already use in your project? For example, you have a C++ class called MyAwesomeClass and in your Content Browser you created a Blueprint extending from this class and added some important logic. Now if you rename the C++ parent class and compile, project might open but if you try to open that Blueprint you will see this error.

BlueprintErrorSimply put, your project is doomed………..Just kidding ūüėČ

So in order to make this work, you need to tell Unreal that there is a new class for this and it should use that instead of the old one. In other words, you need to redirect from Old Class to New One and you do this in DefaultEngine.ini found in Your project/Config folder.

Open DefaultEngine.ini and under [/Script/Engine.Engine] section add the below line:

+ActiveClassRedirects=(OldClassName=”MyAwesomeClass”,NewClassName=”MyNewClass”)

Thats it! Now you can start¬†your project and open that Blueprint without issues. Hope you find this info useful. ūüôā

Advertisements

Mini Tutorial on rendering occluded actors using Post-Process


This is a mini screenshot tutorial based on a project i did a few days ago.

First of all create a new material in Content Browser and set the material domain to Post-Process. Then follow below steps:

Line Render. (Re created from Google)

Scanlines (Ignore this if you dont want scanlines

And finally connect the last node to Emissive Color

To make it work, set “Render Custom Depth” flag to enabled and set the Bounds scale to higher (10) otherwise mesh sometimes will not render properly when behind.

Set Custom Depth and increase Bounds Scale

And here is a screenshot of my Material Parameter Collection.

Material Parameter Collection

[Tutorial] Disabling Log outputs in your game


Ever wondered how to remove those log outputs (ScriptWarning, Warning etc) from your game? Well i just found out a neat way to disable them.

Check this screenshot. Yeah it got a lot of warnings.

Log Warnings

Now i want to disable the Error (first one in that log), ScriptLog and Warning. To do so, open DefaultEngine.ini and under [Core.System] add the +Suppress=<LogName> option. For example see the below screenshot.

Modify INI to include +Supress

Now delete UDKEngine.ini and start the game. All the specified logs will now be disabled!

After disabling:

Logs disabled

[Tutorial] Change Loading Screens based on map (Using Canvas and no bik movie)


Hey everyone ,

In this tutorial i will show you how to have your own loading screen based on the map you are loading. For example you are loading MAP_1 so the loading screen will show random pictures of MAP_1. Remember, this tutorial will only use Canvas and will not use any bik movies. In fact, you will have to remove the loading bik movies from the ini in-order for this to work. I used this setup in my own game Engage and its working good. 

1: Start UDK and load your level.
2: Take a nice screenshot ( I use printscreen and paste it on Photoshop). TIP: Press F11 for fullscreen
3: Open Photoshop (i used 2048 x 1024) or any other image editing software and make all the customization’s you want (Color correction, blur, DOF, flares, anything)
4: Save the image and import it in UDK and save the package. Take any number of screenshots you want since we will be randomly choosing the textures.
5: Start your UnrealScript IDE and use the below code:

//  ================================================================================================
//   * File Name:    MyCustomViewportClient
//   * Created By:   Satheesh PV (aka RyanJon2040)
//   * Time Stamp:     05-Dec-13 8:50:00 PM
//   * UDK Path:   G:\UDK\UDK-2013-07
//   * Unreal X-Editor v3.1.5.0
//   * © Copyright 2012 - 2013. All Rights Reserved.
//  ================================================================================================

/*
    The reason why i extended from UTGameViewport is because otherwise Hintmessages wont be displayed.
*/

class MyCustomViewportClient extends UTGameViewportClient;

var Font TransitionFont;
var Font HintFont;
var Texture2D Background;
var LinearColor BackgroundColor;
var array MAP1_BackgroundTextures;
var array MAP2_BackgroundTextures;
var array MAP3_BackgroundTextures;

function DrawTransition(Canvas Canvas)
{
    local string MapName;
    local int Pos;

    switch(Outer.TransitionType)
    {
        case TT_Loading:
            MapName = Outer.TransitionDescription;

            /* Remove .udk from map */
            Pos = InStr(MapName,".");
            if (Pos != -1)
            {
                MapName = left(MapName, Pos);
            }

            /* Get Random Texture */
            Background = GetTextureForMap(MapName);
            DrawImageTransitionMessage(Canvas,MapName);
            break;
        case TT_Saving:
            DrawTransitionMessage(Canvas,SavingMessage);
            break;
        case TT_Connecting:
            DrawTransitionMessage(Canvas,ConnectingMessage);
            break;
        case TT_Precaching:
            DrawTransitionMessage(Canvas,PrecachingMessage);
            break;
        case TT_Paused:
            DrawTransitionMessage(Canvas,PausedMessage);
            break;
    }
}

//Absolutely no need for final modifier. I added it just for fun only. :P
final function DrawImageTransitionMessage(Canvas Canvas,string Message)
{
    local float XL, YL;
    local string DisplayMessage;
    local string HintMessage;
    local class GameClass;
    local string GameClassName;

    /* Capitalize the string */
    DisplayMessage = Caps("LOADING: " $Message$"...");

    /* Assign font to be used with LOADING:  */
    Canvas.Font = TransitionFont;
    Canvas.bCenter = false;

    /* Draw the texture on screen */
    Canvas.SetPos(0,0);
    Canvas.DrawTile(Background, Canvas.ClipX, Canvas.ClipY, 0, 0, Background.SizeX, Background.SizeY, BackgroundColor);

    /* Get the displamessage length and save it to XL and YL */
    Canvas.StrLen( DisplayMessage, XL, YL );

    /* [TEXT SHADOW] Set the position to slightly above bottom right corner of the screen */
    Canvas.SetPos((Canvas.ClipX - XL) - 10, (Canvas.ClipY - YL) - 10);

    /* [TEXT SHADOW] Set the color to black */
    Canvas.SetDrawColor(1,1,1);

    /* [TEXT SHADOW] Draw the shadow Text */
    Canvas.DrawText( DisplayMessage, false );

    /* [TEXT] Set the position to slightly above bottom right corner of the screen */
    Canvas.SetPos((Canvas.ClipX - XL) - 12, (Canvas.ClipY - YL) - 12);

    /* [TEXT] Randomize the colors */
    Canvas.SetDrawColor(Rand(255),Rand(255),Rand(255));

    /* [TEXT] Finally draw the LOADING:
 text */
    Canvas.DrawText( DisplayMessage, false );

    /* No need to draw hints for Main menu */
    if (Message != "MainMenu")
    {
        /* Find the game class: Eg: returns UTDeathmatch_0 */
        GameClass = class(FindObject(Outer.TransitionGameType, class'Class'));

        /* Cast teh game class name to string */
        GameClassName = string( GameClass.Name );

        /* Get random hint message from Game Class */
        HintMessage = LoadRandomLocalizedHintMessage( string( class'UTDeathmatch'.Name ), GameClassName);

        /* Hint message exists so... */
        if( Len( HintMessage ) > 0 )
        {
            /* Assign font to be used with HINTMESSAGE */
            Canvas.Font = HintFont;

            /* Get the HintMessage length and save it to XL and YL */
            Canvas.StrLen( HintMessage, XL, YL );

            /* We want the Hint message to be centered. So center the text */
            Canvas.SetPos((Canvas.ClipX - XL) / 2, Canvas.ClipY / 2);

            /* Again randomize the colors */
            Canvas.SetDrawColor(Rand(255),Rand(255),Rand(255));

            /* [TEXT] Finally draw the Hintmessage text */
            Canvas.DrawText( HintMessage, false );
        }
    }
}

final protected function Texture2D GetTextureForMap(string mapName)
{
    switch(mapName)
    {
        case "Map1":
            return MAP1_BackgroundTextures[Rand(MAP1_BackgroundTextures.length)];
        break;
        case "Map2":
            return MAP2_BackgroundTextures[Rand(MAP2_BackgroundTextures.length)];
        break;
        case "Map3":
            return MAP3_BackgroundTextures[Rand(MAP3_BackgroundTextures.length)];
        break;
        default:
            return //any default texture here;
        break;
    }
}

DefaultProperties
{
    HintFont=Font'YourPackage.YourHintFont'
    TransitionFont=Font'YourPackage.YourTransitionFont'
    BackgroundColor=(R=1.0,G=1.0,B=1.0,A=1.0)

    MAP1_BackgroundTextures[0]=Texture2D'YourPackage.YourGroup.YourMap1Texture'
    MAP1_BackgroundTextures[1]=Texture2D'YourPackage.YourGroup.YourMap1Texture'
    MAP1_BackgroundTextures[2]=Texture2D'YourPackage.YourGroup.YourMap1Texture'

    MAP2_BackgroundTextures[0]=Texture2D'YourPackage.YourGroup.YourMap2Texture'
    MAP2_BackgroundTextures[1]=Texture2D'YourPackage.YourGroup.YourMap2Texture'
    MAP2_BackgroundTextures[2]=Texture2D'YourPackage.YourGroup.YourMap2Texture'

    MAP3_BackgroundTextures[0]=Texture2D'YourPackage.YourGroup.YourMap3Texture'
    MAP3_BackgroundTextures[1]=Texture2D'YourPackage.YourGroup.YourMap3Texture'
    MAP3_BackgroundTextures[2]=Texture2D'YourPackage.YourGroup.YourMap3Texture'
}

6: Save it to UTGame folder
7: DONT COMPILE NOW!
8: Open DefaultEngine.ini and under section [Engine.Engine] change GameViewportClientClassName to GameViewportClientClassName=UTGame.MyCustomViewpor tClient.
9: Open DefaultEngineUDK.ini and under section [FullScreenMovie] remove all LoadingMovies entries.
10: Delete UDKEngine.ini
11: Do i really have to say that you need to re-compile the scripts and enjoy your loading screens. 

Exercise for you:

  1. Canvas supports a variety of Draw* functions. Use them to create advanced loading screens
  2. I havent checked if Canvas can draw materials. If they can then draw animated materials.(*hint* *hint* bik movies)

I hope you find this useful. ūüėÄ

[TIP] How to reverse your animation in 3dsmax


Hello Everyone,

In this quick tip video i’ll show you how to quickly reverse your animation in Autodesk 3dsmax. ¬†Even though am using biped in the video, this will work for all types of objects.

[TIP] Change Player Models based on Team for Multiplayer Team Deathmatch


In my game i implemented Team Deathmatch a few days ago but was struggling to update player mesh based on Team. But today i finally managed to do it and decided to share incase if anyone else is facing the same problem.

In your custom Team Deathmatch Game class add the below code:

function class<Pawn> GetDefaultPlayerClass(Controller C)
{
    if (C.PlayerReplicationInfo.Team.GetTeamNum() == 0)
    {
        return class'Team0PawnClass';
    }
    return class'Team1PawnClass';
}

Thats it! We just override the GetDefaultPlayerClass function to get the player model based on Team.

Hope you find this useful.

Attaching Actors WITHOUT UnrealScript or Kismet


This quick video shows you how to attach actors (meshes, lights etc) together right inside the editor without touching UnrealScript or Kismet.

%d bloggers like this: