Category Archives: Game

Unreal Engine 4 memo: How to create god ray / light shaft effect for trees using the volumetric fog?

To create the god ray / light shaft effect through trees, we should use the volumetric fog feature recently added to Unreal Engine. Google search will give us the following 3 references:

The thing is even after perusing the first 2 references you may still have a hard time implementing the desired effect. Here is a summary of the right steps that you need to follow to avoid hours of trial-and-errors:

  • Add the tree, directional light, exponential height fog to the map.
  • For the exponential height fog, check the option volumetric fog; to make the god rays more obvious, increase fog density; optionally, increase fog height falloff so that the fog is concentrated at lower altitude.
  • For the directional light, to make the god rays more obvious, increase the intensity, for example to 20 lux; to create light shafts between leaves, check light shaft bloom.
  • Critical: Ensure that the mobility property of both the tree and directional light is set to movable. Without this step, the tree would have wrong, static shadow, and the directional light would not be able to create the god rays in the fog.

The above steps end up applying volumetric fog effect on a global scale. Optionally we may follow the great presentation (starting at 14:24) to implement the local volumetric fog effect via the particle system.

Unreal Engine 4 memo: How to perform rotator interpolation correctly?

In order to let an actor transition from one rotator to another smoothly, function FMath::RInterpConstantTo() should be used. The official documentation on this function is too brief to be helpful. This article aims to clear up the confusion.

Add member function and variable declaration

First off, in the actor class declaration, add the following functions and variables. PerformRotationInterpWithDelay(Delay) is the public interface to be called outside the class. Its purpose is to halt for a duration of Delay, then let the actor rotate smoothly until the target rotator is reached, which in our example is simply FRotator::ZeroRotator.

UCLASS()
class QL_API AMyActor : public AActor
{
    GENERATED_BODY()

public:

    ...

    //------------------------------------------------------------
    // After Delay seconds, perform PerformRotationInterpCallback()
    // which sets bStartRotationInterp to true, and performs rotation interpolation
    // in Tick() until the rotation becomes FRotator::ZeroRotator
    //------------------------------------------------------------
    UFUNCTION(BlueprintCallable, Category = "C++Function")
    void PerformRotationInterpWithDelay(const float Delay);

protected:

    ...

    //------------------------------------------------------------
    //------------------------------------------------------------
    UFUNCTION()
    void PerformRotationInterpCallback();

    //------------------------------------------------------------
    //------------------------------------------------------------
    bool bStartRotationInterp;
}

Define the functions

Implementation detail of PerformRotationInterpWithDelay(Delay) is shown below. After Delay, function PerformRotationInterpCallback() is called, which simply sets the flag bStartRotationInterp, making the actor rotate in the next Tick() call.

For the static function FMath::RInterpConstantTo(), the first argument is the current actor rotator GetActorRotation(), not the initial actor rotator. The second argument is the target actor rotator, which is set to FRotator::ZeroRotator in this example. The third argument is the duration in second between two frames DeltaTime. The last argument is the interpolation speed not adequately explained in the documentation. Here is what it actually represents: For each call of FMath::RInterpConstantTo(), the pitch, yaw, roll of the actor are uniformly incremented by a value of k. k is first set to the difference between target rotator and current rotator, but then clamped by [-m, m], where m is equal to DeltaTime times the interpolation speed. An interpolation speed of S indicates a change in pitch, yaw, roll by S degree per second. FMath::RInterpConstantTo() returns the new rotator to be applied to the actor per Tick(). To take into account the finite precision of floating point arithmetic, currentRotation.Equals(targetRotation) is subsequently performed. If it evaluates to true, the flag bStartRotationInterp is unset, and the rotation stops.

//------------------------------------------------------------
//------------------------------------------------------------
void AMyActor::PerformRotationInterpWithDelay(const float Delay)
{
    GetWorldTimerManager().SetTimer(StartRotationDelayTimerHandle,
    this,
    &AMyActor::PerformRotationInterpCallback,
    1.0f, // time interval in second
    false, // loop
    Delay); // delay in second
}

//------------------------------------------------------------
//------------------------------------------------------------
void AMyActor::PerformRotationInterpCallback()
{
    bStartRotationInterp = true;
}

