Download

Wiki Code Tutorials

Hello mates.

Sorry for bugging but can you confirm these tuts are still relevant ( working) . Especially after 4.6 ? Like this one:

These really look tasty, even more than official ones so I wanna try if I have the time.

Thanks mates.

Yes they are up to date with 4.6!

The wiki you linked is actually mostly C++ basics so I dont think it will go out of date any time soon :slight_smile:

If anyone finds a wiki that is out of date feel free to pm me about it.

:slight_smile:

Rama

Example Of Template Functions

I make extensive use of C++ Template functions in my Min/Max of Array, full code here!

Min/Max of Array Forum Link

Wiki on C++ Templates

Oh thank a lot for clearing this :smiley:

If I ever find one outdated I’ll post here. Thanks again :smiley:

**Creating Dynamic Physics Constraints During Runtime

My Physics Library Functions Included!**

Rama

Hey guys, I also posted a quick tutorial (using Rama’s examples as a template, hope that’s okay!)

How to access the functions and variables of an object specified in a <TSubclassOf> container.

Thanks!

Hey, I have a comment on this page: A new, community-hosted Unreal Engine Wiki - Announcements and Releases - Unreal Engine Forums

You mention that, because templates require definitions of the methods in the .h files anyway, the FORCEINLINE keyword should be used. I don’t really agree with that as a rule of thumb. Inlining functions increases the size of the code. Sometimes, people may not care about the size of the code and only the number of CPU cycles it takes to run, and then I agree that FORCEINLINE would often result in a performance increase… but even that is not always true. The increased code size can have a negative impact on your performance, even taking into account that the function call overhead is avoided (see Sections 3.4 and 6.2.2 of http://www.akkadia.org/drepper/cpumemory.pdf).

I would strongly recommend not to use FORCEINLINE at all, unless extensive profiling indicates that it does result in better performance in a highly performance-critical area of the game’s code. In general, it is fairly safe to rely on the compiler to make the right decisions with respect to whether or not code should be inlined (it can still do so even if you don’t use the FORCEINLINE or inline keywords).

Hi there Dennis! Great to hear from you!

I’ve modified the wiki to mention that you should probably just let the compiler figure it out if your function body is large!

I am presuming that readers of my wiki will actually look up “C++ inline function” and read about all these details, including your concerns about code bloat.

I can’t explain everything in my wiki pages :slight_smile:

In case you’re wondering, I am assuming that readers of my wiki understand that C++ is one of the most well-documented languages on the planet, and they can find out more information about any topic by searching for themselves :slight_smile:

But thanks again for your input, I’ve modified my phrasing on the wiki to make it more clear that user discretion is required when using FORCEINLINE!

Have fun today!

:heart:

Rama

Dear Community,

I’ve just posted a new wiki!

I am giving you easy-to-use pre-processor commands to get a UE4 String that tells you the Class Name, Function Name, and Line Number of the calling code!

Logs, Printing the Class Name, Function Name, and Line Number of your Calling Code!


**Pics**

![a51b4eb12a773cd47ef504c3015401ed5a1222f7.jpeg|1280x960](upload://nyBhSL7AeJYRaiuAA8hU6eu26hN.jpeg)

After you get my .h file below, the code for the above picture is this!



```


//~~~ Tick ~~~
void AEVCoreDefense::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);
	//~~~~~~~~~~~~~

	VSCREENMSG("Got Here!");  //Class and line number get printed for you! ♥ Rama
}


```




![76592038c1a622532653d3516d343bb88787467e.jpeg|1280x960](upload://gSXi9wvKFnU8eJKryUDfNDEi8eG.jpeg)

Code

Here is the entire file you can #include in your code base!

I made this a file called JoyCurrentClassFuncLine.h

So you would then do this somewhere at the top of one of your core classes:



// Joy Class Func Line
**#include "JoyCurrentClassFuncLine.h"**




**/*
	Joy String 
		Current Class, File, and Line Number!
			by Rama
			
	PreProcessor commands to get 
		a. Class name
		b. Function Name
		c. Line number 
		d. Function Signature (including parameters)
		
	Gives you a UE4 FString anywhere in your code that these macros are used!
	
	Ex: 
		You can use JOYSTR_CUR_CLASS anywhere to get a UE4 FString back telling you 
		what the current class is where you called this macro!
	
	Ex:
		This macro prints the class and line along with the message of your choosing!
		VSCREENMSG("Have fun today!");
	<3  Rama
*/**
#pragma once

**//Current Class Name + Function Name where this is called!**
#define JOYSTR_CUR_CLASS_FUNC (FString(__FUNCTION__))

**//Current Class where this is called!**
#define JOYSTR_CUR_CLASS (FString(__FUNCTION__).Left(FString(__FUNCTION__).Find(TEXT(":"))) )

**//Current Function Name where this is called!**
#define JOYSTR_CUR_FUNC (FString(__FUNCTION__).Right(FString(__FUNCTION__).Len() - FString(__FUNCTION__).Find(TEXT("::")) - 2 ))
  
**//Current Line Number in the code where this is called!**
#define JOYSTR_CUR_LINE  (FString::FromInt(__LINE__))

**//Current Class and Line Number where this is called!**
#define JOYSTR_CUR_CLASS_LINE (JOYSTR_CUR_CLASS + "(" + JOYSTR_CUR_LINE + ")")
  
**//Current Function Signature where this is called!**
#define JOYSTR_CUR_FUNCSIG (FString(__FUNCSIG__))


**//Victory Screen Message
// 	Gives you the Class name and exact line number where you print a message to yourself!**
#define VSCREENMSG(Param1) (GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, *(JOYSTR_CUR_CLASS_LINE + ": " + Param1)) )


New Debugging PreProcessor Commands

I added some additional pre-processor commands to my wiki above!

UE_LOG and additional Screen Msg commands, that all tell you where you are in your code base automatically, including the line number!



// Joy Class Func Line
**#include "JoyCurrentClassFuncLine.h"**




**/*
	Joy String 
		Current Class, File, and Line Number!
			by Rama
			
	PreProcessor commands to get 
		a. Class name
		b. Function Name
		c. Line number 
		d. Function Signature (including parameters)
		
	Gives you a UE4 FString anywhere in your code that these macros are used!
	
	Ex: 
		You can use JOYSTR_CUR_CLASS anywhere to get a UE4 FString back telling you 
		what the current class is where you called this macro!
	
	Ex:
		This macro prints the class and line along with the message of your choosing!
		VSCREENMSG("Have fun today!");
	<3  Rama
*/**
#pragma once

**//Current Class Name + Function Name where this is called!**
#define JOYSTR_CUR_CLASS_FUNC (FString(__FUNCTION__))

**//Current Class where this is called!**
#define JOYSTR_CUR_CLASS (FString(__FUNCTION__).Left(FString(__FUNCTION__).Find(TEXT(":"))) )

**//Current Function Name where this is called!**
#define JOYSTR_CUR_FUNC (FString(__FUNCTION__).Right(FString(__FUNCTION__).Len() - FString(__FUNCTION__).Find(TEXT("::")) - 2 ))
  
**//Current Line Number in the code where this is called!**
#define JOYSTR_CUR_LINE  (FString::FromInt(__LINE__))

**//Current Class and Line Number where this is called!**
#define JOYSTR_CUR_CLASS_LINE (JOYSTR_CUR_CLASS + "(" + JOYSTR_CUR_LINE + ")")
  
**//Current Function Signature where this is called!**
#define JOYSTR_CUR_FUNCSIG (FString(__FUNCSIG__))


**//Victory Screen Message
// 	Gives you the Class name and exact line number where you print a message to yourself!**
#define VSCREENMSG(Param1) (GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, *(JOYSTR_CUR_CLASS_LINE + ": " + Param1)) )

#define VSCREENMSG2(Param1,Param2) (GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, *(JOYSTR_CUR_CLASS_LINE + ": " + Param1 + " " + Param2)) )

#define VSCREENMSGF(Param1,Param2) (GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, *(JOYSTR_CUR_CLASS_LINE + ": " + Param1 + " " + FString::SanitizeFloat(Param2))) )

//UE_LOG Messages!
#define V_LOG(Param1) 	      UE_LOG(Joy,Warning,TEXT("%s: %s"), *JOYSTR_CUR_CLASS_LINE, *FString(Param1))
#define V_LOG2(Param1,Param2) UE_LOG(Joy,Warning,TEXT("%s: %s %s"), *JOYSTR_CUR_CLASS_LINE, *FString(Param1),*FString(Param2))
#define V_LOGF(Param1,Param2) UE_LOG(Joy,Warning,TEXT("%s: %s %f"), *JOYSTR_CUR_CLASS_LINE, *FString(Param1),Param2)



**Featured Wiki

Read and Write to Config Files in UE4 C++!**

In this wiki I give you code that lets you read and write to config files any time you want, more so than just using UPROPERTY(config)

You can read and write any value you want, any time, directly in UE4 C++!

End result: a Human-readible, Human-editable file that your players can tweak to adjust your game’s settings after release!

Wiki Link
A new, community-hosted Unreal Engine Wiki - Announcements and Releases - Unreal Engine Forums,Read%26_Write_to_Config_Files

**New Wiki!

AI Navigation in C++, Customize Path Follwing Every Tick!**

Shows you how to extend UE4’s wonderful AI Path Folllowing foundation by adding your own C++ that will run every tick that the path following is occurring!

This lets you add to UE4 Path Following without having to rewrite the whole thing from scratch, you can inject your own code per-tick into the standard UE4 path following code!

I used what I share in the wiki below to make c++ dynamic jump pathing, as shown in the AI videos in my signature.

UE4 Wiki Link

Enjoy!

Rama

Example Of Template Functions

I make extensive use of C++ Template functions in my Min/Max of Array, full code here!

Min/Max of Array Forum Link

Wiki on C++ Templates

**How To

Add Handcrafted Custom Math Curves From UE4 Editor to C++**

Here’s a tutorial on how to construct perfect hand crafted curves in the Editor and then bring them into C++!

You can thus create spring curves, dampen curves, bounce curves, any kind of curves you want, and then use them to drive your C++ code!

Rama

Wow :smiley: Now that is creative :smiley:

Hee hee!

Glad you liked!

Custom Handcrafted Math Curves in C++ for Everyone!

Rama

Link to PhysX 3.3 Source Code For All UE4 Devs

I’ve updated my PhysX Wiki to include the direct link to the PhysX entire source code!

As a UE4 developer, you now have access to the entire PhysX C++ source code!

Rama Wiki, Integrating PhysX Code into Your Project

Rama

Garbage Collection and Dynamic Memory Allocation

In this wiki I show you how you can prevent your runtime-spawned UObjects from getting garbage collected prematurely!

This includes things like spawned emitters / Particle System Components, decals, and your own custom UObject systems!

I also go over how to allocate memory yourself and also free it, so you can do your own memory management.

Enjoy!

Garbage Collection and Dynamic Memory Management

Rama

Creating Custom Level Blueprints in C++

Here’s a wiki on how you can make your own C++ Level Blueprints so that you can easily store and access variable data for levels in C++!

You can also make your own functions specifically for your game, that your level designers can then use, that are backed by the power of C++!

Creating Custom Level Blueprints in C++

Rama

e Custom Console Commands in C++ to be implemented in Blueprints!

Empower your whole team to make their own console commands in Blueprints!

I originally designed this at the request of Hourences for use in Solus!

Enjoy!

Rama