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;
        }
    }
}

Far cry 5 is bad

This is what a triple A game looks like in 2018? What the fudge?

Story: The writer creates an intriguing start but fails to keep the story convincing and coherent. Many things are illogical or left unexplained. How did Faith and Jacob obtain their mind control ability? How did Joseph foresee the future? If everyone and everything you fight for is shortly to be shattered in pieces, what is the point of fighting and playing this game at all? The game has overdosed on mysticism and nihilism.

Game mechanics: The main quest is concocted from rudely intervening cutscenes and mediocre boss fights. The skirmish against Peggies in side quests is fun to play but feels very repetitive later on due to lack of variation. One of the few memorable fights is where you are tasked with preventing a group of Peggies from defusing the bombs you have planted at their factory; one of the few memorable stash quests is where you have to do a sequence of well timed grapples and jumps in order to loot a stash placed underneath a bridge. Perhaps the best thing is that you can partner with a dog (Boomer), a lion (Peaches) and a bear (Cheeseburger). But that’s all the pros of this game.

Character: Sadly, there’s no memorable character, except for the Marshal who is a joke.

Graphics: Beautifully crafted and highly performance-optimized environment.

Overall, I would rate this game 5/10, and I will not buy a game at full price from Ubisoft next time. Not GG.

 

 

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.

 

Bioshock Infinite is a bad game

Bioshock Infinite is an extremely overrated game. It is actually the worst FPS shooter I have ever played. It is a disgrace to its two legendary predecessors Bioshock 1 and 2, which are my absolute favorites.

Bioshock Infinite features a nonsensical, meaningless, parallel universe plot, and offers no moral of story. It makes the players feel very bad as everyone just dies in the end.

This PC game is a wretched port of the console version. FOV and mouse sensitivity is an utter disaster; the combat system is purely horrendous; UI is a textbook anti-pattern. The only good part of the game is graphics, which in large part is offered by the third party Unreal Engine.

Bioshock Infinite has 2 DLCs, both are arrant failures. The first DLC has a pointless and confusing story arc. The second DLC turns out to be an extremely boring stealth game, where players can do nothing but just sneak all the way out.

In short, Bioshock Infinite is a very very bad game. It is not what Ken Levine should be proud of.