Praglik's DevBlog

Developer Blog of Alexis "Praglik" Argyriou

November Update

Sorry about the delay since my last update, I kinda got caught in Assassin’s Creed Unity. Despite the terrible coverage it got from the mainstream press, everyone who played it (me included) had a pretty good time on it. The environment art is insanely detailed, the world is living like no other game before and the co-op missions are a real plus.

 

In the meantime I updated my home station with a brand new GTX970, boosting my FPS to the ceiling. My CPU is a bit older, a decent 3570k, but still not even used at 5%. The overall result makes my server and 2 game clients renders under 17ms with dynamic daylight, DFAO, shooting, explosions, and dynamic lights attached to the character… I’m very surprised how smooths it runs.

During the night time, the GPU is relieved a lot and I get under 10ms. This works as intended, as I plan to use a lot more dynamic point & spot lights during night time, until the framerate gets even between day and night.

I had a lot of advance on my roadmap for November, so this week I’ll probably update to 4.6 Preview and implement properly recoil and ammo spread to my Line Trace Shooting Mechanics. I’ll sketch some Heat/Cold and Thirst/Hunger mechanics due to popular demand on Twitter and I will connect that with my Consumable Items System to regenerate those gauges… and I’m done for November!

Line Trace Shooting Mechanics – Part 2: Line Trace and Localized Damages

Read the first part of this tutorial here.

 

Second Part – Shooting Mechanic Function


Depending whether you have a 3rd Person Shooter like my project or if you’re handling everything in First Person, your method to do the Line Trace in Blueprints will be slightly different. In my case as a TPS I have to cast the Line from my character’s weapon towards an infinite point from my camera.

Shooting Mechanics Tutorial Part 2 - Line Trace and Damages

 

Once the Blueprint got a confirmation that the Line Trace was successful and hit something, we can spawn a small FX and it will provide valuable debug infos on the hit location. And everyone loves explosions.

Then what I’m doing is to check if the hit landed on a character or just somewhere in the environment. It can be done with a Multi-Trace but I chose to do it with a branch and a class-check. Simple but effective. If you have different blueprints for other “creatures” though, like Zombies or Dinosaurs, a Multi-Trace might be needed to handle the hit differently.

Once it hits the node “Damage Localization”, we pass in the third part of our blueprint.

 

 

Third Part – Localized Damages


 

Beforehand, I stored my characters’ bones names inside 3 arrays corresponding to Double Damage (Head, Neck…), Half Damage (Hands, Feets…) or Normal Damage (Chest, Back…) and I check where the hit bone belong. The trick is, I don’t want to store all the bones of my character in my arrays, it would be too time-consuming to add every single joints manually. So I just added the main ones. If the bone hit isn’t found anywhere in those 3 arrays I recursively check their parents until a major bone is found and will use this one as a damage handler. I added a failsafe at the bottom of this blueprint that will only check recursively 4 times and give up, just in case something went wrong. The worst case scenario is if I hit the tip of my character’s fingers. It will have to check their parents thrice before getting a registered bone.

 

Shooting Mechanics Tutorial Part 2 - Damage Localization.

Bone Hit = Right Hand’s Middle Finger. Exist in Double Damage Array ? No. Half Damage ? No… Normal Damage ? No.

So Get the parented bone: Right Hand. Does it exist in Double Damage Array? etc etc.

Shooting Mechanics Tutorial Part 2 - Bones Array
The 3 arrays containing the 14 major bones.

 

Shooting Mechanics Tutorial Part 2 - Localized Damages
My characters bones. As you see most of them aren’t in my arrays, but their immediate parents are. You can see some sockets that I use for my equipment system. *teasing*

 

 

That’s it for my Shooting Mechanics. Feel free to leave a comment if you have any related question, I’ll be glad to answer all of them!

Line Trace Shooting Mechanics – Part 1: Input, Ammos and Autofire

For our shooting mechanics I used a “simple” Line Trace that got complicated… quite fast. What I needed:

 

  • All weapons uses Ammos
  • Some weapons have Auto-Fire
  • Different Magazine Sizes
  • Localized Damages
  • Different results between a Pawn and random environment

 

