A.Moniem | Mastering Unreal Engine 4.X | E-Book | www.sack.de
E-Book

E-Book, Englisch, 384 Seiten

A.Moniem Mastering Unreal Engine 4.X

Master the art of building AAA games with Unreal Engine
1. Auflage 2025
ISBN: 978-1-78588-522-8
Verlag: De Gruyter
Format: PDF
Kopierschutz: Adobe DRM (»Systemvoraussetzungen)

Master the art of building AAA games with Unreal Engine

E-Book, Englisch, 384 Seiten

ISBN: 978-1-78588-522-8
Verlag: De Gruyter
Format: PDF
Kopierschutz: Adobe DRM (»Systemvoraussetzungen)



Unreal Engine 4 has garnered a lot of attention in the gaming world because of its new and improved graphics and rendering engine, the physics simulator, particle generator, and more. This book is the ideal guide to help you leverage all these features to create state-of-the-art games that capture the eye of your audience.
Inside we'll explain advanced shaders and effects techniques and how you can implement them in your games. You'll create custom lighting effects, use the physics simulator to add that extra edge to your games, and create customized game environments that look visually stunning using the rendering technique. You'll find out how to use the new rendering engine efficiently, add amazing post-processing effects, and use data tables to create data-driven gameplay that is engaging and exciting.
By the end of this book, you will be able to create professional games with stunning graphics using Unreal Engine 4!

A.Moniem Mastering Unreal Engine 4.X jetzt bestellen!

Autoren/Hrsg.


Weitere Infos & Material


The Gladiator header (.h) file


Now let's jump back to the header file again, and let's start adding some more functions and variables to it so we can start building gameplay logic for the character and make something that fits our target.

Considering that a class based on and called will be used later to read the gameplay data from Excel tables; here is the header file code I ended up with.

To make it easier to understand the code, I would like to breakdown all the variable components and methods into a set of chunks; that way it will be very easy to understand them.

Everything starts with the includes, just like any form of C++ coding you are used to making, including the header files that are going to be used or referenced and must be done at the top of the code.

#pragma once #include "GameDataTables.h" #include "GameFramework/Character.h" #include "Gladiator.generated.h"

Defining the class itself is essentially a step directly after the statements.