//------------------------------------------------------------
//------------------------------------------------------------
void AMyActor::Tick(float DeltaTime)
{
    Super::Tick(DeltaTime);

    ...

    // interp rotation
    if (bStartRotationInterp)
    {
        FRotator NewRotation = FMath::RInterpConstantTo(GetActorRotation(), FRotator::ZeroRotator, DeltaTime, 100.0f);
        SetActorRotation(NewRotation);

        if (GetActorRotation().Equals(FRotator::ZeroRotator))
        {
            bStartRotationInterp = false;
        }
    }
}

Lo Wang’s fortune cookie quotes

    • You are not illiterate.
    • Confucius say it is easy to hate and difficult to love. Frankie say relax.
    • Thank you Lo Wang! But your fortune is in another cookie!
    • What’s a seven-letter word for ‘cryptic’?
    • Live each day like it’s your last. Or at least today, because… Oh I don’t want to spoil it.
    • Light travels faster than sound. That’s why some people look brilliant, until you hear them speak.
    • Whoever coined the phrase ‘quiet as a mouse’ never stepped on one.
    • Help! I am being held prisoner in a video game factory.
    • Don’t sweat the petty things and don’t pet the sweaty things. – George Carlin
    • You’re never too old to learn something stupid.
    • All men eat, but Fu Man Chu.
    • Some mistakes are too fun to make only once.
    • With sufficient thrust, pigs fly just fine.
    • He who takes advice from a cookie is sure to crumble.
    • You will stop procrastinating. Later.
    • Cardboard belt is a waist of paper.
    • The difference between an oral thermometer and a rectal thermometer is all a matter of taste.
    • You don’t need a parachute to skydive. You need a parachute to skydive twice.
    • Laugh and the world laughs with you. Cry and the world laughs at you.
    • That’s what ki said.
    • The good news: you’re not paranoid. The bad news: everyone is actually trying to kill you.
    • The early bird gets the worm. The second mouse gets cheese.
    • Small cookies bring great joy.
    • Time is an illusion. Lunchtime doubly so.
    • To be is to do. – Socrates
      To do is to be. – Sarte
      Do be do be do. – Sinatra
    • It is better to have loved and lost than to have had loved and gotten syphilis.
    • Cookie monster wasn’t here.
    • Chew, or chew not. There is no pie.
    • To maintain perfect accuracy, shoot first and call whatever you hit the target.
    • Information is not knowledge. Knowledge is not wisdom. Wisdom is not truth. Truth is not beauty. Beauty is not love. Love is not music. Music is the best. – FZ
    • Man who stand on toilet, high on pot.
    • It is better to have loved and lost than to have loved and got syphilis.

 

Reference: Shadow Warrior (2013)

The legend continues

qwc_top_banner

Day 1 is pretty disappointing. rapha lost to cooller without landing a single round; Team Liquid was stomped by 2z; Quakecon venue lost internet connection.

Day 2 is full of amazing matches. rapha managed to win two matches in group stage, and then survived Raisy scare. However, in the quarter final, he lost to his self-effacing teammate dahang. I root for rapha, and hope he will come back stronger next year. cooller continued his invincible state, until surprisingly thwarted by the young talent clawz in the semi final.

Final day, clawz is remembered forever in quake history  as the first player to win the championship of both duel and sacrifice. Everybody was awed, mouth agape. Also being remembered is clawz’s extreme bad manner towards Vo0 and the way he talked in his interview. Guess the kid has a lot to learn.

Prey 2017

A pretty decent first person shooter of 2017. The combat is very challenging and requires appropriate strategies. Some of my tips:

  • In case of a sudden enemy encounter, press mouse wheel to go to the favorite wheel menu that pauses the game and gives you time to select the most suitable weapon or ability.
  • To fight mimic and regular phantom: use gloo gun to freeze them, use psychoscope to scan them, hit with pistol or kinetic blast.
  • In psychotronics there is a morgue with a locked door. An easy way to enter the room is: break the window, mimic a small object, and roll in.
  • After completing the side quest Psychic Water, drinking water from the fountains in office rooms increases a large amount of psi and a small amount of hp. Don’t forget to take advantage of this bonus.
  • The first half of the game is especially hard. Use a combination of silenced pistol, gloo gun, combat focus and kinetic blast.
  • The second half of the game is much easier. (Ab)use mindjack,  machine mind in tandem with psychoshock.
  • In a side request you can choose whether to kill Dahl or incapacitate him (removing his last neuromod). Use the stun gun to do the latter.
  • Enemies are regenerated each time the player reenters a map that has been cleared before. Do not try to eliminate all enemies as it will deplete the ammunition or psi points very quickly. This is especially true for the second half of the game. Instead, mind control them temporarily and run away.