Quite a lot to detail as you can imagine. I divided this post in two parts: First Part will talk about Handling Inputs, Ammos and Auto-Fire. The second part will talk about Line Trace and Localized Damages.

 

First Part – Handling Input and Entering the Auto-Fire Loop


Once we got the Shooting Input Event, we need to figure out several conditions before actually entering the Auto-Fire Loop. Things like HasWeaponEquiped and HasAutoFire needs to be sorted out first.

 

Shooting Mechanics Tutorial Part 1

Then, we can enter the proper AutoFire Loop, which looks like this:

Shooting Mechanics Tutorial - AutoFire Loop

 

We extract the Rate of Fire from our weapon, and this will input the delay between each shot. Delays are not the best option performance-wise, but in blueprint it still make things quite easier.

 

 

The next thing to do is to calculate if the player still has enough ammos in his weapon, else he won’t be able to shoot. If all my requirements are met, we can finally start the shooting process. Removing a bullet from the magazine, updating our HUD, and triggering the massive Shooting Mechanics Function…

Read the second part of this tutorial here.

Texture Atlas Material Function in UE4

I tried to find a good tutorial or a nice example of a Texture Atlas in UE4, but everything was half-working, extremely complicated or for an old version of the engine.

So I decided to make my own, based on the one from mAlkAv!An on Unreal Forums. It doesn’t differ much, but allows to be versatile and reused throughout your project.

 

Texture Atlas in UE4

 

With this simple version, you might have some artifacts around the edges if your textures in your Texture Atlas doesn’t share the same pixels on the edges. In my GUI Texture Atlas, all the textures have white borders so it’s not a problem.

This issue is because of MipMaps, the thing that diminish automatically your textures quality in the distance

So if you have artifacts, you might want to recompute those MipMaps on the fly like this:

 

Texture Atlas in UE4 with fixed MipMaps and no artifact.

 

However I won’t advise to build this MipMap recomputation inside a MaterialFunction. If you absolutely need it, use it on a per-material basis if the artifacts are too terrible.

I created a Texture Atlas Material Function for you to download, simplifying the whole process. It looks like this:

 

Texture Atlas Material Function to download for UE4

Download the Material Function here.

Once downloaded, open the .zip and copy-paste its content somewhere in your Content Folder. It should appear in your Material Function Library.

Efficiently Storing Weapons in UE4

Before thinking of any inventory system, I searched a bit on how to store my weapons in UE4.

There was actually at least three possibilities:

  • Classes: The more obvious, but it was impossible to get variables out of it without actually spawning them into an actual object.
  • Actors Objects: The easiest, but making them impossible to fill in an array beforehand, has to be done at runtime, so useless for an Item Spawner.
  • Structs: The most complicated with all the breaking/making stuff, but worked fine… Except that it doesn’t accept Meshes or Textures yet.

My other problem, is that I didn’t wanted to have all those weapons floating in my Content Folders as independent blueprints, I wanted all of them inside arrays for an easier overview.

I actually ended up proceeding this way, as it was required for other things. But in my early prototype everything was stored inside a single Struct containing more Structs. Structception.

 

Overview of my main Struct WeaponLibrary containing several Weapon Structs.
Overview of my main Struct WeaponLibrary containing several Weapon Structs.

 

Breaking the WeaponLibrary Struct inside a blueprint.
This is how it looks like when you break your WeaponLibrary. You get all your weapons as independent Structs, ready to use in your code.

 

Using an Enum to choose which weapon to use.
You can now switch on an Enum containing all your weapons, and set it to be your Equiped Weapons.

 

When you break your EquipedWeapon, you get the same Weapon Parameter Struct as in your library.
When you break your EquipedWeapon, you get the same Weapon Parameter Struct as in your library.

 

This is a very user-friendly method, far more intelligible than the traditional Object/Class blueprints as it involve no CastTo, but way less versatile. Quite nice for a very fast prototyping!

Perception System in Blueprints

Before talking about the inventory system I need to explain how to actually get items. I believe there are thousand of possibilities, but I went with the most versatile one as I don’t know how many items there will be or what they will actually be able to do in the future.

But I needed a way to interact with the world surrounding the players, activate objects or take items. And for many reasons I decided to create most of the code and mechanics directly inside the character blueprint.

 