UCLASS(config = Game) class AGladiator : public ACharacter { GENERATED_BODY()

: This is the virtual void of the override from the class base and this one will be called once the game is started.

virtual void BeginPlay() override;

: This is a that will be added to the character blueprint that is based on that class. This component will be used to control the camera.

//Camera boom positioning the camera behind the character UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true")) class USpringArmComponent* CameraBoom;

: This is the camera itself that will be viewing the game and following the player. This one will also be added to the blueprints.

//Follow camera UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true")) class UCameraComponent* FollowCamera;

: This is a sprite component (Paper 2D is the main 2D framework for Unreal Engine 4.x). There are lots of ways we can use this to achieve an on-screen draw texture, but this one is the easiest and most flexible. I managed to add a sprite component that is very close to the camera, and then we can use it to draw whatever effect we need.

//The sprite used to draw effect, better and more contrallable than using the HUD or Textures UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Effects, meta = (AllowPrivateAccess = "true")) class UPaperSpriteComponent* EffectSprite;

: This is the constructor, and as mentioned earlier, it is used to build the object in edit mode.

public: AGladiator();

: This is a variable in degrees to control the camera turn rate.

//Base turn rate, in deg/sec. Other scaling may affect final turn rate. UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera) float BaseTurnRate;

: Another variable to control the camera, but this time it's for lookups. This one is also in degrees.

//Base look up/down rate, in deg/sec. Other scaling may affect final rate. UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera) float BaseLookUpRate;

: This is a variable to determine the jump velocity.

//Base Jump velocity UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Player Attributes") float jumppingVelocity;

: This is a Boolean variable to tell us what the current state of the layer is. It is a very important variable, as most of player behavior and inputs will be based on it.

//Is the player dead or not UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Player Attributes") bool IsStillAlive;

: Another Boolean variable to report if the player is attacking now or not. It is important for animations.

//is the player attacking right now? UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Player Attributes") bool IsAttacking;

: This is an integer to determine the current active weapon index. The player could have several weapons; to be able to load the weapon's data, it is a good idea to give each weapon its own index.

//the index of the current active weapon. UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Player Attributes") int32 WeaponIndex;

: Sometimes the player is not dead, but you also need to take the control out of his hands, maybe because the character is carrying out an attack, or maybe because the player paused the game. So this is a variable meant to tell us if the player is in control now or not.

//To be able to disable the player during cutscenes, menus, death....etc UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Player Attributes") bool IsControlable;

: A variable to hold the active instance of the game tables. It is just here to load some data.

UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Game DataTables") AGameDataTables* TablesInstance;

: A getter method to return the value of the Boolean variable.

//Return if the player dead or alive UFUNCTION(BlueprintCallable, Category = "Player Attributes") bool GetIsStillAlive() const { return IsStillAlive; }

: A method that takes a parameter of or , and uses it to set the status of the player controller. So it is here we take the control from the player, or give it to him at a certain moment.

//Enable or disable inputs UFUNCTION(BlueprintCallable, Category = "Player Attributes") void OnSetPlayerController(bool status);

: A method that takes a value, and reduces the total player health using it. It is usually used when the player gets damaged.

//the attack effect on health UFUNCTION(BlueprintCallable, Category = "Player Attributes") void OnChangeHealthByAmount(float usedAmount);

: This is a function that returns the value of the player as a value.

UFUNCTION(BlueprintCallable, Category = "Player Attributes") float OnGetHealthAmount() const {return TotalHealth;}

: A method that holds some procedurals after the player has done an attack.

UFUNCTION(BlueprintCallable, Category = "Player Actions") void OnPostAttack();

: A method to return the component variable.

//Returns CameraBoom subobject FORCEINLINE class USpringArmComponent* GetCameraBoom() const { return CameraBoom; }

: Another method to return the component variable.

//Returns FollowCamera subobject FORCEINLINE class UCameraComponent* GetFollowCamera() const { return FollowCamera; }

: A method that holds the code responsible for player movement to the forward and backward. Notice that it is a in order to be able to use it from the class blueprint instances.

protected: UFUNCTION(BlueprintCallable, Category = "Player Actions") void MoveForward(float Value);

: A method that holds the code responsible for player movement to the left and right.

UFUNCTION(BlueprintCallable, Category = "Player Actions") void MoveRight(float Value);

: A method that is responsible for applying the jump action to the character based on the base character class.

UFUNCTION(BlueprintCallable, Category = "Player Actions") void Jump();

: A method that is responsible for stopping the jump, and resuming the idle/run animation.

UFUNCTION(BlueprintCallable, Category = "Player Actions") void StopJumping();

: A method that is responsible for attacking.

UFUNCTION(BlueprintCallable, Category = "Player Actions") void OnAttack();

: A method that is responsible for switching between weapons.

UFUNCTION(BlueprintCallable, Category = "Player Actions") void OnChangeWeapon();

: A method that is responsible for applying turns to the following camera.

//Called via input to turn at a given rate. void TurnAtRate(float Rate);

: A method that is responsible for applying the camera look-up rate to the follow camera.

//Called via input to turn look up/down at a given rate. void LookUpAtRate(float Rate);

: A variable that holds the player's total health (the current health), as at any moment the player's health gets reduced, that will be the final value. Some people like the approach of creating two variables:

  • : This is the base and default...


A.Moniem Muhammad :

Muhammad A.Moniem started in the industry at a very early age. He taught himself everything related to the game development process even before he joined college. After being a software engineer, he started to teach himself the art of game design and game art techniques. As a self-taught person, he was able to find his way into the industry very easily, which led him to be hired for big, medium, and small companies, titles, and teams. Throughout his career, he was able to contribute as a full-time or part-time employee or freelancer to games for a wide range of platforms, including Windows, Mac, iOS, Android, PS4, Xbox One, and OUYA. He has also worked with technologies, such as VR, AR, and Kinect. Finally, he was able to establish his own one-person game company/team as a part-time independent developer. A lot of his indie games got recognition or have been finalists at international indie game events, such as IGF, Indie Showcase, IGC, and Tokyo Game Show. He has written another Unreal Engine book before and he has also designed an amazing website, www.mamoniem.com. He has also worked on Learning Unreal Engine iOS Game Development, Packt Publishing, which is available at https://www.packtpub.com/game-development/learning-unreal-engine-ios-game-development.



Ihre Fragen, Wünsche oder Anmerkungen
Vorname*
Nachname*
Ihre E-Mail-Adresse*
Kundennr.
Ihre Nachricht*
Lediglich mit * gekennzeichnete Felder sind Pflichtfelder.
Wenn Sie die im Kontaktformular eingegebenen Daten durch Klick auf den nachfolgenden Button übersenden, erklären Sie sich damit einverstanden, dass wir Ihr Angaben für die Beantwortung Ihrer Anfrage verwenden. Selbstverständlich werden Ihre Daten vertraulich behandelt und nicht an Dritte weitergegeben. Sie können der Verwendung Ihrer Daten jederzeit widersprechen. Das Datenhandling bei Sack Fachmedien erklären wir Ihnen in unserer Datenschutzerklärung.