I would rate this game 7/10.

  • Pro:
    • Careful thinking and combat strategies are required, which makes this game stand out.
    • Plenty of good ideas implemented by the development teams that allow the players to play in their own way. For instance, mimic matter ability and gloo gun.
    • A nod to Bioshock/system shock. They use my favorite font, Century Gothic, the same with Bioshock.
  • Con:
    • Graphics glitches such as flicking shadow, low quality texture in mid distance. In certain areas such as in the reactor room, the fps may drop abruptly to 20 or lower. The graphics is not very impressive even under the “very high” setting.
    • Hacking (particularly level 2) is a painful experience for PC gamers that use a regular keyboard. The control is simply bad.
    • The NPCs are not very well made. They lack facial expression. They are not good looking. The texture and shading is rather coarse.
    • Similar to Bioshock Infinite, when the player is sprinting, the mouse sensitivity is reduced by design, which I hate very much.
    • The ending is rather anticlimactic. I don’t find it satisfying. This is also similar to Bioshock Infinite, which I personally think is an overrated game.

 

Witcher 3 tips

  • My favorite alchemy abilities
    • acquired tolerance
    • heightened tolerance
    • poisoned blades
  • My favorite decoction
    • ekhidna: actions consuming stamina increases vitality.
    • ancient leshen: sign cast increases stamina regeneration.
    • foglet: increase sign intensity in cloudy weather.
    • ekimmara: damages to foes increases vitality.
  • My favorite potion
    • tawny:  increase stamina regeneration speed. superior version never expires at night!
    • thunderbold: increase attack power.
    • golen oriole: immune to poison.
  • My favorite bomb:
    • devil’s puffball: releases poisonous gas. When used together with golen oriole, fight against a group of human enemies will become a piece of cake.
  • Other important tips
    • Burning and poison effect damages enemies by an amount proportional to their health.
    • Some monsters, such as werewolf, can regenerate vitality with great amount and fast pace. A green number rising above them indicates the recovered health. If further attack is found in vain, the player should not take this quest on the current level even if it is close to the suggested one. Simply level up and make the slash more deadly.

Tomb Raider

Rise of the Tomb Raider (2015)
The game has shown significant improvements over its 2013 predecessor. I am very much looking forward to the sequel.
rating: 8/10
pro

  • The graphics including in-game and cutscene is perfect by 2016 standards, although it is GPU demanding as expected (On a Titan GPU at high setting, the game is at 60 fps most of the time, but a complex, large scene with massive grass or snowflakes can quickly drop it to 30~40).
  • Good map design, offers quite a number of tombs to raid (although still pretty simple to solve) and vast areas to explore.
  • New game element: Lara can receive mission request from NPCs, although all missions are simple to accomplish.

con

  • AI is simplistic.
  • The last chapter is too short. The final boss (the helicopter) is too easy to defeat.
  • The main storyline is still somewhat short.
  • The NPC dialogue system is pretty simplistic.

Tomb Raider (2013)
rating: 7/10
pro

  • The graphics is really amazing.
  • Lara is well portrayed, with a strong, real personality and an attractive appearance that stresses less on sexuality.

con

  • The game is too easy to break.
  • There are too few tombs with overly simple puzzles.
  • The story is too short.
  • Lara makes unpleasant, loud grunt when putting out the torch

Tomb Raider: Legend (2006)
rating: 5/10
pro

  • good graphics of the time
  • new (but simple) elements such as motor drive
  • the Japan level is exceptionally well designed

con

  • annoyingly buggy game control
  • occasional, horrible level design. I would have ranked the game 7/10 without those levels.
    • waterfall consecutive jump at Ghana
    • motor chase at Kazakhstan (worst of all)
    • final boss fight at Kazakhstan (the boss is unbeatable; Lara has to take to flight — seriously?)
    • final boss fight at Bolivia