What bothered me in the first place was to check for an event every frame, but in my opinion this is way too expensive. So, as with the Day/Night system I actually decided to check every X seconds.

The main idea is to cast a sphere from the camera every 0.5 seconds and get the hit back, see if it actually touched an interesting item and then proceed with all the mechanics.

Here is the commented blueprint, click to enlarge:

Perception Blueprint
Perception Blueprint

 

Real-time Day/Night System in UE4

I told you about my updated Day-Night cycle in UE4 in a previous post, so I’m going to expand a bit on this subject.

First, it’s very dependent on Epic’s Ray-Traced Distance Field Soft Shadows system and therefore, quite slow on low-end graphic cards.
I optimized my system with scalability in mind, trying to do less real-time updates depending on a global setting chosen on a per-player basis.

One in-game day is equivalent to 1200 real seconds, or 20 minutes. Basically, a night of 10 minutes and a day of 10 minutes.

 

Details Panel of relevant components used in  the Time of Day setup
Details Panel of relevant components used in the Time of Day setup

I use two Directional Lights, but the trick is, only one is active.

The first one is the active one, I didn’t changed much from the default settings, except that is has the Cascaded Shadow Maps disabled and UseRayTracedDistanceShadowMap activated.

The second one is completely disabled and I’m only using its position to update the BP_SkySphere

Then a Skylight is used, the HDR doesn’t matter much as I’m using it only to cast shadows and color our Global Illumination.

And of course the UE4s default BP_SkySphere connected to my disabled directional light.

 

 

 

Level Blueprint for the Time of Day setup. Responsible for most of the effect.
Level Blueprint for the Time of Day setup. Responsible for most of the effect.

The whole system is defined and updated from the Level Blueprint, and OnBeginPlay will trigger two sets of events:

– A Timer-delayed mechanism, updating only every X seconds defined in a global “Quality Settings” struct. In High Quality settings it’s every 0.8 seconds, or every in-game minute.

– A Timeline that update every frame.

I added a debug input on the T key to set the time of day just before 5:00 am.

 

 

 

 

 

The Timeline used in the Day/Night System.
The Timeline used in the Day/Night System.

The timeline is responsible for updating the Sun location in the sky, it’s color and brightness, and trigger two events that will disable the shadow casting during the night to save in performances.

I also get the in-game time from this timeline, to display it in-game and debug my system more easily.

The Main Directional Light (the active one) rotation’s goes from -180° to 0°, an arc of 180° from midnight to midnight.

My second Directional Light (the inactive one) rotation’s goes from -270 to +90°, a full 360° rotation around earth and it’s this one that will update my sky.

 

 

 

So, why two Directional Lights and why two sets of events?

Well, I can’t update the Sky Color and BP_SkySphere every frame, it’s just too costly and destroyed my performances. And updating the Sun’s shadow every X seconds made every shadows in-game jumping around, no matter how fast I updated it. Dividing the events this way made the best compromise in terms of quality/resources!

I tried as well to remove the CubeMap from the sky and use a Recapture Scene every X seconds, but there was a noticeable hitch every time it updated it. In the end I have real-time direct shadowing and almost-realtime global illumination that does the trick!

If you have any comment or any idea to improve the system, let me know in comments just here or send me an email, I’ll update this article accordingly!

24 hours in 18 frames :

Day Night System Animation Gif

Interstellar Short Review

Interstellar

Just coming back from the theaters. Interstellar is easily my favourite movie of the year. Nolan blew up the whole cinematographic industry, this is a masterpiece of a movie that will be talked about for a generation and set up a new milestone in sci-fi. The movie made me laugh, got me scared, happy and sad, I didn’t cried (witnesses report seeing me crying 3 times but don’t listen to them). The movie was deeply philosophical yet understandable; quite accurate scientifically, yet dreamy and romantic.

 

No spoilers here, just talking about the feeling outcome and inspiration burst I got from it.

The narration was amazingly well done, Nolan got the rhythm perfectly orchestrated, you don’t get bored a single moment… And if you think you are bored, it’s because the director wants you to breath again, relieve some pressure he put onto you with the previous scene.

I didn’t followed any hype, didn’t saw any trailer before going to the cinema and it really helped. I wasn’t expecting anything (like I was with Inception and it’s hype-train) and it caught me off-guard.

