Wiki Code Tutorials

https://www.mediafire./convkey/7d2b/fr75kbso2kkazru6g.jpg

Dear Community,

I have been hard at work making UE4 C++ Code tutorials!

I have added many pages of entirely code-focused tutorials, including both .h and .cpp,

to the UE4 Wiki Code Page!

https://wiki.unrealengine./Category:Code


**UE4 C++**

The entire focus of these tutorials is UE4 C++, not just regular C++.

Using my code samples will help you get a feel of how UE4 C++ works and help you get integrated with the UE4 API.


**Code Example

Custom Save System To Compressed Binary File**

Here’s a sample of the kind of code I am posting on the Wiki Code page:

is a code sample for how to Save any game data you want from UE4 C++ to a compressed binary filename of your choosing.


bool ControllerClass::SaveGameDataToFileCompressed(const FString& FullFilePath, 
	int32& SaveDataInt32,
	FVector& SaveDataVector,
	TArray<FRotator>& SaveDataRotatorArray
){
	FBufferArchive ToBinary;
	SaveLoadData(ToBinary,NumGemsCollected,PlayerLocation,ArrayOfRotationsOfTheStars); 
 
	**//Pre Compressed Size**
	ClientMessage("~ PreCompressed Size ~");
	ClientMessage(FString::FromInt(ToBinary.Num()));
 
	//
 
	**// Compress File 
	//tmp compressed data array**
	TArray<uint8> CompressedData;
	FArchiveSaveCompressedProxy Compressor = 
		FArchiveSaveCompressedProxy(CompressedData, ECompressionFlags::COMPRESS_ZLIB);
 
	**//Send entire binary array/archive to compressor**
	Compressor << ToBinary;
 
	**//send archive serialized data to binary array**
	Compressor.Flush();
 
	//
 
	**//Compressed Size**
	ClientMessage("~ Compressed Size ~");
	ClientMessage(FString::FromInt(CompressedData.Num()));
 
 
	if (!GFileManager) return false;
 
	**//vibes to file, return successful or not**
	if (FFileHelper::SaveArrayToFile(CompressedData, * FullFilePath)) 
	{
		**// Free Binary Arrays **
		Compressor.FlushCache();
		CompressedData.Empty();
 
		ToBinary.FlushCache();
		ToBinary.Empty();
 
		**// Close Buffer **
		ToBinary.Close();
 
		ClientMessage("File Save Success!");
 
		return true;
		//
	}
	else
	{
		**// Free Binary Arrays **
                Compressor.FlushCache();
		CompressedData.Empty();
 
		ToBinary.FlushCache();
		ToBinary.Empty();
 
		**// Close Buffer **
		ToBinary.Close();
 
		ClientMessage("File Could Not Be Saved!");
 
		return false;
		//
	}
}


**Summary**

Enjoy!

Thanks. Putting up is awesome.

[=;1526]
Thanks. Putting up is awesome.
[/]

Hee hee, thanks !

“Somebody get guy a medal” … Awesome…thanks for sharing…
I just learned Unrealscript from going through Dungeon Defense (etc.) and without those to reference I’m going to be lost for a bit in C++…thanks so much for a great place to start…

you are a **** hero! is already helping me get settled in :smiley:

Thank you so much for !

Awesome! Thank you!

@

Yay, I am glad you are enjoying my efforts!

@DAAAAAVVE

I’m liking your name, I hope I spelled it right

:slight_smile:

! <3 Thanks so much.

Thanks a lot!!

[FONT=Comic Sans MS]New Tutorial: Dynamic Arrays

Dynamic Arrays
https://wiki.unrealengine./Dynamic_Arrays_in_UE4_C%2B%2B

[=SaxonRah;1645]
! <3 Thanks so much.
[/]

Hee hee your welcome SaxonRah!

UE4 C++ is so much fun!

:slight_smile:

Great job and thank it will be handful ^^

thanks, that really will help me to get things started!, the fps tutorial is just awesome.

[=daimaku;1734]
thanks, that really will help me to get things started!, the fps tutorial is just awesome.
[/]

Heey, welcome Daimaku, I’ve been missing you from the UE3 forums :slight_smile:

Heh, yes, likes is our resident exhibitionist.
I’m just a bit of a flasher :slight_smile:

Great work, now I have a lot of stuff to read on! Thank you! :smiley:

[=DarthB;1947]
Great work, now I have a lot of stuff to read on! Thank you! :smiley:
[/]

Hee hee, you’re welcome!

:slight_smile:

Thanks It covers most of my UE4 questions :slight_smile:

[FONT=Comic Sans MS]Tutorial Added, USTRUCTS(), UE4 C++ Structs

UE4 C++ Structs

https://wiki.unrealengine./Structs,_USTRUCTS(),_UE4_C%2B%2B_Structs

[=;2298]
Thanks It covers most of my UE4 questions :slight_smile:
[/]

Yay!

Wow, is a fantastic start. I am amazed you’ve done all so quickly :smiley:

Hopefully will break the ice for more people to contribute, although you seem to be a one man coding tutorial army at the moment hah.