Posts

Showing posts with the label Programming

Useful specifiers for Blueprint - part 2

Image
Since the last post  I've learnt about few another cool specifiers that can help with creating rich Blueprint nodes in C++.

Enhanced Code Flow plugin for UE4

Image
I proudly present my first, finished and well polished plugin for Unreal Engine 4! What does it do? This code plugin provides functions that can drastically improve the quality of life during the implementation of game flow in C++. Basically, if you ever wanted to have an equivalent of Delay Node in your code - you might like this plugin very much.

Useful specifiers for Blueprint nodes generation

Image
Here I wanted to show you some useful UE4 specifiers used in functions, properties and classes declarations which helped me writing cleaner and more user friendly code and BP nodes. 

Variadic templates and initializer lists

Here I'd like to show you how to utilize variadic template functions' properties and initializer lists to write better and cleaner code.

C++ traits vs. if constexpr

Long time ago I wrote about C++ traits and how to use them to write functions which can have different bodies depends on the template type they use.

Updating actors in the editor in Unreal Engine 4

Image
Did you know that you can tick actors inside the editor viewport? It can be useful if you want to visualize how the moving actor will look and feel on the scene without even playing the game. And it is really easy to do!

Multiplatform Plugins in Unreal Engine 4

Image
Long time ago I wrote an article about adding a multiplatform runtime module to the Unreal Engine 4. This day that article would be complately out of date. UE4 changed and the way the new stuff can be added to it changed too. First of all, I want to be clear – this article will not cover 100% of the topic, because it’s simply too broad. This is rather a quick start into writing your own plugins, getting know the basics. This article will cover the following topics: Creating a plugin Building a plugin Making a plugin that works differently,  depending on the platform Using the plugin from C++ Using the plugin from Blueprints Creating a plugin settings editable from the Editor Calling asynchronous functions from Blueprints When writing this article I was using the Unreal Engine 4.18.1. For the lazy ones – here’s the github source code version. So, with all of this in mind – let’s start!

Migrating to IPv6

Image
When writing a multiplayer game the question that arises more and more often is – "Should I bother about an IPv6?" Short answer – YES! The IPv6 is no longer a tale from the future. The number of people using the newest version of the Internet Protocol increases really fast. Quick look at Google Statiscits and you will see, that numbers of requests to Google via IPv6 grows expotentially and when writing this post it reaches 18% One of the reason why the IPv6 suddenly became a thing (except the main one – that we’re running out of addresses) is that Apple started rejecting apps that were not working with IPv6-only networks ( Source ). Shortly after that – Amazon announced support for IPv6 on their EC2 servers ( Source ). Currently – the biggest market that uses IPv6 is the mobile one, where number of devices might be even greater than the number of stationary computers. So, how the networking code should be written to support the IPv6?

C++11 rvalue references usage

Rvalue references are one of the biggest feature introduced to the c++11, but I found it rather difficult to understand and to find a usage for them. It was the issue which was very similar to the understanding c++ traits I had. Now, I’d like to write down all what I’ve learned, in order to remember it better and to share the way I understand it the best. This article is a very quick introduce to why we need rvalue references and why they are awesome!

Using Cheat Manager in Unreal Engine 4

Image
The cheat manager in Unreal Engine 4 is a class that handles commands useful for making testing much easier. In fact it’s a container for most of the exec cheat functions. Those functions can be implemented in many places – GameInstance classes or PlayerController classes but it’s good to keep them in one place in order to have the project more organized. There are plenty of commands in the base Cheat Manager already – you can check all of them in the following file. Engine\Source\Runtime\Engine\Classes\GameFramework\CheatManager.h But if you want to extend the Cheat Manager in your game there are few steps that must be followed. To start implementing your Cheat Manager – create a class that inherits from the base one: MyCheatManager.h #pragma once #include "CoreMinimal.h" #include "GameFramework/CheatManager.h" #include "MyCheatManager.generated.h" UCLASS() class CHEATTEST_API UMyCheatManager : public UCheatManager { GENERATED_BODY() ...

Simple protection against memory hacking

Image
While playing video games with leaderboards you might notice that sometimes there are players with enormous, impossible scores. As you probably guess those ones weren’t scored by playing a game the fair way. There are three (known to me) ways to do such a terrible thing: By modifying the save files or the shared preferences. Better not to use any kind of shared preferences to store vulnerable values, while the save files should be encrypted and has a checksum for checking if someone was trying to modify them. By using a proxy to perform a-man-in-the-middle attack (in other words – by modifying the request that was sent to the leaderboards system). Sensitivity to this type of attack depends of the leaderboards’ vendor you use. If you have your own leaderboard system make sure you communicate with it via SSL with public key infrastructure. By modifying the memory during the game runtime with such programs like GameGuardian. We will talk about the 3rd way to cheat.

Billboards with geometry shader

Image
Billboards in video games are the 2D planes in 3D scene that are always pointed perpendicularly at the camera. They can be used to draw distance objects that doesn’t require much details, to draw particles or they can be used as a part of the editor interface. Normally the plane is rotated by transforming metrices so it face the camera, but there is another, easier way – by using the goods of geometry shader. In fact, to draw a square billboard we only need the position of it’s center and normalized size of the edge. We pass the position of the center of the billboard from Vertext Shader straight to the Geometry Shader. in vec3 inPosition; out vec4 inoutPosition; void main() { // Just pass the position to the geometry shader. inoutPosition = vec4(inPosition,1); } After that we calculate the screen position of the center of the billboard by using the world position of the center of the billboard and the view-projection matrix. This position can be used to generate a...

Gif Player in JavaScript

At some web pages you can notice that gifs aren’t playing at the beginning but they are waiting for user to click on them to start playing. This trick can prevent from unnecessary data downloading and from overhelming the computer by displaying the huge amount of animated pictures. How is it done?

Simple hex picker

Image
Using hexes instead of square fields gives strategy games more depth and variety in creating interesting, tactical situations. But, because of its shape, it is slightly more challenging to implement them. This article will show how to nicely pick the proper hex tile using a mouse. First of all, let’s look at the interesting properies of the hexagon.

GPU Particles

Image
Modern graphic cards are the source of an enormous computing power that can be used not only for rendering. How about updating over million particles with a realtime changing enviroment or emitter position?

Light shafts

Image
Light shafts, light scattering, god rays – many names but they represent the same awesome effect that can be noticed during foggy day or in a dusty room. In games they make levels more moody and atmospheric, but how are they made?