Graphically is does the job, it’s not as scenic or epic as Prometheus for example, but actually it really helps to set down the scale. It feels less Space Opera and it brings the film to a human scale, helping a lot to identify to the characters, as you don’t see them as invincible heroes and after some minutes you truly care about them. By the way, the actors performance is so accurate that you don’t think about them as “actors” at all.

It had a lot of references to 2001 a Space Odyssey, especially sound-wise. Hans Zimmer really nailed it. It’s quite a lesson of humility actually, he don’t shoot the brass instruments every 5 minutes like he used to, here he stays quite silent and build the atmosphere rather than tension.

 

Anyway, I’m probably terrible at movie reviews – I guess I should stick to games! – but I got very enthusiastic about this movie. Hope you enjoyed it and feel free to tell me about your own impressions!

A Survival Game in UE4 – Part 1

I’m currently working on a personal project on UE4, a quite big project of a Survival Game that helps me to improve my skills with UE4 mechanics. I never had to deal with problems like GUI, fully dynamic lights, networking, procedural generation or inventory systems so it’s an amazing experience in all those fields.

There was quite a bit of work involved since I started, but now the very basics are set up and I can move forward pretty quickly.

All of it is done in blueprints for now, it’s easier to tweak and go back & forth with different ideas. Oh, and everything is done in my free time alongside working at Dark Stork Studios!

 

Dynamic Light System


 

I’m using the latest feature from Unreal Engine 4 that got added in 4.5, Ray Traced Distance Field Shadowing.

Then comes a Timeline, handling multiple things in a real-time basis like the rotation and intensity of the sun (a movable directional light), and the shadow casting. On top of it comes a timer that fires every X seconds based on the Quality Settings of the client, updating the SkyLight Color and the SkySphere Sun Position. I mostly rewritten how the original BP_SkySphere was working, implementing my functions and keeping only the part that interact with the material.

Ray Traced Distance Field Shadowing still have a heavy cost, eating 10fps over a static light backing on my ol’ HD6850. I’m updating to a GTX970 pretty soon so I’ll be able to update my performance hit on this topic later on.

The result:

This slideshow requires JavaScript.

 

Perception System


 

I created a sort of Perception System, while Epic is working on their own. It’s casting a sphere in front of the camera on around 2 meters, in a specific Overlap Chanel. If it finds something “triggerable”, it allows the player to press F (Activate) or E (Equip) and send this event to the Character Blueprint.

 

Inventory System


 

The hardest part was the Inventory. Fortunately I’ll have our UI Designer helping me on the look on his free time, because right now it looks pretty “programmer art” and I’m not even a programmer.

It’s quite simple, but robust. It consists in 3 parts: A Loot Spawner, an Inventory Window and an Item Bar.

The Loot Spawner, can take any form or shape that the player can trigger with his Perception System and opens a “Loot Window” . It can also display different effects if you are the Instigator or just a Spectator of this event.

In green, a Spawner that got caught in the Perception System. It is activated, so it opened a Loot Window.
In green, a Spawner that got caught in the Perception System. It is activated, so it opened a Loot Window.

By clicking on any item in the Loot Window, it disappears and is sent to the inventory of the instigator.

On the bottom you can see a bar that will hold items usable with Quick Keys, like 1, 2, 3… and so on.

Weapons won’t be held in this bar, as a character will be able to hold only one at a time (…at least in the beginning).

The Inventory itself.
The Inventory itself.

The inventory itself opens with the TAB key and holds all the current items. When the player is clicking on any item, an event is sent to the item and it will react accordingly. Consumable will be consumed, Weapons and Equipment will be Equipped etc. All mechanics are handled per-items, which makes this system very versatile. Plus, the inventory can completely change it’s shape or size on-the-fly, and it won’t affect your objects inside of it.

The Drag & Drop mechanics to re-order or place in a chest is not yet implemented, I hope Epic will make a more reliable and user-friendly system anytime soon. Right now you can still have the inventory AND a Loot Window opened, and see the real-time change in your inventory.

 

Weapons Mechanics


Weapons are a crucial part of this project and I hope I made them well and won’t be stuck with a half-working system later in the process…

When equipping a weapon, it disappears from the inventory and appears in the hands of the character. There’s a UMG Widget representing the weapon, its name, magazine size and current bullets amount.

Weapon Equiped, with it's own UMG Widget on the side and it's name displayed.
Weapon Equiped, with it’s own UMG Widget on the side and it’s name displayed.

Right now my Weapons consists of two separate objects, one is an Item that takes place in the inventory and Loot Spawners, the other one holds all the mechanics of this weapon (accuracy, magazine size, damages, mesh, animations…).

Upon firing it casts a ray in front of the player and influenced by his camera central point (the crosshair). My raycast uses another channel and will display different effects if it hits a pawn or a simple environmental static mesh.

Weapon Firing a projectile, exploding on impact and spawning a decal normalized and rotated upon the impact angle.
Weapon Firing a projectile, exploding on impact and spawning a decal normalized and rotated upon the impact angle.

 

In one of my next posts I’ll detail more about the techniques and blueprints used in this project, let me know in the comments if you’d like a specific one to be covered first.

I’ll also explain my procedural building generation system in a near future. Stay nearby, I’ll keep you updated !

Reference of Inspiration – Part 1

If I had to do a list of the hardest part of any any creative job, finding good references will be on par with finding inspiration.

I have a massive bookmarks folder that I consult on a regular basis, some very obvious, but some of them might be quite obscure. In this first part, those are the ones that I’d like to share with you today.

 

Dark souls II - Forest of fallen giants by Polygon Fragments
Dark souls II – Forest of fallen giants by Polygon Fragments

Polygon Fragments

Polygon Fragments is a french Youtube Channel run by someone nicknamed Grocan.

Every one of his video is an almost-silent journey, running through many different kind of games. This is sort of an alternative view on our favourite art, and it really helps to understand – Why those environments are a success? What makes them so great?

By erasing any gameplay, he allows us to focus on the silent narrative, the colors, the shapes, the contrasts. Highly recommended channel, it’s always surprising and oniric.

 

 

 

 

Channel Tunnel in Dishonored by Dead End Thrills
Channel Tunnel in Dishonored by Dead End Thrills

Dead End Thrills

Simply and saying that this is the home of the best game screenshots ever made will be an understatement. This is the work of a pro Screenshot Artist helped by a team of semi-professional enthusiasts, delivering the best real time artworks available in the game industry.

They have an amazing eye for details and composition, doing the work of a real photographer with our games’ tools. Sometimes they release large interviews about the art direction of the games they took screenshots from. Furthermore, they provide huge resolution renders of their artworks, free of charge for students and hobbyist. Definitely a must-have bookmark of any designer or artist.

 

 

 

Random Ghost - Inspiration drawn from absolutely every field.
Random Ghost – Inspiration drawn from absolutely every field.

Random Ghost

Completely random as it’s name implies, there is absolutely every kind of artwork you could imagine. From bronze sculptures to GIFs, from classic painting to latex-based live performances.

This website was created by Garrett Schultz, Art Director of Apothic Games.

 

 

 

 

Concept art "project 77" by Martin Deschambault found on Neuromaencer.
Concept art “project 77″ by Martin Deschambault found on Neuromaencer.

Neuromaencer

Getting back to the topic of video games, another art-dump gallery quite heavily influenced by dark futuristic literature.

Created by Sophie Charlotte Andresen, a young artist looking back on William Gibson, Hiroki Endo’s Eden Series, Warren Ellis and H.R. Giger, sharing their artistic offspring with her 35.000 followers.

 

 

 

 

Creature Spot - Dragon Anatomy by Lindsay Wakefield
Creature Spot – Dragon Anatomy by Lindsay Wakefield

Creature Spot

Creature Spot is the creation of Davi Blight, a concept artist quickly joined by over a hundred contributors. They provide an amazing flow of constant innovation and originality, even if you’re not working on any creatures-related project right now, this is still a very valid piece of inspiration.

 

 

 

 

 

Steven Messing concept arts, found on Nuthing but Mech
Steven Messing concept arts, found on Nuthin’ but Mech

Nuthin’ but Mech

On the other side of the polygon surface lies Nuthin’ But Mech, a website dedicated to hard-surface robotic creatures.

Probably the most well known from this list, it became so successful that it spawned several books and sister-projects.