<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Medium Difficulty Archives - Couch Learn</title>
	<atom:link href="https://couchlearn.com/category/unreal-engine/medium-difficulty/feed/" rel="self" type="application/rss+xml" />
	<link>https://couchlearn.com/category/unreal-engine/medium-difficulty/</link>
	<description>Detailed Game Programming Tutorials</description>
	<lastBuildDate>Sun, 30 Mar 2025 23:02:38 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.5</generator>

<image>
	<url>https://couchlearn.com/wp-content/uploads/2020/05/cropped-logolarge-32x32.png</url>
	<title>Medium Difficulty Archives - Couch Learn</title>
	<link>https://couchlearn.com/category/unreal-engine/medium-difficulty/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to use Data Tables in your Unreal Engine 5 game</title>
		<link>https://couchlearn.com/how-to-use-data-tables-in-your-unreal-engine-5-game/</link>
					<comments>https://couchlearn.com/how-to-use-data-tables-in-your-unreal-engine-5-game/#respond</comments>
		
		<dc:creator><![CDATA[Matt]]></dc:creator>
		<pubDate>Sun, 30 Mar 2025 23:02:36 +0000</pubDate>
				<category><![CDATA[Medium Difficulty]]></category>
		<category><![CDATA[Unreal Engine]]></category>
		<category><![CDATA[Unreal Engine 4]]></category>
		<category><![CDATA[Unreal Engine 5]]></category>
		<category><![CDATA[How to use Data Tables in your Unreal Engine 5 game]]></category>
		<category><![CDATA[ue5]]></category>
		<category><![CDATA[unreal engine]]></category>
		<category><![CDATA[unreal engine 5]]></category>
		<category><![CDATA[unreal engine datatables]]></category>
		<guid isPermaLink="false">https://couchlearn.com/?p=784</guid>

					<description><![CDATA[<p>Data tables are a useful feature of Unreal Engine 5. They allow the programmer/designer to create and access a pre-made list of information. When creating <a class="mh-excerpt-more" href="https://couchlearn.com/how-to-use-data-tables-in-your-unreal-engine-5-game/" title="How to use Data Tables in your Unreal Engine 5 game">[...]</a></p>
<p>The post <a href="https://couchlearn.com/how-to-use-data-tables-in-your-unreal-engine-5-game/">How to use Data Tables in your Unreal Engine 5 game</a> appeared first on <a href="https://couchlearn.com">Couch Learn</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Data tables are a useful feature of Unreal Engine 5. They allow the programmer/designer to create and access a pre-made list of information.<br><br><strong>When creating a data table you are asked to choose which struct you want to base the data table on.</strong><br><br>Here are a few game mechanic uses of data tables:</p>



<ul class="wp-block-list">
<li><em>RPG item data table that contains item stats such as damage, armour etc.</em></li>



<li><em>Subtitles for dialogue that can easily be accessed by character name.</em></li>



<li><em>An enemy data table containing a list of pre made enemy types with enemy health, damage, stamina etc.</em></li>
</ul>



<p>In this guide we will be showing you how to use Data Tables in your Unreal Engine 5 game.</p>



<h2 class="wp-block-heading">Pre-requisites</h2>



<p>To use Data Tables in Unreal Engine 5 you will need to know how to create and use structures.<br><a href="https://couchlearn.com/how-to-use-structs-in-unreal-engine-4/">Click here to read our guide on structures.</a><br><br>It would also help to know how to create and use an blueprint enum.<br><a href="https://couchlearn.com/enums-in-unreal-engine-4-blueprints/">Click here to learn about enums in Unreal Engine and how to create them in your project.</a></p>



<h2 class="wp-block-heading">What is a Data Table?</h2>



<p>In Unreal Engine 5, a Data Table is an extremely useful tool that allows you to define a list of data and store different values for this defined list based on a key.<br><br>This data is stored as an asset in your project which makes it incredibly easy to retrieve and update the data from anywhere in your code.<br><br>The data is also remembered inside of the editor meaning you can create your data while you are developing your project, then use the data inside of your project during runtime. <br><br>A great example of this is data for items or enemies in your project. This data can be set by you when designing your items and enemies which is then saved and persistent.<br><br>Making and using Data Tables in Unreal Engine 5 is easy and requires very little work. In the next section we explain how to make your own data table inside of your Unreal Engine 5 project!</p>



<h2 class="wp-block-heading">Making our Data Table</h2>



<h2 class="wp-block-heading">Creating an Enum</h2>



<p>Before we create our struct, we need to create an enum. This is an item rarity enum which will represent the quality of our role playing game item.<br><br>Simply create your enum by right clicking the content browser and clicking Enumeration in the Blueprint category.</p>



<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="507" height="529" src="https://couchlearn.com/wp-content/uploads/2025/03/image-25.png" alt="" class="wp-image-2266" srcset="https://couchlearn.com/wp-content/uploads/2025/03/image-25.png 507w, https://couchlearn.com/wp-content/uploads/2025/03/image-25-288x300.png 288w" sizes="(max-width: 507px) 100vw, 507px" /></figure>



<p>Then set the values as shown that you require. If you are following along with this guide, copy the values in the image below.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="321" src="https://couchlearn.com/wp-content/uploads/2022/12/image-1-1024x321.png" alt="Creating a basic enumerator for our rarity values" class="wp-image-1902" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-1-1024x321.png 1024w, https://couchlearn.com/wp-content/uploads/2022/12/image-1-300x94.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-1-768x240.png 768w, https://couchlearn.com/wp-content/uploads/2022/12/image-1.png 1217w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<h3 class="wp-block-heading">Creating our Struct</h3>



<p>Now that we have our enum created, next we need to create the struct that our data table will use for the types of values it will hold.<br><br>Right click anywhere in the content browser, then click Structure in the Blueprints category.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="615" src="https://couchlearn.com/wp-content/uploads/2022/12/image-1024x615.png" alt="Creating a new structure" class="wp-image-1899" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-1024x615.png 1024w, https://couchlearn.com/wp-content/uploads/2022/12/image-300x180.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-768x461.png 768w, https://couchlearn.com/wp-content/uploads/2022/12/image.png 1107w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Then set the values as shown that you require. If you are following along with this guide, copy the values in the image below.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1012" height="308" src="https://couchlearn.com/wp-content/uploads/2022/12/image-6.png" alt="Adding the damage, rarity and sell price values to our struct" class="wp-image-1907" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-6.png 1012w, https://couchlearn.com/wp-content/uploads/2022/12/image-6-300x91.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-6-768x234.png 768w" sizes="(max-width: 1012px) 100vw, 1012px" /></figure>



<h3 class="wp-block-heading">Creating our Data table</h3>



<p>Finally we can create our data table. This is done exactly the same way by right clicking inside of the content browser and clicking the Data Table option in the Miscellaneous category. </p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="654" src="https://couchlearn.com/wp-content/uploads/2022/12/image-3-1024x654.png" alt="Creating the datatable" class="wp-image-1904" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-3-1024x654.png 1024w, https://couchlearn.com/wp-content/uploads/2022/12/image-3-300x192.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-3-768x491.png 768w, https://couchlearn.com/wp-content/uploads/2022/12/image-3.png 1373w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Next there is a popup asking which struct you want to use. In this guide we are using the ExampleStruct we made earlier.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="569" height="233" src="https://couchlearn.com/wp-content/uploads/2022/12/image-4.png" alt="Choosing our datatable row structure" class="wp-image-1905" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-4.png 569w, https://couchlearn.com/wp-content/uploads/2022/12/image-4-300x123.png 300w" sizes="(max-width: 569px) 100vw, 569px" /></figure>



<h3 class="wp-block-heading">Adding Values to the Data Table</h3>



<p>Now that are data table is created and configured correctly, we can press the Add button to add a new row to our data table.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="454" src="https://couchlearn.com/wp-content/uploads/2022/12/image-5-1024x454.png" alt="Adding a new row to the datatable" class="wp-image-1906" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-5-1024x454.png 1024w, https://couchlearn.com/wp-content/uploads/2022/12/image-5-300x133.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-5-768x340.png 768w, https://couchlearn.com/wp-content/uploads/2022/12/image-5.png 1517w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>As you can see in the image below, the data table has a new row with some default values from our struct.</p>



<p>We can change the values in the &#8220;Row Editor&#8221; and the values in the data table will change above. <br><br><strong>We can now create as many entries as we want!</strong></p>



<figure class="wp-block-image size-full"><img decoding="async" width="949" height="443" src="https://couchlearn.com/wp-content/uploads/2022/12/image-7.png" alt="Showing the values in our new datatable row" class="wp-image-1909" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-7.png 949w, https://couchlearn.com/wp-content/uploads/2022/12/image-7-300x140.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-7-768x359.png 768w" sizes="(max-width: 949px) 100vw, 949px" /></figure>



<p>Clicking the row name section in the row, we can change the row name. In this example we are using BronzeSword as the new row name.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="620" height="301" src="https://couchlearn.com/wp-content/uploads/2022/12/image-8.png" alt="Changing the values of the datatable row" class="wp-image-1910" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-8.png 620w, https://couchlearn.com/wp-content/uploads/2022/12/image-8-300x146.png 300w" sizes="(max-width: 620px) 100vw, 620px" /></figure>



<p>The Damage, Rarity, and Sell Price values we defined earlier are in the Data Table view, and the Row Editor below.<br><br>Changing the values in the Row Editor will affect the values stored in the data table.<br><br>Don&#8217;t forget to <strong>Save </strong>often to prevent losing your changes!</p>



<figure class="wp-block-image size-full"><img decoding="async" width="632" height="397" src="https://couchlearn.com/wp-content/uploads/2022/12/image-9.png" alt="Setting more datatable row values" class="wp-image-1911" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-9.png 632w, https://couchlearn.com/wp-content/uploads/2022/12/image-9-300x188.png 300w" sizes="(max-width: 632px) 100vw, 632px" /></figure>



<h2 class="wp-block-heading">Using your Data Table</h2>



<p>Now that we have our data table created, configured, and filled with data, we can now learn how to access this data in our code.<br><br>We have create an Event BeginPlay node to our level blueprint and have created a Get Data Table Row node.<br><br>This Get Data Table Row node asks for a data table asset reference, and a row name.<br><br>Data Table reference is our data table we created earlier, and the Row Name is the row we want to try to find the data for.<br><br>If the row is found, the Row Found pin will run code and the Out Row will contain our data, if the row is not found, the Row Not Found pin will run code and the Out Row data will be invalid.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="639" height="263" src="https://couchlearn.com/wp-content/uploads/2025/03/image-18.png" alt="Creating a get data table row node" class="wp-image-2258" srcset="https://couchlearn.com/wp-content/uploads/2025/03/image-18.png 639w, https://couchlearn.com/wp-content/uploads/2025/03/image-18-300x123.png 300w" sizes="(max-width: 639px) 100vw, 639px" /></figure>



<p>We can set the Data Table reference by clicking on the select asset drop down and selecting our data table from the list of assets.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="593" height="301" src="https://couchlearn.com/wp-content/uploads/2025/03/image-19.png" alt="Setting the data table reference in the get data table row node" class="wp-image-2259" srcset="https://couchlearn.com/wp-content/uploads/2025/03/image-19.png 593w, https://couchlearn.com/wp-content/uploads/2025/03/image-19-300x152.png 300w" sizes="(max-width: 593px) 100vw, 593px" /></figure>



<p>Now we can split the Out Row struct by right clicking and clicking Split Struct Pin in the menu. This will split our struct into all the types and values in contains for easy visibility.<br><br>We can also see that our Row Name is now a drop down that contains all the available row names. This can be overridden by connecting a value to the Row Name pink pin.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="693" height="285" src="https://couchlearn.com/wp-content/uploads/2025/03/image-20.png" alt="Splitting the data table row struct to see the values and types" class="wp-image-2260" srcset="https://couchlearn.com/wp-content/uploads/2025/03/image-20.png 693w, https://couchlearn.com/wp-content/uploads/2025/03/image-20-300x123.png 300w" sizes="(max-width: 693px) 100vw, 693px" /></figure>



<p>Now that we have split our Out Row struct, we can see the Damage, Rarity, and Sell Price values we set earlier.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="565" height="243" src="https://couchlearn.com/wp-content/uploads/2025/03/image-21.png" alt="Getting the row data from a specific row name key" class="wp-image-2261" srcset="https://couchlearn.com/wp-content/uploads/2025/03/image-21.png 565w, https://couchlearn.com/wp-content/uploads/2025/03/image-21-300x129.png 300w" sizes="(max-width: 565px) 100vw, 565px" /></figure>



<h3 class="wp-block-heading">Looping over your Data Table Rows</h3>



<p>Now that we can access a specific row in our data table, it is essential to know how to use a loop with a data table.<br><br>In the example below we have created a Get Data Table Row Names node. This returns an Array with all of the row names inside of the data table.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="541" height="163" src="https://couchlearn.com/wp-content/uploads/2025/03/image-22.png" alt="Getting the data table row names" class="wp-image-2262" srcset="https://couchlearn.com/wp-content/uploads/2025/03/image-22.png 541w, https://couchlearn.com/wp-content/uploads/2025/03/image-22-300x90.png 300w" sizes="(max-width: 541px) 100vw, 541px" /></figure>



<p>We can then connect this to a For Each Loop node. This will now run the Loop Body for each Row Name in the Out Row Names from our Data Table.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="773" height="193" src="https://couchlearn.com/wp-content/uploads/2025/03/image-23.png" alt="Creating a for loop from the gathered data table row names" class="wp-image-2263" srcset="https://couchlearn.com/wp-content/uploads/2025/03/image-23.png 773w, https://couchlearn.com/wp-content/uploads/2025/03/image-23-300x75.png 300w, https://couchlearn.com/wp-content/uploads/2025/03/image-23-768x192.png 768w" sizes="(max-width: 773px) 100vw, 773px" /></figure>



<p>Finally connecting our For Each Loop into a Get Data Table Row like before, we can then connect the Array Element pink pin to the Row Name pink pin. <br><br>This will now get the data for that row name each time the loop runs.<br><br>We can then use the Out Row values however we want in the project!</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1025" height="227" src="https://couchlearn.com/wp-content/uploads/2025/03/image-24.png" alt="Getting the datatable row using the looped array element name" class="wp-image-2264" srcset="https://couchlearn.com/wp-content/uploads/2025/03/image-24.png 1025w, https://couchlearn.com/wp-content/uploads/2025/03/image-24-300x66.png 300w, https://couchlearn.com/wp-content/uploads/2025/03/image-24-768x170.png 768w" sizes="(max-width: 1025px) 100vw, 1025px" /></figure>



<h2 class="wp-block-heading">Conclusion</h2>



<p>Now you have learned how to create, configure, populate, and implement data tables in your Unreal Engine 5 project!<br><br>Almost every Unreal Engine project benefits from using a data table to efficiently and neatly store data for use within the systems you develop.<br><br>Working collaboratively using data tables makes sharing a single source of truth for your projects data simple and does not require any C++ knowledge!</p>



<h3 class="wp-block-heading">Further Reading:</h3>



<ul class="wp-block-list">
<li><a href="https://dev.epicgames.com/community/learning/tutorials/Gp9j/working-with-data-in-unreal-engine-data-tables-data-assets-uproperty-specifiers-and-more">A more advanced look into Data Table merging and composite tables from Unreal Engine 5&#8217;s wiki</a></li>



<li><a href="https://www.youtube.com/watch?v=aZdztLTG3OQ">A great visual guide for Data Tables by Gorka Games (Not affiliated with CouchLearn)</a></li>



<li><a href="https://dev.epicgames.com/documentation/en-us/unreal-engine/BlueprintAPI/DataTable">The official Unreal Engine 5 documentation for Data Tables in Blueprints</a></li>
</ul>
<p>The post <a href="https://couchlearn.com/how-to-use-data-tables-in-your-unreal-engine-5-game/">How to use Data Tables in your Unreal Engine 5 game</a> appeared first on <a href="https://couchlearn.com">Couch Learn</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://couchlearn.com/how-to-use-data-tables-in-your-unreal-engine-5-game/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to Save and Load in Unreal Engine 5</title>
		<link>https://couchlearn.com/how-to-save-and-load-in-unreal-engine-5/</link>
					<comments>https://couchlearn.com/how-to-save-and-load-in-unreal-engine-5/#comments</comments>
		
		<dc:creator><![CDATA[Matt]]></dc:creator>
		<pubDate>Thu, 22 Dec 2022 22:05:22 +0000</pubDate>
				<category><![CDATA[Medium Difficulty]]></category>
		<category><![CDATA[Unreal Engine]]></category>
		<category><![CDATA[Unreal Engine 4]]></category>
		<category><![CDATA[Unreal Engine 5]]></category>
		<category><![CDATA[medium]]></category>
		<category><![CDATA[save and load]]></category>
		<category><![CDATA[save game]]></category>
		<category><![CDATA[savegame]]></category>
		<category><![CDATA[saving and load]]></category>
		<category><![CDATA[saving and loading]]></category>
		<category><![CDATA[ue4]]></category>
		<category><![CDATA[ue4 save and load]]></category>
		<category><![CDATA[ue5]]></category>
		<category><![CDATA[ue5 save and load]]></category>
		<category><![CDATA[unreal engine]]></category>
		<category><![CDATA[unreal engine 4]]></category>
		<category><![CDATA[unreal engine 5]]></category>
		<category><![CDATA[unreal engine 5 save and load]]></category>
		<category><![CDATA[unreal engine save and load]]></category>
		<guid isPermaLink="false">https://couchlearn.com/?p=1946</guid>

					<description><![CDATA[<p>Saving and loading of game data is a essential part of every modern game. Luckily for you, Unreal Engine has a built in SaveGame system <a class="mh-excerpt-more" href="https://couchlearn.com/how-to-save-and-load-in-unreal-engine-5/" title="How to Save and Load in Unreal Engine 5">[...]</a></p>
<p>The post <a href="https://couchlearn.com/how-to-save-and-load-in-unreal-engine-5/">How to Save and Load in Unreal Engine 5</a> appeared first on <a href="https://couchlearn.com">Couch Learn</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Saving and loading of game data is a essential part of every modern game. Luckily for you, Unreal Engine has a built in SaveGame system that allows easy saving and loading of your game data to a file. All data saved to this file can be loaded easily with only a few functions!<br><br>In this guide you will learn how to Save and Load in Unreal Engine 5.</p>



<h2 class="wp-block-heading">Prerequisites</h2>



<p>To follow this guide you need to understand the basics of Unreal Engine, working with blueprints inside the editor and using a custom Game Instance. We have linked guides below to these topics.<br><a href="https://docs.unrealengine.com/4.27/en-US/ProgrammingAndScripting/Blueprints/BP_HowTo/BasicUsage/" target="_blank" rel="noreferrer noopener">The basics of blueprint actors.<br></a><a href="https://docs.unrealengine.com/4.26/en-US/ProgrammingAndScripting/Blueprints/UserGuide/Variables/" target="_blank" rel="noreferrer noopener">Adding variables to blueprint actors</a>.<br><a href="https://couchlearn.com/how-to-use-the-game-instance-in-unreal-engine-4/" target="_blank" rel="noreferrer noopener">How to use custom Game Instances.</a><br><a href="https://couchlearn.com/how-to-use-custom-events-in-unreal-engine-4/" target="_blank" rel="noreferrer noopener">Custom Events in Unreal Engine.<br></a><br>It would also be beneficial to understand how Input Actions work in Unreal Engine:<br><a href="https://couchlearn.com/how-to-use-input-actions-and-input-axis-mappings-in-your-unreal-engine-4-game/" target="_blank" rel="noreferrer noopener">Click here to learn how to use input actions and axis.</a></p>



<h2 class="wp-block-heading">How it Works</h2>



<p>SaveGame is a class in Unreal Engine that is preconfigured to save and load the data contained in the variables you add.<br><br>The variables you set are then saved to a file stored on the user&#8217;s machine. This is then read and the variables can be accessed in your game.<br><br>The save file is located in these locations:<br>Windows: Local Appdata folder<br>MacOS: Library/Application Support<br>Linux: /home/username/.local/share<br><br><strong>Almost every variable type can be saved and loaded using the SaveGame class.</strong></p>



<h2 class="wp-block-heading">Creating our Save Class</h2>



<p>Firstly, create a new blueprint class from the content drawer.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="953" height="893" src="https://couchlearn.com/wp-content/uploads/2022/12/image-22.png" alt="Creating the blueprint class from the content drawer" class="wp-image-1949" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-22.png 953w, https://couchlearn.com/wp-content/uploads/2022/12/image-22-300x281.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-22-768x720.png 768w" sizes="(max-width: 953px) 100vw, 953px" /></figure>



<p>Next, in the popup window, click the drop down arrow at the bottom. In the search bar type &#8220;SaveGame&#8221; and click the option from the list.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="626" height="555" src="https://couchlearn.com/wp-content/uploads/2022/12/image-23.png" alt="Creating the SaveGame blueprint class." class="wp-image-1950" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-23.png 626w, https://couchlearn.com/wp-content/uploads/2022/12/image-23-300x266.png 300w" sizes="(max-width: 626px) 100vw, 626px" /></figure>



<p>Then, give your new SaveGame blueprint a suitable name. We need to remember this as it is used later. In our case, we used the name DemoSaveGame.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="381" height="343" src="https://couchlearn.com/wp-content/uploads/2022/12/image-24.png" alt="Naming our SaveGame blueprint &quot;DemoSaveGame&quot;." class="wp-image-1951" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-24.png 381w, https://couchlearn.com/wp-content/uploads/2022/12/image-24-300x270.png 300w" sizes="(max-width: 381px) 100vw, 381px" /></figure>



<h3 class="wp-block-heading">Saving the variables</h3>



<p>Now that your SaveGame class has been created, you can add any variables you need for your project.<br><br>For this demo we create a new <em>Vector</em> variable called &#8220;PlayerPosition&#8221;.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="682" height="444" src="https://couchlearn.com/wp-content/uploads/2022/12/image-25.png" alt="Creating a new Vector variable named PlayerPosition in the DemoSaveGame blueprint class." class="wp-image-1952" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-25.png 682w, https://couchlearn.com/wp-content/uploads/2022/12/image-25-300x195.png 300w" sizes="(max-width: 682px) 100vw, 682px" /></figure>



<p>Once you have created the variables you need for your project, click Compile and Save to ensure your changes are applied and saved.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="387" height="237" src="https://couchlearn.com/wp-content/uploads/2022/12/image-26.png" alt="Compiling and saving the previous changes." class="wp-image-1954" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-26.png 387w, https://couchlearn.com/wp-content/uploads/2022/12/image-26-300x184.png 300w" sizes="(max-width: 387px) 100vw, 387px" /></figure>



<h2 class="wp-block-heading">Adding Save and Load Functionality</h2>



<p>Firstly, in our <strong><em><a href="http://couchlearn.com/how-to-use-the-game-instance-in-unreal-engine-4/(opens in a new tab)" target="_blank" rel="noreferrer noopener">Game Instance</a></em></strong>, add two new custom events. &#8220;Save&#8221; and &#8220;Load&#8221;.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="213" height="256" src="https://couchlearn.com/wp-content/uploads/2022/12/image-27.png" alt="Creating two new events in the Game Instance. &quot;Save&quot; and &quot;Load&quot;" class="wp-image-1958"/></figure>



<p>We also need to add a new variable on the <strong><em>Game Instance</em></strong>. Name this variable SaveGame and set the type to the class you created in the previous step.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="637" height="387" src="https://couchlearn.com/wp-content/uploads/2022/12/image-33.png" alt="Creating a variable to store the SaveGame object." class="wp-image-1968" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-33.png 637w, https://couchlearn.com/wp-content/uploads/2022/12/image-33-300x182.png 300w" sizes="(max-width: 637px) 100vw, 637px" /></figure>



<h3 class="wp-block-heading">Loading our Variables from the Save File</h3>



<p>Now that our Game Instance is setup, on the Load event, create a new &#8220;Does Save Game Exist&#8221; node. The &#8220;Slot Name&#8221; pin needs to be given a name. This can be set to anything you want. Each different name you use saves to a different file.<br><br>In our case we just named this &#8220;savegame&#8221;.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="514" height="209" src="https://couchlearn.com/wp-content/uploads/2022/12/image-29.png" alt="Creating the Does Save Game Exist node on our Load Event." class="wp-image-1962" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-29.png 514w, https://couchlearn.com/wp-content/uploads/2022/12/image-29-300x122.png 300w" sizes="(max-width: 514px) 100vw, 514px" /></figure>



<p>Next, add a branch to the output pin of the &#8220;Does Save Game Exist&#8221; node. This will branch if our save file exists or not.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="701" height="192" src="https://couchlearn.com/wp-content/uploads/2022/12/image-30.png" alt="Creating a branch node from the Does Save Game Exist node." class="wp-image-1963" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-30.png 701w, https://couchlearn.com/wp-content/uploads/2022/12/image-30-300x82.png 300w" sizes="(max-width: 701px) 100vw, 701px" /></figure>



<h4 class="wp-block-heading">If the Save File Exists</h4>



<p>From the &#8220;True&#8221; pin, create a new &#8220;Load Game From Slot&#8221; node with the same &#8220;Slot Name&#8221; as before.</p>



<figure class="wp-block-image size-full is-resized"><img decoding="async" src="https://couchlearn.com/wp-content/uploads/2022/12/image-31.png" alt="Creating the Load Game From Slot node from the Branch node." class="wp-image-1964" width="840" height="152" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-31.png 1016w, https://couchlearn.com/wp-content/uploads/2022/12/image-31-300x55.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-31-768x140.png 768w" sizes="(max-width: 840px) 100vw, 840px" /></figure>



<p>Next, from the blue output pin, create a &#8220;Cast to&#8221; node. This should cast to the class you created in the first step. For us this is &#8220;Cast to DemoSaveGame&#8221;.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="889" height="176" src="https://couchlearn.com/wp-content/uploads/2022/12/image-32.png" alt="Creating the Cast to DemoSaveGame node from the Load Game from Slot blue output pin." class="wp-image-1965" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-32.png 889w, https://couchlearn.com/wp-content/uploads/2022/12/image-32-300x59.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-32-768x152.png 768w" sizes="(max-width: 889px) 100vw, 889px" /></figure>



<p>Then set the Game Instance&#8217;s Save Game variable we created earlier to the output of the &#8220;Cast to&#8221; node.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="893" height="219" src="https://couchlearn.com/wp-content/uploads/2022/12/image-34.png" alt="Setting the SaveGame object variable to the output of the Cast to DemoSaveGame node." class="wp-image-1970" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-34.png 893w, https://couchlearn.com/wp-content/uploads/2022/12/image-34-300x74.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-34-768x188.png 768w" sizes="(max-width: 893px) 100vw, 893px" /></figure>



<p>From there, we create a &#8220;Set Actor Location&#8221; node. This will be used to move our character to the saved location.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="841" height="407" src="https://couchlearn.com/wp-content/uploads/2022/12/image-35.png" alt="Creating a Set Actor Location node from the Set Save Game node." class="wp-image-1972" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-35.png 841w, https://couchlearn.com/wp-content/uploads/2022/12/image-35-300x145.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-35-768x372.png 768w" sizes="(max-width: 841px) 100vw, 841px" /></figure>



<p>From the variables list on the left of the editor, drag the &#8220;SaveGame&#8221; variable and drop near the the nodes. This will show a list of options. Click the &#8220;Get SaveGame&#8221; option to allow us easy access to this variable for the next few steps.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="329" src="https://couchlearn.com/wp-content/uploads/2022/12/image-41-1024x329.png" alt="Creating a Get Save Game node from the SaveGame variable." class="wp-image-1980" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-41-1024x329.png 1024w, https://couchlearn.com/wp-content/uploads/2022/12/image-41-300x96.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-41-768x247.png 768w, https://couchlearn.com/wp-content/uploads/2022/12/image-41.png 1297w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Dragging from the &#8220;Save Game&#8221; blue pin then typing &#8220;get player position&#8221;, we can see our &#8220;Player Position&#8221; Vector variable that we created earlier. Click this option in the list to add it to the blueprint graph.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1013" height="329" src="https://couchlearn.com/wp-content/uploads/2022/12/image-42.png" alt="Getting the PlayerPosition variable from the SaveGame class." class="wp-image-1981" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-42.png 1013w, https://couchlearn.com/wp-content/uploads/2022/12/image-42-300x97.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-42-768x249.png 768w" sizes="(max-width: 1013px) 100vw, 1013px" /></figure>



<p>Next, connect the &#8220;Player Position&#8221; vector pin to the &#8220;New Location&#8221; option on the &#8220;Set Actor Location&#8221; node.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="940" height="291" src="https://couchlearn.com/wp-content/uploads/2022/12/image-43.png" alt="Setting the Actor Location to the Player Position value." class="wp-image-1982" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-43.png 940w, https://couchlearn.com/wp-content/uploads/2022/12/image-43-300x93.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-43-768x238.png 768w" sizes="(max-width: 940px) 100vw, 940px" /></figure>



<p>Lastly, create a &#8220;Get Player Character&#8221; node and connect this to the &#8220;Target&#8221; pin of the &#8220;Set Actor Location&#8221; node. This now gets our saved player position and moves the player character to it.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="988" height="312" src="https://couchlearn.com/wp-content/uploads/2022/12/image-44.png" alt="Creating a Get Player Character variable and assigning the output pin to the Set Actor Location Target pin." class="wp-image-1983" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-44.png 988w, https://couchlearn.com/wp-content/uploads/2022/12/image-44-300x95.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-44-768x243.png 768w" sizes="(max-width: 988px) 100vw, 988px" /></figure>



<h4 class="wp-block-heading">If the Save File doesn&#8217;t Exist</h4>



<p>If the save file does not exist then we need to create a new file. From the &#8220;False&#8221; pin create a new &#8220;Create Save Game Object&#8221; node. Then set the &#8220;Save Game Class&#8221; purple pin to the custom SaveGame class we created earlier.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="998" height="390" src="https://couchlearn.com/wp-content/uploads/2022/12/image-40.png" alt="Creating a Save Game Object from the false pin on the branch node." class="wp-image-1978" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-40.png 998w, https://couchlearn.com/wp-content/uploads/2022/12/image-40-300x117.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-40-768x300.png 768w" sizes="(max-width: 998px) 100vw, 998px" /></figure>



<p>Then, set the Game Instance &#8220;Save Game&#8221; variable to the blue output pin value.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="859" height="345" src="https://couchlearn.com/wp-content/uploads/2022/12/image-45.png" alt="Setting the SaveGame variable to the return value of the Create Save Game Object node." class="wp-image-1984" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-45.png 859w, https://couchlearn.com/wp-content/uploads/2022/12/image-45-300x120.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-45-768x308.png 768w" sizes="(max-width: 859px) 100vw, 859px" /></figure>



<p>Lastly, connect the &#8220;Set Save Game&#8221; node to the blueprint nodes above. This can be done by double clicking the white lines to create points. <br><br>Connect the blueprints nodes together as shown in the image below.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="974" height="372" src="https://couchlearn.com/wp-content/uploads/2022/12/image-46.png" alt="Cleaning the blueprints for easy reading." class="wp-image-1985" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-46.png 974w, https://couchlearn.com/wp-content/uploads/2022/12/image-46-300x115.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-46-768x293.png 768w" sizes="(max-width: 974px) 100vw, 974px" /></figure>



<h3 class="wp-block-heading">Saving our Variables to the Save File</h3>



<p>Now that we can load saved variables, we need to save the variables!<br><br>Firstly, drag and drop the SaveGame variable and click &#8220;Get SaveGame&#8221; next to the Save event.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="883" height="369" src="https://couchlearn.com/wp-content/uploads/2022/12/image-47.png" alt="Getting the value of the SaveGame variable." class="wp-image-1987" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-47.png 883w, https://couchlearn.com/wp-content/uploads/2022/12/image-47-300x125.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-47-768x321.png 768w" sizes="(max-width: 883px) 100vw, 883px" /></figure>



<p>From there, we create an &#8220;? Is Valid&#8221; node. This allows us to branch the code if our save file has been loaded or not.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="637" height="281" src="https://couchlearn.com/wp-content/uploads/2022/12/image-51.png" alt="Creating an Is Valid node connect to the SaveGame variable value." class="wp-image-1992" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-51.png 637w, https://couchlearn.com/wp-content/uploads/2022/12/image-51-300x132.png 300w" sizes="(max-width: 637px) 100vw, 637px" /></figure>



<h4 class="wp-block-heading">If the Save File is Valid</h4>



<p>From our &#8220;Save Game&#8221; blue variable, create a &#8220;Set Player Position&#8221; node and connect it to the &#8220;Is Valid&#8221; pin.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="637" height="299" src="https://couchlearn.com/wp-content/uploads/2022/12/image-52.png" alt="Setting the Player Position variable if the SaveGame object reference is valid." class="wp-image-1993" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-52.png 637w, https://couchlearn.com/wp-content/uploads/2022/12/image-52-300x141.png 300w" sizes="(max-width: 637px) 100vw, 637px" /></figure>



<p>Next, create a &#8220;Get Player Character&#8221; node and from the blue output pin, create a &#8220;Get Actor Location&#8221; pin.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="741" height="353" src="https://couchlearn.com/wp-content/uploads/2022/12/image-53.png" alt="Creating a get player character node and getting the actor location." class="wp-image-1994" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-53.png 741w, https://couchlearn.com/wp-content/uploads/2022/12/image-53-300x143.png 300w" sizes="(max-width: 741px) 100vw, 741px" /></figure>



<p>Lastly, connect the yellow output pin of the &#8220;Get Actor Location&#8221; node to the yellow input pin on the &#8220;Set Player Position&#8221; node. Now if our save game object is valid we will save the player character location to the save file on disk.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="658" height="307" src="https://couchlearn.com/wp-content/uploads/2022/12/image-54.png" alt="Connecting the Get Actor Location output value to the Set Player Position node." class="wp-image-1995" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-54.png 658w, https://couchlearn.com/wp-content/uploads/2022/12/image-54-300x140.png 300w" sizes="(max-width: 658px) 100vw, 658px" /></figure>



<h4 class="wp-block-heading">If the Save File is not Valid</h4>



<p>If the save game object isn&#8217;t valid, we need to create it before saving any data.<br><br>Firstly, create a &#8220;Create Save Game Object&#8221; node, set the purple input value to our previously created save game class, then connect this to the &#8220;Is Not Valid&#8221; pin as shown below.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="831" height="324" src="https://couchlearn.com/wp-content/uploads/2022/12/image-55.png" alt="Creating a Create Save Game Object node from the Is Not Valid pin." class="wp-image-1996" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-55.png 831w, https://couchlearn.com/wp-content/uploads/2022/12/image-55-300x117.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-55-768x299.png 768w" sizes="(max-width: 831px) 100vw, 831px" /></figure>



<p>Next, set the Game Instance SaveGame variable to the blue output pin of the &#8220;Create Save Game Object&#8221; node.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="347" src="https://couchlearn.com/wp-content/uploads/2022/12/image-56-1024x347.png" alt="Setting the Save Game value to the output of the Create Save Game Object node." class="wp-image-1997" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-56-1024x347.png 1024w, https://couchlearn.com/wp-content/uploads/2022/12/image-56-300x102.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-56-768x260.png 768w, https://couchlearn.com/wp-content/uploads/2022/12/image-56.png 1059w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Then, connect the &#8220;Set Save Game&#8221; node to the &#8220;Set Player Position&#8221; node as shown below. This will save the player character&#8217;s position after the &#8220;Save Game&#8221; object is valid.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="272" src="https://couchlearn.com/wp-content/uploads/2022/12/image-57-1024x272.png" alt="Connecting the Set SaveGame node to the other blueprints and cleaning them up." class="wp-image-1998" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-57-1024x272.png 1024w, https://couchlearn.com/wp-content/uploads/2022/12/image-57-300x80.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-57-768x204.png 768w, https://couchlearn.com/wp-content/uploads/2022/12/image-57.png 1057w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Finally, create either a &#8220;Save Game to Slot&#8221; or &#8220;Async Save Game to Slot&#8221; node from the blue SaveGame variable.<br><br><strong><em>If your game needs to save lots of information, use the &#8220;Async Save Game to Slot&#8221; node.<br></em></strong><br><strong><em>If your game only saves a small amount of data, use the &#8220;Save Game to Slot&#8221; node.</em></strong></p>



<figure class="wp-block-image size-full"><img decoding="async" width="851" height="249" src="https://couchlearn.com/wp-content/uploads/2022/12/image-62.png" alt="Creating a Save the Game to Slot node from the SaveGame variable." class="wp-image-2003" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-62.png 851w, https://couchlearn.com/wp-content/uploads/2022/12/image-62-300x88.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-62-768x225.png 768w" sizes="(max-width: 851px) 100vw, 851px" /></figure>



<p>Make sure to set the &#8220;Slot Name&#8221; variable to the name you used earlier. In our case this was &#8220;savegame&#8221;.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="637" height="303" src="https://couchlearn.com/wp-content/uploads/2022/12/image-63.png" alt="Saving the game to the savegame slot." class="wp-image-2004" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-63.png 637w, https://couchlearn.com/wp-content/uploads/2022/12/image-63-300x143.png 300w" sizes="(max-width: 637px) 100vw, 637px" /></figure>



<h2 class="wp-block-heading">Saving and Loading the Player Position</h2>



<p>Now that your Save and Load system is complete, we need to trigger this functionality.</p>



<p>In your Player Character class add an Key Press Event. For this guide we used the number 1 key from our ThirdPersonCharacterBP class.<br><br>From there, create a &#8220;Get Game Instance&#8221; node and a &#8220;Cast To&#8221; node to your custom game instance. Connect the two as shown below.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="507" height="232" src="https://couchlearn.com/wp-content/uploads/2022/12/image-58.png" alt="Casting to the GameInstance from the Number 1 Key event" class="wp-image-1999" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-58.png 507w, https://couchlearn.com/wp-content/uploads/2022/12/image-58-300x137.png 300w" sizes="(max-width: 507px) 100vw, 507px" /></figure>



<p>Next, from the blue &#8220;As Game Instance&#8221; pin, call the &#8220;Save&#8221; event we created earlier. Now when we press the number 1 key, our game will save the current player character&#8217;s position to the save file.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="935" height="279" src="https://couchlearn.com/wp-content/uploads/2022/12/image-59.png" alt="Calling the Save event from the Number 1 Key event Cast to Game Instance nodes." class="wp-image-2000" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-59.png 935w, https://couchlearn.com/wp-content/uploads/2022/12/image-59-300x90.png 300w, https://couchlearn.com/wp-content/uploads/2022/12/image-59-768x229.png 768w" sizes="(max-width: 935px) 100vw, 935px" /></figure>



<p>Repeat the previous step for the number 2 key as shown in the image below.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="515" height="223" src="https://couchlearn.com/wp-content/uploads/2022/12/image-60.png" alt="Repeating the previous nodes for the Number 2 Key event" class="wp-image-2001" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-60.png 515w, https://couchlearn.com/wp-content/uploads/2022/12/image-60-300x130.png 300w" sizes="(max-width: 515px) 100vw, 515px" /></figure>



<p>Finally, call the &#8220;Load&#8221; event from the &#8220;As Game Instance&#8221; blue pin. This will now load our saved player position from the save file and teleport our player to that position.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="737" height="223" src="https://couchlearn.com/wp-content/uploads/2022/12/image-61.png" alt="Calling the Load event from the Number 2 Key Cast to Game Instance nodes." class="wp-image-2002" srcset="https://couchlearn.com/wp-content/uploads/2022/12/image-61.png 737w, https://couchlearn.com/wp-content/uploads/2022/12/image-61-300x91.png 300w" sizes="(max-width: 737px) 100vw, 737px" /></figure>



<h2 class="wp-block-heading">Demo</h2>



<figure class="wp-block-image size-full"><img decoding="async" width="800" height="449" src="https://couchlearn.com/wp-content/uploads/2022/12/SaveAndLoadDemo.webp" alt="The player character saving and loading the location to and from the save file affecting the gameplay." class="wp-image-2006"/></figure>



<h2 class="wp-block-heading">Download the Project Files</h2>



<script src="https://gumroad.com/js/gumroad-embed.js"></script>
<div class="gumroad-product-embed"><a href="https://gumroad.com/l/jwouk">Loading&#8230;</a></div>



<h2 class="wp-block-heading">Conclusion</h2>



<p>Now your project has saving and loading capabilities!<br><br>This is a very basic implementation but allows you to expand this further. Any data you want to save and load can be implemented into the events we created during this guide. <br><br>An example of this would be the player&#8217;s health. This variable could be created on the SaveGame, saved and loaded onto the character with minimal setup.<br><br>Further Reading:<br><a href="https://docs.unrealengine.com/4.26/en-US/InteractiveExperiences/SaveGame/#:~:text=Creating%20a%20SaveGame%20Object&amp;text=When%20the%20Pick%20Parent%20Class,you%20would%20like%20to%20save." target="_blank" rel="noreferrer noopener">Official UE4/5 documentation for the Saving and Loading in the engine.</a><br><a href="https://www.tomlooman.com/unreal-engine-cpp-save-system/" target="_blank" rel="noreferrer noopener">Tom Looman&#8217;s great guide for implementing Saving and Loading for C++ classes</a></p>
<p>The post <a href="https://couchlearn.com/how-to-save-and-load-in-unreal-engine-5/">How to Save and Load in Unreal Engine 5</a> appeared first on <a href="https://couchlearn.com">Couch Learn</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://couchlearn.com/how-to-save-and-load-in-unreal-engine-5/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>How to add Double Jumping in Unreal Engine 5</title>
		<link>https://couchlearn.com/how-to-add-double-jumping-in-unreal-engine-5/</link>
					<comments>https://couchlearn.com/how-to-add-double-jumping-in-unreal-engine-5/#comments</comments>
		
		<dc:creator><![CDATA[Matt]]></dc:creator>
		<pubDate>Wed, 30 Nov 2022 23:10:54 +0000</pubDate>
				<category><![CDATA[Easy Difficulty]]></category>
		<category><![CDATA[Medium Difficulty]]></category>
		<category><![CDATA[Unreal Engine]]></category>
		<category><![CDATA[Unreal Engine 5]]></category>
		<category><![CDATA[double jumping]]></category>
		<category><![CDATA[easy]]></category>
		<category><![CDATA[easy difficulty]]></category>
		<category><![CDATA[gameplay features]]></category>
		<category><![CDATA[how to add double jumping to ue5]]></category>
		<category><![CDATA[ue5]]></category>
		<category><![CDATA[ue5 double jump]]></category>
		<category><![CDATA[unreal engine]]></category>
		<category><![CDATA[unreal engine 5]]></category>
		<category><![CDATA[unreal engine 5 double jumping]]></category>
		<category><![CDATA[unreal engine double jump]]></category>
		<category><![CDATA[unreal engine double jumping]]></category>
		<guid isPermaLink="false">https://couchlearn.com/?p=1841</guid>

					<description><![CDATA[<p>Double jumping is extremely common in retro and modern gaming. Games such as Castlevania Symphony of the Night, Crash Bandicoot, the Kirby&#160;series, Banjo-Kazooie, and more <a class="mh-excerpt-more" href="https://couchlearn.com/how-to-add-double-jumping-in-unreal-engine-5/" title="How to add Double Jumping in Unreal Engine 5">[...]</a></p>
<p>The post <a href="https://couchlearn.com/how-to-add-double-jumping-in-unreal-engine-5/">How to add Double Jumping in Unreal Engine 5</a> appeared first on <a href="https://couchlearn.com">Couch Learn</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Double jumping is extremely common in retro and modern gaming. Games such as Castlevania Symphony of the Night, Crash Bandicoot, the Kirby&nbsp;series, Banjo-Kazooie, and more have platforming elements that require the use of the double jump to complete. <br><br><strong>Luckily, Unreal Engine 5 makes this incredibly easy to achieve!<br></strong><br>In this guide we will be showing you how to add Double Jumping in Unreal Engine 5.<br><br><strong>We will also be showing some intermediate difficulty animation improvements that you can make to your project to make the animations feel better during the double jump!</strong></p>



<h2 class="wp-block-heading">Before we Start</h2>



<p>To make this guide easier to understand for new developers, we are using the Unreal Engine 5 Third Person template which is found in the New Project window.<br><br>If you already have your project setup with a Character blueprint, skip to the &#8220;Adding our Double Jump&#8221; section below.</p>



<h3 class="wp-block-heading">Creating our template project</h3>



<p>Firstly, we want to click Third Person, choose a project location on your computer in the bottom left, then give the project a name in the bottom right. Once this is done, click the blue &#8220;Create&#8221; button in the bottom right of the window.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="662" src="https://couchlearn.com/wp-content/uploads/2022/11/image-20-1024x662.png" alt="Creating a new Third Person project" class="wp-image-1843" srcset="https://couchlearn.com/wp-content/uploads/2022/11/image-20-1024x662.png 1024w, https://couchlearn.com/wp-content/uploads/2022/11/image-20-300x194.png 300w, https://couchlearn.com/wp-content/uploads/2022/11/image-20-768x496.png 768w, https://couchlearn.com/wp-content/uploads/2022/11/image-20.png 1196w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Once the Unreal Engine editor has opened your new project, open the &#8220;Content Drawer&#8221; in the bottom left of the editor and find the BP_ThirdPersonCharacter object in the Content/ThirdPerson/Blueprints folder.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="903" height="1024" src="https://couchlearn.com/wp-content/uploads/2022/11/image-22-903x1024.png" alt="Opening the Third Person character asset in the Unreal Engine 5 editor's content drawer" class="wp-image-1845" srcset="https://couchlearn.com/wp-content/uploads/2022/11/image-22-903x1024.png 903w, https://couchlearn.com/wp-content/uploads/2022/11/image-22-264x300.png 264w, https://couchlearn.com/wp-content/uploads/2022/11/image-22-768x871.png 768w, https://couchlearn.com/wp-content/uploads/2022/11/image-22.png 922w" sizes="(max-width: 903px) 100vw, 903px" /></figure>



<h2 class="wp-block-heading">Adding our Double Jump</h2>



<p>The first step to add double jump functionality is to open our Character blueprint and select the name.<br><br>In our case this is the text labelled &#8220;BP_ThirdPersonCharacter (Self)&#8221;. Once this is selected the text will go blue as shown below.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1007" height="711" src="https://couchlearn.com/wp-content/uploads/2022/11/image-23.png" alt="Selecting the blueprint class in the blueprint editor" class="wp-image-1846" srcset="https://couchlearn.com/wp-content/uploads/2022/11/image-23.png 1007w, https://couchlearn.com/wp-content/uploads/2022/11/image-23-300x212.png 300w, https://couchlearn.com/wp-content/uploads/2022/11/image-23-768x542.png 768w" sizes="(max-width: 1007px) 100vw, 1007px" /></figure>



<p>On the right side of the blueprint editor you will find the &#8220;Details&#8221; tab. Look through the details tab until you find &#8220;Character&#8221; and the &#8220;Jump Max Count&#8221;. This value is set to 1 by default.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1003" height="651" src="https://couchlearn.com/wp-content/uploads/2022/11/image-24.png" alt="Finding the character and jump parameters in the blueprint editor" class="wp-image-1847" srcset="https://couchlearn.com/wp-content/uploads/2022/11/image-24.png 1003w, https://couchlearn.com/wp-content/uploads/2022/11/image-24-300x195.png 300w, https://couchlearn.com/wp-content/uploads/2022/11/image-24-768x498.png 768w" sizes="(max-width: 1003px) 100vw, 1003px" /></figure>



<p>Now as we want to have our character double jump, change this value to 2. If you require more than 2 jumps for your character, change this value to whichever suits your needs.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="689" height="321" src="https://couchlearn.com/wp-content/uploads/2022/11/image-25.png" alt="Change the Jump Max Count from 1 to 2" class="wp-image-1848" srcset="https://couchlearn.com/wp-content/uploads/2022/11/image-25.png 689w, https://couchlearn.com/wp-content/uploads/2022/11/image-25-300x140.png 300w" sizes="(max-width: 689px) 100vw, 689px" /></figure>



<p>Once this is done, remember to click the &#8220;Compile&#8221; and &#8220;Save&#8221; buttons in the top left of the blueprint editor.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="518" height="254" src="https://couchlearn.com/wp-content/uploads/2022/11/image-26.png" alt="Compiling and saving the blueprint class" class="wp-image-1849" srcset="https://couchlearn.com/wp-content/uploads/2022/11/image-26.png 518w, https://couchlearn.com/wp-content/uploads/2022/11/image-26-300x147.png 300w" sizes="(max-width: 518px) 100vw, 518px" /></figure>



<h3 class="wp-block-heading">Simple Double Jump Demo</h3>



<p>Your character is now able to double jump! As you can see in the demo video below the character is double jumping successfully.<br><br>However, one problem you can see is the animation only plays once. In the next section we will be fixing the animations so they play correctly for all jumps. </p>



<figure class="wp-block-video"><video autoplay loop muted src="https://couchlearn.com/wp-content/uploads/2022/11/DoubleJumpSimple.mp4"></video></figure>



<h2 class="wp-block-heading">Animation Improvements (Intermediate Difficulty)</h2>



<p>As the double jump doesn&#8217;t look right in the previous demo, we now are fixing the animations.<br><br>Firstly, open the &#8220;Content Drawer&#8221; and find the ABP_Manny object in the Content/Characters/Mannequins/Animations folder.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="782" src="https://couchlearn.com/wp-content/uploads/2022/11/image-27-1024x782.png" alt="Finding and opening the ABP_Manny animation blueprint file" class="wp-image-1852" srcset="https://couchlearn.com/wp-content/uploads/2022/11/image-27-1024x782.png 1024w, https://couchlearn.com/wp-content/uploads/2022/11/image-27-300x229.png 300w, https://couchlearn.com/wp-content/uploads/2022/11/image-27-768x587.png 768w, https://couchlearn.com/wp-content/uploads/2022/11/image-27-80x60.png 80w, https://couchlearn.com/wp-content/uploads/2022/11/image-27.png 1364w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Now the animation blueprint editor is open, find and double click the AnimGraph text in the left of the editor window.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="789" height="837" src="https://couchlearn.com/wp-content/uploads/2022/11/image-28.png" alt="Opening the animation blueprint's anim graph" class="wp-image-1853" srcset="https://couchlearn.com/wp-content/uploads/2022/11/image-28.png 789w, https://couchlearn.com/wp-content/uploads/2022/11/image-28-283x300.png 283w, https://couchlearn.com/wp-content/uploads/2022/11/image-28-768x815.png 768w" sizes="(max-width: 789px) 100vw, 789px" /></figure>



<p>Next, with the animation graph now open, click the &#8220;Main States&#8221; state machine. This is where all of the animation transitions are held for our character.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="590" src="https://couchlearn.com/wp-content/uploads/2022/11/image-29-1024x590.png" alt="Opening the Main States state machine" class="wp-image-1854" srcset="https://couchlearn.com/wp-content/uploads/2022/11/image-29-1024x590.png 1024w, https://couchlearn.com/wp-content/uploads/2022/11/image-29-300x173.png 300w, https://couchlearn.com/wp-content/uploads/2022/11/image-29-768x442.png 768w, https://couchlearn.com/wp-content/uploads/2022/11/image-29.png 1426w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Inside the Main States state machine, drag from the state named &#8220;Fall Loop&#8221; to the state named &#8220;Jump&#8221; as shown in the image below. If done correctly you should see an arrow and text stating &#8220;Create a transition&#8221;.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="415" src="https://couchlearn.com/wp-content/uploads/2022/11/image-30-1024x415.png" alt="Creating a new transition between fall loop and jump states" class="wp-image-1856" srcset="https://couchlearn.com/wp-content/uploads/2022/11/image-30-1024x415.png 1024w, https://couchlearn.com/wp-content/uploads/2022/11/image-30-300x122.png 300w, https://couchlearn.com/wp-content/uploads/2022/11/image-30-768x311.png 768w, https://couchlearn.com/wp-content/uploads/2022/11/image-30.png 1493w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>With our transition now created, click the icon to open the transition editor.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="435" src="https://couchlearn.com/wp-content/uploads/2022/11/image-31-1024x435.png" alt="Opening the newly created animation state transition" class="wp-image-1857" srcset="https://couchlearn.com/wp-content/uploads/2022/11/image-31-1024x435.png 1024w, https://couchlearn.com/wp-content/uploads/2022/11/image-31-300x128.png 300w, https://couchlearn.com/wp-content/uploads/2022/11/image-31-768x327.png 768w, https://couchlearn.com/wp-content/uploads/2022/11/image-31-1030x438.png 1030w, https://couchlearn.com/wp-content/uploads/2022/11/image-31.png 1385w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Finally, in the transition editor add the blueprint nodes shown in the example image below.<br><br><strong>These nodes allow the animation state to return back to the jumping animation once you trigger the double jump.</strong></p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="561" src="https://couchlearn.com/wp-content/uploads/2022/11/image-32-1024x561.png" alt="Adding the required blueprint nodes to transition back to jump when double jumping" class="wp-image-1858" srcset="https://couchlearn.com/wp-content/uploads/2022/11/image-32-1024x561.png 1024w, https://couchlearn.com/wp-content/uploads/2022/11/image-32-300x164.png 300w, https://couchlearn.com/wp-content/uploads/2022/11/image-32-768x421.png 768w, https://couchlearn.com/wp-content/uploads/2022/11/image-32.png 1271w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<h3 class="wp-block-heading">Advanced Animated Double Jump Demo</h3>



<p>Your improved double jump is now<strong> complete</strong>! As you can see in the video below, the animations are much better and the player now gets visual feedback when they double jump.</p>



<figure class="wp-block-video"><video autoplay loop muted src="https://couchlearn.com/wp-content/uploads/2022/11/DoubleJumpAdvanced.mp4"></video></figure>



<h2 class="wp-block-heading">Download the Project Files</h2>



<script src="https://gumroad.com/js/gumroad-embed.js"></script>
<div class="gumroad-product-embed"><a href="https://gumroad.com/l/uaahv">Loading&#8230;</a></div>



<h2 class="wp-block-heading">Conclusion</h2>



<p>Your Unreal Engine 5 project now has a double jump capable character! For a challenge, do try to follow the optional animation improvement steps as it really make a difference to the experience!</p>



<p>Further Reading:<br><a href="https://docs.unrealengine.com/5.0/en-US/setting-up-a-character-in-unreal-engine/" target="_blank" rel="noreferrer noopener">Official blueprint guide to setting up a new character mesh in UE5<br></a><a href="https://docs.unrealengine.com/4.26/en-US/API/Runtime/Engine/GameFramework/ACharacter/" target="_blank" rel="noreferrer noopener">Full ACharacter documentation for advanced jump settings in C++</a></p>
<p>The post <a href="https://couchlearn.com/how-to-add-double-jumping-in-unreal-engine-5/">How to add Double Jumping in Unreal Engine 5</a> appeared first on <a href="https://couchlearn.com">Couch Learn</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://couchlearn.com/how-to-add-double-jumping-in-unreal-engine-5/feed/</wfw:commentRss>
			<slash:comments>6</slash:comments>
		
		<enclosure url="https://couchlearn.com/wp-content/uploads/2022/11/DoubleJumpSimple.mp4" length="806447" type="video/mp4" />
<enclosure url="https://couchlearn.com/wp-content/uploads/2022/11/DoubleJumpAdvanced.mp4" length="855661" type="video/mp4" />

			</item>
		<item>
		<title>How to use Multiplayer Sessions in Unreal Engine 5</title>
		<link>https://couchlearn.com/how-to-use-multiplayer-sessions-in-unreal-engine-5/</link>
					<comments>https://couchlearn.com/how-to-use-multiplayer-sessions-in-unreal-engine-5/#comments</comments>
		
		<dc:creator><![CDATA[Matt]]></dc:creator>
		<pubDate>Sun, 14 Aug 2022 21:53:18 +0000</pubDate>
				<category><![CDATA[Medium Difficulty]]></category>
		<category><![CDATA[Multiplayer]]></category>
		<category><![CDATA[Unreal Engine]]></category>
		<category><![CDATA[Unreal Engine 5]]></category>
		<category><![CDATA[multiplayer sessions]]></category>
		<category><![CDATA[ue5]]></category>
		<category><![CDATA[ue5 multiplayer]]></category>
		<category><![CDATA[ue5 sessions]]></category>
		<category><![CDATA[unreal engine]]></category>
		<category><![CDATA[unreal engine 5]]></category>
		<category><![CDATA[unreal engine 5 multiplayer]]></category>
		<category><![CDATA[unreal engine 5 sessions]]></category>
		<guid isPermaLink="false">https://couchlearn.com/?p=1684</guid>

					<description><![CDATA[<p>Utilizing Multiplayer Sessions in Unreal Engine 5 allows customization of your multiplayer session settings such as player limits, public, and private slots. You also get <a class="mh-excerpt-more" href="https://couchlearn.com/how-to-use-multiplayer-sessions-in-unreal-engine-5/" title="How to use Multiplayer Sessions in Unreal Engine 5">[...]</a></p>
<p>The post <a href="https://couchlearn.com/how-to-use-multiplayer-sessions-in-unreal-engine-5/">How to use Multiplayer Sessions in Unreal Engine 5</a> appeared first on <a href="https://couchlearn.com">Couch Learn</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Utilizing Multiplayer Sessions in Unreal Engine 5 allows customization of your multiplayer session settings such as player limits, public, and private slots. You also get access to the server browser to view all the active game sessions.<br><br>Unreal Engine 5 has many built in blueprint nodes to make this process really easy!<br><br>In this guide we will be setting up a basic multiplayer game using sessions in Unreal Engine 5. Players will be able to setup a session that others can join through a menu.</p>



<h3 class="wp-block-heading">Online and LAN Support</h3>



<p>Unreal Engine 5&#8217;s NULL online subsystem can not find sessions outside of the player&#8217;s local network.<br><br>To find and connect to sessions outside of your local network without a direct IP address connection you <strong>need to use a different online subsystem</strong> such as <strong>Steam</strong>.<br><br><a href="https://docs.unrealengine.com/en-US/Programming/Online/Steam/index.html"><em>Click here to read the documentation for the Steam subsystem</em></a></p>



<h2 class="wp-block-heading">Creating our Widget</h2>



<h3 class="wp-block-heading">Creating the Widget Blueprint</h3>



<p>To allow our players to create their own sessions and join others we need to create buttons and text on screen. In Unreal Engine 5 this is called a user interface <strong>widget</strong>.</p>



<p>Firstly, right click in the content drawer and create a Widget Blueprint</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="824" src="https://couchlearn.com/wp-content/uploads/2022/08/image-17-1024x824.png" alt="Creating the sessions widget blueprint" class="wp-image-1689" srcset="https://couchlearn.com/wp-content/uploads/2022/08/image-17-1024x824.png 1024w, https://couchlearn.com/wp-content/uploads/2022/08/image-17-300x241.png 300w, https://couchlearn.com/wp-content/uploads/2022/08/image-17-768x618.png 768w, https://couchlearn.com/wp-content/uploads/2022/08/image-17.png 1176w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Click &#8220;User Widget&#8221; in the menu that pops up.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="777" height="289" src="https://couchlearn.com/wp-content/uploads/2022/08/image-18.png" alt="Creating the widget from the user widget base blueprint" class="wp-image-1690" srcset="https://couchlearn.com/wp-content/uploads/2022/08/image-18.png 777w, https://couchlearn.com/wp-content/uploads/2022/08/image-18-300x112.png 300w, https://couchlearn.com/wp-content/uploads/2022/08/image-18-768x286.png 768w" sizes="(max-width: 777px) 100vw, 777px" /></figure>



<p>Now we have to name our widget blueprint. For this guide we named the blueprint &#8220;Session Widget&#8221;. You can name your widget blueprint anything you like but make sure to remember the name for a later step!</p>



<figure class="wp-block-image size-full"><img decoding="async" width="599" height="271" src="https://couchlearn.com/wp-content/uploads/2022/08/image-19.png" alt="Naming our widget Session Widget" class="wp-image-1691" srcset="https://couchlearn.com/wp-content/uploads/2022/08/image-19.png 599w, https://couchlearn.com/wp-content/uploads/2022/08/image-19-300x136.png 300w" sizes="(max-width: 599px) 100vw, 599px" /></figure>



<p>Finally, double click your widget blueprint and you will see the Widget Designer window.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="549" src="https://couchlearn.com/wp-content/uploads/2022/08/image-20-1024x549.png" alt="Blueprint Designer window" class="wp-image-1692" srcset="https://couchlearn.com/wp-content/uploads/2022/08/image-20-1024x549.png 1024w, https://couchlearn.com/wp-content/uploads/2022/08/image-20-300x161.png 300w, https://couchlearn.com/wp-content/uploads/2022/08/image-20-768x412.png 768w, https://couchlearn.com/wp-content/uploads/2022/08/image-20-1536x824.png 1536w, https://couchlearn.com/wp-content/uploads/2022/08/image-20.png 1893w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<h3 class="wp-block-heading">Designing our Widget</h3>



<p>When designing widgets, you can find all available widget elements in the left side Palette menu.<br><br>To start designing your session widget, simply search for Canvas Panel and drag it into the middle section of the window.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="354" height="276" src="https://couchlearn.com/wp-content/uploads/2022/08/image-21.png" alt="Adding the canvas panel" class="wp-image-1693" srcset="https://couchlearn.com/wp-content/uploads/2022/08/image-21.png 354w, https://couchlearn.com/wp-content/uploads/2022/08/image-21-300x234.png 300w" sizes="(max-width: 354px) 100vw, 354px" /></figure>



<p>Next, search for Vertical Box and drag it into the middle section of the window. These layout elements will be the main structure of your widget.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="322" height="224" src="https://couchlearn.com/wp-content/uploads/2022/08/image-22.png" alt="Adding the vertical box" class="wp-image-1694" srcset="https://couchlearn.com/wp-content/uploads/2022/08/image-22.png 322w, https://couchlearn.com/wp-content/uploads/2022/08/image-22-300x209.png 300w" sizes="(max-width: 322px) 100vw, 322px" /></figure>



<p>From there find the details panel on the right side of the window. Click Anchors and select the center box option shown in the image below.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="479" height="525" src="https://couchlearn.com/wp-content/uploads/2022/08/image-23.png" alt="Setting the widget anchor to center" class="wp-image-1695" srcset="https://couchlearn.com/wp-content/uploads/2022/08/image-23.png 479w, https://couchlearn.com/wp-content/uploads/2022/08/image-23-274x300.png 274w" sizes="(max-width: 479px) 100vw, 479px" /></figure>



<p>After setting the anchors correctly we can begin to set the size and position of our widget.<br><br>Below the anchors drop down, set Position X, Position Y, Size X, and Size Y to the values shown in the image below.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="463" height="307" src="https://couchlearn.com/wp-content/uploads/2022/08/image-24.png" alt="Setting the position and size" class="wp-image-1696" srcset="https://couchlearn.com/wp-content/uploads/2022/08/image-24.png 463w, https://couchlearn.com/wp-content/uploads/2022/08/image-24-300x199.png 300w" sizes="(max-width: 463px) 100vw, 463px" /></figure>



<p>Now, in the Palette menu, create two buttons. These will be interactable by the user to create and join multiplayer game sessions.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="291" height="151" src="https://couchlearn.com/wp-content/uploads/2022/08/image-25.png" alt="Adding two buttons" class="wp-image-1697"/></figure>



<p>So we can access the buttons in the next step, click the first button and change the name in the details panel to CreateSession. </p>



<figure class="wp-block-image size-full"><img decoding="async" width="326" height="68" src="https://couchlearn.com/wp-content/uploads/2022/08/image-26.png" alt="Naming the Create session button" class="wp-image-1698" srcset="https://couchlearn.com/wp-content/uploads/2022/08/image-26.png 326w, https://couchlearn.com/wp-content/uploads/2022/08/image-26-300x63.png 300w" sizes="(max-width: 326px) 100vw, 326px" /></figure>



<p>Repeat this for the next button and name it JoinSession.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="330" height="76" src="https://couchlearn.com/wp-content/uploads/2022/08/image-27.png" alt="Naming the Join session button" class="wp-image-1699" srcset="https://couchlearn.com/wp-content/uploads/2022/08/image-27.png 330w, https://couchlearn.com/wp-content/uploads/2022/08/image-27-300x69.png 300w, https://couchlearn.com/wp-content/uploads/2022/08/image-27-326x76.png 326w" sizes="(max-width: 330px) 100vw, 330px" /></figure>



<p>To show to the user which button is used for creating and joining we need to add text to the buttons.<br><br>In the Palette menu search Text and drag the text onto the button. As you can see the text appears on the button and automatically resizes it so it fits well.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="491" height="309" src="https://couchlearn.com/wp-content/uploads/2022/08/dragtexttobutton.gif" alt="Adding text to the buttons" class="wp-image-1701"/></figure>



<p>After creating one text element for each button, change the Text value for each Text element in the right side Details panel.<br><br>Set the top button to Create Session and the second button to Join Session.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="476" height="371" src="https://couchlearn.com/wp-content/uploads/2022/08/image-56.png" alt="Setting the Text value" class="wp-image-1731" srcset="https://couchlearn.com/wp-content/uploads/2022/08/image-56.png 476w, https://couchlearn.com/wp-content/uploads/2022/08/image-56-300x234.png 300w" sizes="(max-width: 476px) 100vw, 476px" /></figure>



<p>Now to improve the design of our buttons, select both buttons and in the right side Details panel set Padding to 15 and click Fill.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="468" height="259" src="https://couchlearn.com/wp-content/uploads/2022/08/image-30.png" alt="Setting the padding and fill" class="wp-image-1703" srcset="https://couchlearn.com/wp-content/uploads/2022/08/image-30.png 468w, https://couchlearn.com/wp-content/uploads/2022/08/image-30-300x166.png 300w" sizes="(max-width: 468px) 100vw, 468px" /></figure>



<p>Now our widget buttons are neatly arranged and easy for the players to use.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="410" height="529" src="https://couchlearn.com/wp-content/uploads/2022/08/image-31.png" alt="Two buttons in the correct layout" class="wp-image-1704" srcset="https://couchlearn.com/wp-content/uploads/2022/08/image-31.png 410w, https://couchlearn.com/wp-content/uploads/2022/08/image-31-233x300.png 233w" sizes="(max-width: 410px) 100vw, 410px" /></figure>



<p>Once you are done customizing your widget, click Compile and Save to ensure your changes are applied.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="430" height="243" src="https://couchlearn.com/wp-content/uploads/2022/08/image-32.png" alt="Compile and saving the widget" class="wp-image-1705" srcset="https://couchlearn.com/wp-content/uploads/2022/08/image-32.png 430w, https://couchlearn.com/wp-content/uploads/2022/08/image-32-300x170.png 300w" sizes="(max-width: 430px) 100vw, 430px" /></figure>



<p>Finally, click the Graph button on the top right side. This will switch the Widget Designer to the Widget Blueprint editor ready to give functionality to your widget!</p>



<figure class="wp-block-image size-full"><img decoding="async" width="306" height="204" src="https://couchlearn.com/wp-content/uploads/2022/08/image-33.png" alt="Switching to the widget blueprint graph" class="wp-image-1706" srcset="https://couchlearn.com/wp-content/uploads/2022/08/image-33.png 306w, https://couchlearn.com/wp-content/uploads/2022/08/image-33-300x200.png 300w" sizes="(max-width: 306px) 100vw, 306px" /></figure>



<h2 class="wp-block-heading">Hosting and Joining a Multiplayer Session</h2>



<h3 class="wp-block-heading">Creating and Hosting our Game Session</h3>



<p>Now that we are in the Widget Blueprint editor, you should see your two buttons in the Variables section on the left.<br><br>Click the first button in the list.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="347" height="390" src="https://couchlearn.com/wp-content/uploads/2022/08/image-34.png" alt="Selecting the CreateSession button" class="wp-image-1707" srcset="https://couchlearn.com/wp-content/uploads/2022/08/image-34.png 347w, https://couchlearn.com/wp-content/uploads/2022/08/image-34-267x300.png 267w" sizes="(max-width: 347px) 100vw, 347px" /></figure>



<p>Below you should now see a Details menu with all of the events available to your button.<br><br>We need On Clicked so click the big green box with the plus icon inside to add this event.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="343" height="412" src="https://couchlearn.com/wp-content/uploads/2022/08/image-35.png" alt="Adding the On Clicked button event" class="wp-image-1708" srcset="https://couchlearn.com/wp-content/uploads/2022/08/image-35.png 343w, https://couchlearn.com/wp-content/uploads/2022/08/image-35-250x300.png 250w" sizes="(max-width: 343px) 100vw, 343px" /></figure>



<p>You should now see the On Clicked event for your button in the middle editor window.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="303" height="124" src="https://couchlearn.com/wp-content/uploads/2022/08/image-36.png" alt="On Clicked button event" class="wp-image-1709" srcset="https://couchlearn.com/wp-content/uploads/2022/08/image-36.png 303w, https://couchlearn.com/wp-content/uploads/2022/08/image-36-300x123.png 300w" sizes="(max-width: 303px) 100vw, 303px" /></figure>



<p>Right click anywhere and type Create Session. Click the option in the menu that shows Create Session.<br><br>Now connect the nodes together using the white arrows as shown below.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="584" height="206" src="https://couchlearn.com/wp-content/uploads/2022/08/image-37.png" alt="Creating the session node" class="wp-image-1710" srcset="https://couchlearn.com/wp-content/uploads/2022/08/image-37.png 584w, https://couchlearn.com/wp-content/uploads/2022/08/image-37-300x106.png 300w" sizes="(max-width: 584px) 100vw, 584px" /></figure>



<p>Right click anywhere and type Get Player Controller. Click the option in the menu and connect this to the blue pin. <br><br>After the blue pin is connected, set the Public Connections number to the maximum amount of players you want per game session.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="624" height="222" src="https://couchlearn.com/wp-content/uploads/2022/08/image-38.png" alt="Connecting the player controller and setting the maximum connections to the server" class="wp-image-1711" srcset="https://couchlearn.com/wp-content/uploads/2022/08/image-38.png 624w, https://couchlearn.com/wp-content/uploads/2022/08/image-38-300x107.png 300w" sizes="(max-width: 624px) 100vw, 624px" /><figcaption><strong><em>If “Use Lan” is checked the session you create will be only available on your local internet.</em></strong></figcaption></figure>



<h3 class="wp-block-heading">Opening Levels to Multiplayer</h3>



<p>Right click anywhere, type and select the Open Level option and connect this node to the On Success pin.<br><br>To create a multiplayer game using your level, set the “Level Name” pin to the level you wish to play on. In our case, this is FirstPersonExampleMap.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="984" height="218" src="https://couchlearn.com/wp-content/uploads/2022/08/image-39.png" alt="Opening the level the server will use for gameplay" class="wp-image-1712" srcset="https://couchlearn.com/wp-content/uploads/2022/08/image-39.png 984w, https://couchlearn.com/wp-content/uploads/2022/08/image-39-300x66.png 300w, https://couchlearn.com/wp-content/uploads/2022/08/image-39-768x170.png 768w" sizes="(max-width: 984px) 100vw, 984px" /></figure>



<p>Lastly, click the drop down arrow and into the Options text box type:</p>



<pre class="wp-block-code"><code>?listen</code></pre>



<p>With these steps complete, the code should look like this.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="857" height="230" src="https://couchlearn.com/wp-content/uploads/2022/08/image-40.png" alt="Configuring the level as a listen server" class="wp-image-1713" srcset="https://couchlearn.com/wp-content/uploads/2022/08/image-40.png 857w, https://couchlearn.com/wp-content/uploads/2022/08/image-40-300x81.png 300w, https://couchlearn.com/wp-content/uploads/2022/08/image-40-768x206.png 768w" sizes="(max-width: 857px) 100vw, 857px" /></figure>



<p>This code sets the level up to listen for multiplayer connections as a Listen Server.</p>



<h2 class="wp-block-heading">Connecting to your Multiplayer Session</h2>



<h3 class="wp-block-heading">Finding Sessions</h3>



<p>Finding multiplayer sessions using Unreal Engine 5 blueprints is incredibly simple. <br><br>The Find Sessions node searches and finds the active game sessions for your players to join. It outputs different execution pins based on if it succeeded or failed. The session results are returned as an array.</p>



<p>If you aren’t familiar with arrays <a href="https://couchlearn.com/how-to-use-loops-and-arrays-unreal-engine-4/">click here to learn about arrays in Unreal Engine.</a></p>



<p>Firstly, we need to create the On Clicked button event for our JoinSession button, as we did in the previous step.<br><br>From there, right click and create the Find Sessions and Get Player Controller nodes. Connect this node to the On Clicked event, connect the Get Player Controller node to the blue pin, and set Max Results to 100.<br><br>Max results is the amount of sessions it will try to find.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="567" height="190" src="https://couchlearn.com/wp-content/uploads/2022/08/image-41.png" alt="Adding the find sessions node" class="wp-image-1714" srcset="https://couchlearn.com/wp-content/uploads/2022/08/image-41.png 567w, https://couchlearn.com/wp-content/uploads/2022/08/image-41-300x101.png 300w" sizes="(max-width: 567px) 100vw, 567px" /></figure>



<h3 class="wp-block-heading">Joining the Session</h3>



<p>Next, we need to create the Join session node and another Get Player Controller node. We could reuse the previous node but it makes the blueprints easier to read.<br><br>The Join Session node should be connected to the On Success pin on the Find Session node.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="871" height="233" src="https://couchlearn.com/wp-content/uploads/2022/08/image-42.png" alt="Adding and connecting the join session node" class="wp-image-1715" srcset="https://couchlearn.com/wp-content/uploads/2022/08/image-42.png 871w, https://couchlearn.com/wp-content/uploads/2022/08/image-42-300x80.png 300w, https://couchlearn.com/wp-content/uploads/2022/08/image-42-768x205.png 768w" sizes="(max-width: 871px) 100vw, 871px" /></figure>



<p>From the Results square pin, drag and let go to open the blueprint node menu. We can then type get and create a Get (a copy) node. </p>



<figure class="wp-block-image size-full"><img decoding="async" width="744" height="466" src="https://couchlearn.com/wp-content/uploads/2022/08/image-43.png" alt="Getting an array element from the Results array" class="wp-image-1716" srcset="https://couchlearn.com/wp-content/uploads/2022/08/image-43.png 744w, https://couchlearn.com/wp-content/uploads/2022/08/image-43-300x188.png 300w" sizes="(max-width: 744px) 100vw, 744px" /></figure>



<p>Finally, connect the Dark blue pin of the Get node and connect this to the Search Result input node.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="862" height="333" src="https://couchlearn.com/wp-content/uploads/2022/08/image-44.png" alt="Connecting the result array element to the join session node" class="wp-image-1717" srcset="https://couchlearn.com/wp-content/uploads/2022/08/image-44.png 862w, https://couchlearn.com/wp-content/uploads/2022/08/image-44-300x116.png 300w, https://couchlearn.com/wp-content/uploads/2022/08/image-44-768x297.png 768w" sizes="(max-width: 862px) 100vw, 862px" /><figcaption>Your hosting and joining blueprints are now complete!</figcaption></figure>



<h3 class="wp-block-heading">Adding our Widget to the Screen</h3>



<p>To make our widget show on the screen, firstly click the branch icon in the main editor window shown below.<br><br>In the drop down menu click Open Level Blueprint to open the Level Blueprint Editor.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="928" height="448" src="https://couchlearn.com/wp-content/uploads/2022/08/image-46.png" alt="Opening the level blueprint editor" class="wp-image-1719" srcset="https://couchlearn.com/wp-content/uploads/2022/08/image-46.png 928w, https://couchlearn.com/wp-content/uploads/2022/08/image-46-300x145.png 300w, https://couchlearn.com/wp-content/uploads/2022/08/image-46-768x371.png 768w" sizes="(max-width: 928px) 100vw, 928px" /></figure>



<p>Right click anywhere and create the Event Begin Play and Create Widget blueprint nodes.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="410" height="114" src="https://couchlearn.com/wp-content/uploads/2022/08/image-49.png" alt="Creating the create widget node" class="wp-image-1722" srcset="https://couchlearn.com/wp-content/uploads/2022/08/image-49.png 410w, https://couchlearn.com/wp-content/uploads/2022/08/image-49-300x83.png 300w" sizes="(max-width: 410px) 100vw, 410px" /></figure>



<p>Connect the white pins together and select your widget in the Class drop down box.<br><br>In our case we named the widget SessionWidget to make it easy to find in the drop down box.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="621" height="313" src="https://couchlearn.com/wp-content/uploads/2022/08/image-48.png" alt="Setting the widget class to spawn to SessionWidget created earlier" class="wp-image-1721" srcset="https://couchlearn.com/wp-content/uploads/2022/08/image-48.png 621w, https://couchlearn.com/wp-content/uploads/2022/08/image-48-300x151.png 300w" sizes="(max-width: 621px) 100vw, 621px" /></figure>



<p>Lastly, create an Add to Viewport blueprint node and connect the blue pins together. This will create our widget and then add to the game screen.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="755" height="194" src="https://couchlearn.com/wp-content/uploads/2022/08/image-50.png" alt="Adding the newly spawned widget to the game viewport" class="wp-image-1723" srcset="https://couchlearn.com/wp-content/uploads/2022/08/image-50.png 755w, https://couchlearn.com/wp-content/uploads/2022/08/image-50-300x77.png 300w" sizes="(max-width: 755px) 100vw, 755px" /></figure>



<p>The final level blueprint should look like this.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="751" height="206" src="https://couchlearn.com/wp-content/uploads/2022/08/image-51.png" alt="Finished level blueprint" class="wp-image-1724" srcset="https://couchlearn.com/wp-content/uploads/2022/08/image-51.png 751w, https://couchlearn.com/wp-content/uploads/2022/08/image-51-300x82.png 300w" sizes="(max-width: 751px) 100vw, 751px" /></figure>



<h3 class="wp-block-heading">Opening the Game Clients</h3>



<p>For the last step we need to test our blueprint logic!<br><br>Unreal Engine 5 makes testing multiplayer in the editor extremely simple.<br><br>First, click the three dot button and, in the drop down menu, set Number of Players to 2. After that click New Editor Window to launch two windows of your game.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="801" height="533" src="https://couchlearn.com/wp-content/uploads/2022/08/image-55.png" alt="Opening two game clients in the Unreal Engine 5 editor" class="wp-image-1728" srcset="https://couchlearn.com/wp-content/uploads/2022/08/image-55.png 801w, https://couchlearn.com/wp-content/uploads/2022/08/image-55-300x200.png 300w, https://couchlearn.com/wp-content/uploads/2022/08/image-55-768x511.png 768w" sizes="(max-width: 801px) 100vw, 801px" /></figure>



<p>Once the two clients have loaded, click Create Session on one and Join Session on the other. After a short amount of time they will connect together in a multiplayer session!<br><br>As you can see in the demo below, the players can move around and see each other moving without any additional work! The template character in Unreal Engine 5 have multiplayer movement support out of the box.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="696" height="369" src="https://couchlearn.com/wp-content/uploads/2022/08/multiplayersessionsue5.gif" alt="Demonstration showing multiplayer functionality through Unreal Engine 5 sessions" class="wp-image-1729"/></figure>



<h3 class="wp-block-heading">Connecting to Sessions Outside your Local Internet Network</h3>



<p>The session and listen server created in this guide can be connected to inside your local network by default and world wide through the internet with a few additional steps.</p>



<p>If you wish to host your session to global internet users, you need to <strong>port forward</strong> UDP/TCP 7777. Setting up port forwarding is different per router so check your specific router instructions.</p>



<p><a href="https://en.wikipedia.org/wiki/Port_forwarding">If you don’t know what port forwarding is click here.</a></p>



<h2 class="wp-block-heading">Download the Project Files</h2>



<p>We create these free guides and resources on Game Development to give anyone the knowledge to make their own games. If you find these guides helpful please consider supporting us by purchasing our project files.<br><br><strong>To improve your multiplayer sessions gameplay, we have bundled a session browser into the project files!</strong></p>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<script src="https://gumroad.com/js/gumroad-embed.js"></script>
<div class="gumroad-product-embed"><a href="https://couchlearn.gumroad.com/l/ipoxq">Loading&#8230;</a></div>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<script src="https://gumroad.com/js/gumroad-embed.js"></script>
<div class="gumroad-product-embed"><a href="https://couchlearn.gumroad.com/l/mmshe">Loading&#8230;</a></div>
</div>
</div>



<h2 class="wp-block-heading">Conclusion</h2>



<p>Your project can now create and join multiplayer sessions!</p>



<p>This guide was created to make the initial multiplayer setup as easy as possible. Unreal Engine 5 has extremely robust and powerful multiplayer tools to make any multiplayer game you want!</p>



<p>To learn more about replication and the session system, the Unreal Engine documentation is the best place to improve your knowledge about multiplayer development.</p>



<p><a href="https://wiki.unrealengine.com/Replication">Click here to read more about Replication.</a></p>



<p><a href="https://docs.unrealengine.com/en-US/Engine/Blueprints/UserGuide/OnlineNodes/index.html">Clic</a><a href="https://docs.unrealengine.com/en-US/Engine/Blueprints/UserGuide/OnlineNodes/index.html"></a><a href="https://docs.unrealengine.com/en-US/Engine/Blueprints/UserGuide/OnlineNodes/index.html">k here to read more about the session system nodes.</a></p>
<p>The post <a href="https://couchlearn.com/how-to-use-multiplayer-sessions-in-unreal-engine-5/">How to use Multiplayer Sessions in Unreal Engine 5</a> appeared first on <a href="https://couchlearn.com">Couch Learn</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://couchlearn.com/how-to-use-multiplayer-sessions-in-unreal-engine-5/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>Easy LODs for Skeletal Meshes in Unreal Engine 4</title>
		<link>https://couchlearn.com/easy-lods-for-skeletal-meshes-in-unreal-engine-4/</link>
					<comments>https://couchlearn.com/easy-lods-for-skeletal-meshes-in-unreal-engine-4/#respond</comments>
		
		<dc:creator><![CDATA[Matt]]></dc:creator>
		<pubDate>Sat, 16 Jan 2021 17:20:46 +0000</pubDate>
				<category><![CDATA[Graphics]]></category>
		<category><![CDATA[Medium Difficulty]]></category>
		<category><![CDATA[Unreal Engine]]></category>
		<category><![CDATA[auto lod]]></category>
		<category><![CDATA[automatic lod]]></category>
		<category><![CDATA[how to generate LODs automatically]]></category>
		<category><![CDATA[level of detail]]></category>
		<category><![CDATA[lod]]></category>
		<category><![CDATA[skeletal mesh LOD]]></category>
		<category><![CDATA[skeletal meshes]]></category>
		<category><![CDATA[ue4]]></category>
		<category><![CDATA[ue4 graphics]]></category>
		<category><![CDATA[ue4 lod]]></category>
		<category><![CDATA[unreal engine]]></category>
		<category><![CDATA[unreal engine 4]]></category>
		<category><![CDATA[unreal engine 4 LOD]]></category>
		<category><![CDATA[unreal engine lod]]></category>
		<guid isPermaLink="false">https://couchlearn.com/?p=1352</guid>

					<description><![CDATA[<p>In this guide we will be showing you how to automatically generate and configure levels of detail for skeletal meshes compatible with animations in Unreal <a class="mh-excerpt-more" href="https://couchlearn.com/easy-lods-for-skeletal-meshes-in-unreal-engine-4/" title="Easy LODs for Skeletal Meshes in Unreal Engine 4">[...]</a></p>
<p>The post <a href="https://couchlearn.com/easy-lods-for-skeletal-meshes-in-unreal-engine-4/">Easy LODs for Skeletal Meshes in Unreal Engine 4</a> appeared first on <a href="https://couchlearn.com">Couch Learn</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>In this guide we will be showing you how to automatically generate and configure levels of detail for skeletal meshes compatible with animations in Unreal Engine 4. <br><br>There are plugins that can create levels of detail but this is the best way to create easy LODs for skeletal meshes in Unreal Engine 4.<br><br><strong>This guide requires Unreal Engine 4.22 or higher!</strong><br><br>In this guide, we will be using skeletal meshes from the <a href="https://www.unrealengine.com/marketplace/en-US/product/animal-pack-ultra">Animal Pack Ultra by JanPecnik on the Unreal Engine Marketplace.</a><br><br>If you are looking for easy automatic LODs for STATIC meshes, <a href="https://couchlearn.com/easy-lods-for-static-meshes-in-unreal-engine-4/">read at our guide here.</a></p>



<h3 class="wp-block-heading">What are LODs?</h3>



<p>LOD (Level of Detail) is a technique found in all game engines that switches between different complexities of a 3D mesh over distance to reduce the amount of polygons that are needed to draw the scene.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="514" src="https://couchlearn.com/wp-content/uploads/2021/01/image-1-1024x514.png" alt="Full level of detail versus 90% reduction of mesh triangles." class="wp-image-1364" srcset="https://couchlearn.com/wp-content/uploads/2021/01/image-1-1024x514.png 1024w, https://couchlearn.com/wp-content/uploads/2021/01/image-1-300x151.png 300w, https://couchlearn.com/wp-content/uploads/2021/01/image-1-768x386.png 768w, https://couchlearn.com/wp-content/uploads/2021/01/image-1.png 1338w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption>Full LOD vs 90% Triangle Reduction</figcaption></figure>



<p>These LODs, when setup correctly, will improve your games GPU performance!</p>



<h3 class="wp-block-heading">Creating Levels of Detail</h3>



<p>Firstly, to automatically generate different LODs for your skeletal mesh, open the mesh from the content browser.</p>



<p>Once the mesh is shown find the LOD Settings tab in the details section on the left.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="555" src="https://couchlearn.com/wp-content/uploads/2021/01/image-1024x555.png" alt="Finding the LOD settings in the skeletal mesh details panel." class="wp-image-1355" srcset="https://couchlearn.com/wp-content/uploads/2021/01/image-1024x555.png 1024w, https://couchlearn.com/wp-content/uploads/2021/01/image-300x163.png 300w, https://couchlearn.com/wp-content/uploads/2021/01/image-768x416.png 768w, https://couchlearn.com/wp-content/uploads/2021/01/image-1536x832.png 1536w, https://couchlearn.com/wp-content/uploads/2021/01/image.png 1920w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Increase the &#8220;Number of LODs&#8221; slider to the amount that you want, <strong>then press the &#8220;Regenerate&#8221; button. </strong><br><br>For this guide we chose <strong>four LODs</strong>. You can create and setup as many levels of detail you need for your specific mesh.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="409" height="291" src="https://couchlearn.com/wp-content/uploads/2021/01/image-2.png" alt="Setting number of LODs to 4 and regenerating the lods." class="wp-image-1367" srcset="https://couchlearn.com/wp-content/uploads/2021/01/image-2.png 409w, https://couchlearn.com/wp-content/uploads/2021/01/image-2-300x213.png 300w" sizes="(max-width: 409px) 100vw, 409px" /></figure>



<h3 class="wp-block-heading">Setting up the Level of Detail</h3>



<p>Firstly, inside the LOD drop down box, select the LOD level you wish to adjust.<br><br>Then, as LOD 0 is our full detail mesh, we want to change LOD 1 first.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="659" height="158" src="https://couchlearn.com/wp-content/uploads/2021/01/image-4.png" alt="Selecting the LOD 1 option in the LOD Picker." class="wp-image-1372" srcset="https://couchlearn.com/wp-content/uploads/2021/01/image-4.png 659w, https://couchlearn.com/wp-content/uploads/2021/01/image-4-300x72.png 300w" sizes="(max-width: 659px) 100vw, 659px" /><figcaption>LOD 0 is our full detail model which is why we edit all other LOD options.</figcaption></figure>



<h4 class="wp-block-heading">Changing the LOD Distance</h4>



<p>Inside the LOD Info drop down adjust the screen size value to the size we want for this LOD to be visible on the screen.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="395" height="166" src="https://couchlearn.com/wp-content/uploads/2021/01/image-6.png" alt="Adjust the screen size of the LOD level chosen." class="wp-image-1376" srcset="https://couchlearn.com/wp-content/uploads/2021/01/image-6.png 395w, https://couchlearn.com/wp-content/uploads/2021/01/image-6-300x126.png 300w" sizes="(max-width: 395px) 100vw, 395px" /></figure>



<p>For this mesh we used these screen size values:</p>



<ul class="wp-block-list"><li>LOD 0: 1.1</li><li>LOD 1: 1.0</li><li>LOD 2: 0.75</li><li>LOD 3: 0.2</li></ul>



<p>These values give the model a high quality look then quickly drops the mesh detail down over longer distances.</p>



<h4 class="wp-block-heading">Reducing the Triangles</h4>



<p>Inside the &#8220;LOD Info&#8221; drop down find the &#8220;Reduction Settings&#8221; section and adjust the &#8220;Percent of Triangles&#8221; value to what ever you require. <br><br><strong>0.85 (15% reduction in triangles) works well for this skeletal mesh at LOD level 1.</strong></p>



<figure class="wp-block-image size-large"><img decoding="async" width="666" height="441" src="https://couchlearn.com/wp-content/uploads/2021/01/image-9.png" alt="Reducing LOD 1 triangle percent to 85%." class="wp-image-1379" srcset="https://couchlearn.com/wp-content/uploads/2021/01/image-9.png 666w, https://couchlearn.com/wp-content/uploads/2021/01/image-9-300x199.png 300w" sizes="(max-width: 666px) 100vw, 666px" /></figure>



<p>For this guide we used these percent of triangle values:</p>



<ul class="wp-block-list"><li>LOD 0: 1.0</li><li>LOD 1: 0.85</li><li>LOD 2: 0.45</li><li>LOD 3: 0.1</li></ul>



<h3 class="wp-block-heading">Demonstration</h3>



<p>Finally, with the settings used in this guide, the skeletal mesh will change between these LOD states based on the distance from the camera.<br><br>This reduced the complexity of the model, boosted your game&#8217;s performance whilst maintaining a high level of detail and quality at shorter distances.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="650" height="672" src="https://couchlearn.com/wp-content/uploads/2021/01/skeletallodchanges.gif" alt="Final LOD transitions for the skeletal mesh" class="wp-image-1528"/></figure>



<h3 class="wp-block-heading">Conclusion</h3>



<p>Now your skeletal meshes are setup to dynamically change in quality over distance!<br><br>This simple setup drastically improves performance for lower end machines as is essential for an optimised game.<br><br><strong>This technique is not a silver bullet for performance, but if implemented correctly, will increase the performance on many PCs when using high poly meshes.</strong><br><br>This technique in conjunction with the static mesh level of detail setup will allow your game to contain more meshes and allow higher detail scenes without affecting performance heavily!<br><br><a href="https://docs.unrealengine.com/en-US/WorkingWithContent/Types/SkeletalMeshes/SkeletalMeshReductionTool/index.html">Click here to read the official documentation for the skeletal mesh reduction tool in Unreal Engine 4</a><br><br><a href="https://couchlearn.com/easy-lods-for-static-meshes-in-unreal-engine-4/">Click here to setup automatically generating levels of detail for your static meshes in Unreal Engine 4</a></p>
<p>The post <a href="https://couchlearn.com/easy-lods-for-skeletal-meshes-in-unreal-engine-4/">Easy LODs for Skeletal Meshes in Unreal Engine 4</a> appeared first on <a href="https://couchlearn.com">Couch Learn</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://couchlearn.com/easy-lods-for-skeletal-meshes-in-unreal-engine-4/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to Smoothly Rotate AI Characters in Unreal Engine 4</title>
		<link>https://couchlearn.com/how-to-smoothly-rotate-ai-characters-in-unreal-engine-4/</link>
					<comments>https://couchlearn.com/how-to-smoothly-rotate-ai-characters-in-unreal-engine-4/#comments</comments>
		
		<dc:creator><![CDATA[Matt]]></dc:creator>
		<pubDate>Thu, 17 Dec 2020 16:12:59 +0000</pubDate>
				<category><![CDATA[AI]]></category>
		<category><![CDATA[Medium Difficulty]]></category>
		<category><![CDATA[Unreal Engine]]></category>
		<category><![CDATA[ai smooth rotation]]></category>
		<category><![CDATA[couch learn]]></category>
		<category><![CDATA[How to Smoothly Rotate AI Characters in Unreal Engine 4]]></category>
		<category><![CDATA[smooth rotation]]></category>
		<category><![CDATA[ue4]]></category>
		<category><![CDATA[ue4 AI]]></category>
		<category><![CDATA[ue4 ai smooth rotation]]></category>
		<category><![CDATA[unreal ai smooth]]></category>
		<category><![CDATA[unreal engine 4]]></category>
		<category><![CDATA[unreal engine 4 ai]]></category>
		<category><![CDATA[unreal engine AI]]></category>
		<category><![CDATA[unreal engine smooth rotation]]></category>
		<guid isPermaLink="false">https://couchlearn.com/?p=1310</guid>

					<description><![CDATA[<p>The default behaviour for Unreal Engine 4 AI characters is to instantly snap towards the direction they are facing. AI smooth rotation in Unreal Engine <a class="mh-excerpt-more" href="https://couchlearn.com/how-to-smoothly-rotate-ai-characters-in-unreal-engine-4/" title="How to Smoothly Rotate AI Characters in Unreal Engine 4">[...]</a></p>
<p>The post <a href="https://couchlearn.com/how-to-smoothly-rotate-ai-characters-in-unreal-engine-4/">How to Smoothly Rotate AI Characters in Unreal Engine 4</a> appeared first on <a href="https://couchlearn.com">Couch Learn</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>The default behaviour for Unreal Engine 4 AI characters is to instantly snap towards the direction they are facing. <br><br>AI smooth rotation in Unreal Engine 4 is simple and requires very little change to your existing AI characters.<br><br>In this guide we will be making your AI character smoothly turn when moving between locations.<br><br><em><strong>If you don&#8217;t have a simple AI character <a href="https://couchlearn.com/easy-ai-movement-in-unreal-engine-4/">read our guide here.</a></strong></em></p>



<h2 class="wp-block-heading">Smoothing the Turning</h2>



<p>Firstly, click the top section of the character in the top left side of the editor window.<br><br><strong>In our case this is AITestCharacter(self)</strong>.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="294" height="173" src="https://couchlearn.com/wp-content/uploads/2020/11/image-9.png" alt="Selecting the main actor" class="wp-image-1328"/></figure>



<p>This will now show the character and actor information in the details section on the right.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="777" height="651" src="https://couchlearn.com/wp-content/uploads/2020/11/image-10.png" alt="Showing the actor info" class="wp-image-1329" srcset="https://couchlearn.com/wp-content/uploads/2020/11/image-10.png 777w, https://couchlearn.com/wp-content/uploads/2020/11/image-10-300x251.png 300w, https://couchlearn.com/wp-content/uploads/2020/11/image-10-768x643.png 768w" sizes="(max-width: 777px) 100vw, 777px" /></figure>



<p>In the Pawn section, <strong>Untick </strong>the &#8220;Use Controller Rotation Yaw&#8221;</p>



<figure class="wp-block-image size-large"><img decoding="async" width="470" height="222" src="https://couchlearn.com/wp-content/uploads/2020/11/image-11.png" alt="Disabling the yaw controller rotation" class="wp-image-1330" srcset="https://couchlearn.com/wp-content/uploads/2020/11/image-11.png 470w, https://couchlearn.com/wp-content/uploads/2020/11/image-11-300x142.png 300w" sizes="(max-width: 470px) 100vw, 470px" /><figcaption>This prevents the AI from snapping towards the controller direction.</figcaption></figure>



<p>Next, click the &#8220;CharacterMovement (Inherited)&#8221; section to show the character movement settings on the right.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="299" height="197" src="https://couchlearn.com/wp-content/uploads/2020/11/image-8.png" alt="Selecting the character movement component" class="wp-image-1321"/></figure>



<p>In the top right search box type &#8220;rotation&#8221; to show the related options.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="465" height="497" src="https://couchlearn.com/wp-content/uploads/2020/11/image-13.png" alt="Searching in the details panel for Rotation settings" class="wp-image-1333" srcset="https://couchlearn.com/wp-content/uploads/2020/11/image-13.png 465w, https://couchlearn.com/wp-content/uploads/2020/11/image-13-281x300.png 281w" sizes="(max-width: 465px) 100vw, 465px" /></figure>



<p>In the Character Movement Rotation Settings tab, change the Z Rotation Rate value to 180 and <strong>tick </strong>the &#8220;Orient Rotation to Movement&#8221; box.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="465" height="189" src="https://couchlearn.com/wp-content/uploads/2020/11/image-14.png" alt="Setting the Z value to 180 and ticking orient rotation to movement" class="wp-image-1334" srcset="https://couchlearn.com/wp-content/uploads/2020/11/image-14.png 465w, https://couchlearn.com/wp-content/uploads/2020/11/image-14-300x122.png 300w" sizes="(max-width: 465px) 100vw, 465px" /></figure>



<h2 class="wp-block-heading">Demonstration</h2>



<p>In this demo we show AI smooth rotation in Unreal Engine 4 that use the Troll mesh and animations from the<a href="https://www.unrealengine.com/marketplace/en-US/item/1fb552504c4f4700bfddb127bf1d1189/"> Troll Pack PBR asset pack found on the Unreal Marketplace by InfinityPBR.</a></p>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<h3 class="wp-block-heading">Instant AI Rotation</h3>



<figure class="wp-block-image size-large"><img decoding="async" width="800" height="450" src="https://couchlearn.com/wp-content/uploads/2020/12/instantairotation.gif" alt="Instant rotation of AI" class="wp-image-1345"/></figure>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<h3 class="wp-block-heading">Smooth AI Rotation</h3>



<figure class="wp-block-image size-large"><img decoding="async" width="800" height="450" src="https://couchlearn.com/wp-content/uploads/2020/12/smoothairotation.gif" alt="Smooth rotation of AI" class="wp-image-1344"/></figure>
</div>
</div>



<h2 class="wp-block-heading">Conclusion</h2>



<p>Your AI characters now rotation smoothly and can be customised based on the agility of your game characters!<br><br><em>Let us know in the comments or contact us directly if you have any problems or want to request new Unreal Engine 4 topics.</em><br><br><strong>Further Reading:</strong><br><br>To enable your AI characters to roam large open worlds, <a href="https://couchlearn.com/open-world-navigation-in-unreal-engine-4/">check out our guide on enabling dynamic nav mesh generation.</a><br><br>To read more about AI in Unreal Engine, <a href="https://docs.unrealengine.com/en-US/InteractiveExperiences/ArtificialIntelligence/BehaviorTrees/BehaviorTreesOverview/index.html">click here to read the official documentation on Behaviour Trees.</a><br></p>
<p>The post <a href="https://couchlearn.com/how-to-smoothly-rotate-ai-characters-in-unreal-engine-4/">How to Smoothly Rotate AI Characters in Unreal Engine 4</a> appeared first on <a href="https://couchlearn.com">Couch Learn</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://couchlearn.com/how-to-smoothly-rotate-ai-characters-in-unreal-engine-4/feed/</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
			</item>
		<item>
		<title>Multiplayer Damage and Health System in Unreal Engine 4</title>
		<link>https://couchlearn.com/multiplayer-damage-and-health-system-in-unreal-engine-4/</link>
					<comments>https://couchlearn.com/multiplayer-damage-and-health-system-in-unreal-engine-4/#respond</comments>
		
		<dc:creator><![CDATA[Matt]]></dc:creator>
		<pubDate>Thu, 06 Aug 2020 02:20:35 +0000</pubDate>
				<category><![CDATA[Medium Difficulty]]></category>
		<category><![CDATA[Multiplayer]]></category>
		<category><![CDATA[Unreal Engine]]></category>
		<category><![CDATA[health and damage]]></category>
		<category><![CDATA[multiplayer]]></category>
		<category><![CDATA[ue4]]></category>
		<category><![CDATA[ue4 damage]]></category>
		<category><![CDATA[ue4 fps]]></category>
		<category><![CDATA[ue4 health]]></category>
		<category><![CDATA[ue4 health and damage]]></category>
		<category><![CDATA[ue4 multiplayer]]></category>
		<category><![CDATA[ue4 multiplayer fps]]></category>
		<category><![CDATA[unreal engine damage]]></category>
		<category><![CDATA[unreal engine health]]></category>
		<category><![CDATA[unreal engine multiplayer]]></category>
		<guid isPermaLink="false">https://couchlearn.com/?p=1045</guid>

					<description><![CDATA[<p>Unreal Engine 4 contains a powerful multiplayer compatible damage system that works with all actor types. This system easily allows you to create a Multiplayer <a class="mh-excerpt-more" href="https://couchlearn.com/multiplayer-damage-and-health-system-in-unreal-engine-4/" title="Multiplayer Damage and Health System in Unreal Engine 4">[...]</a></p>
<p>The post <a href="https://couchlearn.com/multiplayer-damage-and-health-system-in-unreal-engine-4/">Multiplayer Damage and Health System in Unreal Engine 4</a> appeared first on <a href="https://couchlearn.com">Couch Learn</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Unreal Engine 4 contains a powerful multiplayer compatible damage system that works with all actor types.<br><br>This system easily allows you to create a Multiplayer Damage and Health System in Unreal Engine 4 only using blueprints.</p>



<h3 class="wp-block-heading">Prerequisites</h3>



<p>This guide expects that you understand how to use basic nodes such as branch, get player controller and input actions / events.<br><br>If you do not know how to use input actions in Unreal Engine 4 <a href="https://couchlearn.com/how-to-use-input-actions-and-input-axis-mappings-in-your-unreal-engine-4-game/">click here to read our guide.</a><br><br>This guide also expects that you know what a line trace is and how to set them up for a first person style game.<br><br>If you do not know how to setup first person line traces <a href="https://couchlearn.com/basic-first-person-line-trace-in-unreal-engine-4/">click here to read our guide.</a></p>



<h3 class="wp-block-heading">How Unreal&#8217;s Damage System works</h3>



<h4 class="wp-block-heading">How to Deal Damage</h4>



<p>The most basic way to deal damage to another actor is to use the &#8220;Apply Damage&#8221; node.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="306" height="286" src="https://couchlearn.com/wp-content/uploads/2020/08/image.png" alt="The apply damage node with the damage set to 15.0" class="wp-image-1197" srcset="https://couchlearn.com/wp-content/uploads/2020/08/image.png 306w, https://couchlearn.com/wp-content/uploads/2020/08/image-300x280.png 300w" sizes="(max-width: 306px) 100vw, 306px" /></figure>



<p>Here are the important variables to set:<br><br><strong>Damaged Actor</strong> &#8211; The actor that you want to damage<br><strong>Base Damage</strong> &#8211; The amount of damage to apply to the damaged actor<br><strong>Damage Causer</strong> &#8211; The actor that applied the damage to the damaged actor</p>



<h4 class="wp-block-heading">How to Detect Damage</h4>



<p>When added to any actors event graph, the &#8220;Event AnyDamage&#8221; event node runs every time the actor is damaged.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="189" height="193" src="https://couchlearn.com/wp-content/uploads/2020/08/image-1.png" alt="The AnyDamage event that runs every time your actor is damaged" class="wp-image-1199"/></figure>



<p>Here are the important variables to use from the event node:<br><br><strong>Damage</strong> &#8211; The amount of damage that is detected<br><strong>Damage Causer</strong> &#8211; The actor that dealt the damage</p>



<h3 class="wp-block-heading">Creating the Weapon Damage Nodes</h3>



<p><strong>We recommend using the default First Person Shooter template for this guide. </strong><br><br>This damage system works will all game types but when learning a new system it is easier to have a template that works well before you start.<br><br>The First Person Shooter template has a player character setup with movement, mouse aiming, arm and gun models and animations.</p>



<h4 class="wp-block-heading">Requesting to Shoot to the server</h4>



<p>Firstly, to make the weapon damage run correctly on multiplayer, create a new custom event called &#8220;Net Shoot Weapon&#8221;.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="410" height="122" src="https://couchlearn.com/wp-content/uploads/2020/08/image-2.png" alt="Creating the custom event to fire the weapon on the server" class="wp-image-1200" srcset="https://couchlearn.com/wp-content/uploads/2020/08/image-2.png 410w, https://couchlearn.com/wp-content/uploads/2020/08/image-2-300x89.png 300w" sizes="(max-width: 410px) 100vw, 410px" /></figure>



<p>Then click the new event (Net Shoot Weapon) and in the detail panel on the right of the screen change the &#8220;Replicates&#8221; drop down box to &#8220;Run on Server&#8221;.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="476" height="283" src="https://couchlearn.com/wp-content/uploads/2020/08/image-4.png" alt="Setting the Net Shoot Event to run on the server" class="wp-image-1202" srcset="https://couchlearn.com/wp-content/uploads/2020/08/image-4.png 476w, https://couchlearn.com/wp-content/uploads/2020/08/image-4-300x178.png 300w" sizes="(max-width: 476px) 100vw, 476px" /></figure>



<p>Changing this setting will now run this event from the client to the server. This prevents cheating as all damage and collision checking will be done server side.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="181" height="104" src="https://couchlearn.com/wp-content/uploads/2020/08/image-6.png" alt="The custom network compatible Net Shoot Weapon event" class="wp-image-1207"/><figcaption>This event called on the client is only run on the server</figcaption></figure>



<p>Next create an InputAction Fire event (included in the first person shooter template) and create a Net Shoot Weapon node to the Pressed pin.<br><br>This will send a message to the server to shoot your gun and calculate the </p>



<figure class="wp-block-image size-large"><img decoding="async" width="452" height="170" src="https://couchlearn.com/wp-content/uploads/2020/08/image-3.png" alt="Telling the server to fire when the fire button event is pressed" class="wp-image-1201" srcset="https://couchlearn.com/wp-content/uploads/2020/08/image-3.png 452w, https://couchlearn.com/wp-content/uploads/2020/08/image-3-300x113.png 300w" sizes="(max-width: 452px) 100vw, 452px" /></figure>



<p>Finally for this section to be complete, connect the animation and sound effect blueprint nodes from the template to the Net Shoot Weapon execution pin.<br><br>This complete section will look like this:</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="421" src="https://couchlearn.com/wp-content/uploads/2020/08/image-5-1024x421.png" alt="The complete firing code on the client" class="wp-image-1206" srcset="https://couchlearn.com/wp-content/uploads/2020/08/image-5-1024x421.png 1024w, https://couchlearn.com/wp-content/uploads/2020/08/image-5-300x123.png 300w, https://couchlearn.com/wp-content/uploads/2020/08/image-5-768x316.png 768w, https://couchlearn.com/wp-content/uploads/2020/08/image-5.png 1137w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<h4 class="wp-block-heading">Syncing the Animation and Sounds</h4>



<p>The animation and sound effects running on the previous step don&#8217;t currently run for other players.<br><br>To play the animation and sound for this player on everyone else&#8217;s screens we need to create a multi cast event.<br><br>Firstly, add a new custom event named &#8220;Multi Weapon Animation&#8221;.</p>



<figure class="wp-block-image"><img decoding="async" src="https://couchlearn.com/wp-content/uploads/2020/08/image-2.png" alt="Creating the custom event to fire the weapon on the server"/></figure>



<p>And change the &#8220;Replicates&#8221; to &#8220;Multicast&#8221;.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="479" height="247" src="https://couchlearn.com/wp-content/uploads/2020/08/image-7.png" alt="Changing the replicates property of the event to Multicast" class="wp-image-1208" srcset="https://couchlearn.com/wp-content/uploads/2020/08/image-7.png 479w, https://couchlearn.com/wp-content/uploads/2020/08/image-7-300x155.png 300w" sizes="(max-width: 479px) 100vw, 479px" /></figure>



<p>Create a branch node, a Get Player Controller node and a Get Controller node.<br><br>From the Get Player Controller node create an equals node and connect the &#8220;Get Controller&#8221; node to the bottom pin as shown below.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="428" height="305" src="https://couchlearn.com/wp-content/uploads/2020/08/image-9.png" alt="Preventing the animation and sound from playing twice on the client" class="wp-image-1210" srcset="https://couchlearn.com/wp-content/uploads/2020/08/image-9.png 428w, https://couchlearn.com/wp-content/uploads/2020/08/image-9-300x214.png 300w" sizes="(max-width: 428px) 100vw, 428px" /><figcaption>This is done to prevent the animation playing twice on the owning players screen.</figcaption></figure>



<p>The last nodes required for this step can be copied and pasted from the step above.<br><br>The complete section looks like this:</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="433" src="https://couchlearn.com/wp-content/uploads/2020/08/image-10-1024x433.png" alt="The complete multicast animation and sound effects event for the clients" class="wp-image-1211" srcset="https://couchlearn.com/wp-content/uploads/2020/08/image-10-1024x433.png 1024w, https://couchlearn.com/wp-content/uploads/2020/08/image-10-300x127.png 300w, https://couchlearn.com/wp-content/uploads/2020/08/image-10-768x325.png 768w, https://couchlearn.com/wp-content/uploads/2020/08/image-10.png 1097w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption>Multicast events run for all clients</figcaption></figure>



<h4 class="wp-block-heading">Server-side Weapon Shooting</h4>



<p>Firstly, from the &#8220;Net Shoot Weapon&#8221; event created earlier in this guide, we need to create a &#8220;Multi Weapon Animation&#8221; node and connect it together. <br><br>This will sync the animation and sound to all clients on the server whenever a player shoots.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="464" height="135" src="https://couchlearn.com/wp-content/uploads/2020/08/image-11.png" alt="Running the Multi Weapon Animation event from the server to sync all animations and sounds for all clients" class="wp-image-1213" srcset="https://couchlearn.com/wp-content/uploads/2020/08/image-11.png 464w, https://couchlearn.com/wp-content/uploads/2020/08/image-11-300x87.png 300w" sizes="(max-width: 464px) 100vw, 464px" /></figure>



<p>To damage another actor when the request is received, we first will need to use a Line Trace for Objects node.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="589" src="https://couchlearn.com/wp-content/uploads/2020/08/image-27-1024x589.png" alt="Connecting the line trace for objects node to the server shoot weapon event" class="wp-image-1241" srcset="https://couchlearn.com/wp-content/uploads/2020/08/image-27-1024x589.png 1024w, https://couchlearn.com/wp-content/uploads/2020/08/image-27-300x173.png 300w, https://couchlearn.com/wp-content/uploads/2020/08/image-27-768x442.png 768w, https://couchlearn.com/wp-content/uploads/2020/08/image-27.png 1055w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption>This line trace runs on the server when called and uses the server&#8217;s state to prevent cheating.</figcaption></figure>



<p>If you do not know how to setup a line trace <a href="https://couchlearn.com/basic-first-person-line-trace-in-unreal-engine-4/">click here to read our guide on first person line traces in Unreal Engine 4</a><br><br>From the line trace we need to create an &#8220;Apply Damage&#8221; node and connect the &#8220;Hit Actor&#8221; pin from the &#8220;Break Hit Result&#8221; node to the &#8220;Damaged Actor&#8221; pin on the &#8220;Apply Damage&#8221; node.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="529" height="400" src="https://couchlearn.com/wp-content/uploads/2020/08/image-29.png" alt="A close up of the break hit result connecting to the Apply Damage node" class="wp-image-1243" srcset="https://couchlearn.com/wp-content/uploads/2020/08/image-29.png 529w, https://couchlearn.com/wp-content/uploads/2020/08/image-29-300x227.png 300w" sizes="(max-width: 529px) 100vw, 529px" /></figure>



<p>Set the &#8220;Base Damage&#8221; value to the damage that you want your weapon to deal. (We used 15.0 in this case)</p>



<figure class="wp-block-image size-large"><img decoding="async" width="299" height="127" src="https://couchlearn.com/wp-content/uploads/2020/08/image-30.png" alt="Setting the base damage to 15.0 of the Apply Damage node" class="wp-image-1244"/></figure>



<p>Lastly, create a Self node and connect it to the &#8220;Damage Causer&#8221; pin.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="410" height="109" src="https://couchlearn.com/wp-content/uploads/2020/08/image-32.png" alt="Creating a reference to self" class="wp-image-1246" srcset="https://couchlearn.com/wp-content/uploads/2020/08/image-32.png 410w, https://couchlearn.com/wp-content/uploads/2020/08/image-32-300x80.png 300w" sizes="(max-width: 410px) 100vw, 410px" /></figure>



<p>After all these steps, the line trace connections should look like this:</p>



<figure class="wp-block-image size-large"><img decoding="async" width="887" height="565" src="https://couchlearn.com/wp-content/uploads/2020/08/image-28.png" alt="The last step to complete the Line Trace for Objects node and apply damage node." class="wp-image-1242" srcset="https://couchlearn.com/wp-content/uploads/2020/08/image-28.png 887w, https://couchlearn.com/wp-content/uploads/2020/08/image-28-300x191.png 300w, https://couchlearn.com/wp-content/uploads/2020/08/image-28-768x489.png 768w" sizes="(max-width: 887px) 100vw, 887px" /></figure>



<p>And here is the complete Net Shoot Weapon event blueprint nodes:</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="449" src="https://couchlearn.com/wp-content/uploads/2020/08/image-31-1024x449.png" alt="The complete server side system to apply damage to the target actor" class="wp-image-1245" srcset="https://couchlearn.com/wp-content/uploads/2020/08/image-31-1024x449.png 1024w, https://couchlearn.com/wp-content/uploads/2020/08/image-31-300x132.png 300w, https://couchlearn.com/wp-content/uploads/2020/08/image-31-768x337.png 768w, https://couchlearn.com/wp-content/uploads/2020/08/image-31.png 1373w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<h4 class="wp-block-heading">Receiving the Damage</h4>



<p>Firstly create an AnyDamage event in the actor that you want to receive damage.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="198" height="188" src="https://couchlearn.com/wp-content/uploads/2020/08/image-34.png" alt="Creating the AnyDamage event" class="wp-image-1249"/></figure>



<p>Create a new variable named &#8220;Health&#8221; with the type of float. This will be used to store the amount of health the actor has.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="348" height="122" src="https://couchlearn.com/wp-content/uploads/2020/08/image-35.png" alt="Creating the health variable" class="wp-image-1250" srcset="https://couchlearn.com/wp-content/uploads/2020/08/image-35.png 348w, https://couchlearn.com/wp-content/uploads/2020/08/image-35-300x105.png 300w" sizes="(max-width: 348px) 100vw, 348px" /></figure>



<p>Set the default value of the &#8220;Health&#8221; variable to 100 (or whichever you want your actors max health to be)</p>



<figure class="wp-block-image size-large"><img decoding="async" width="330" height="60" src="https://couchlearn.com/wp-content/uploads/2020/08/image-36.png" alt="Setting the default value of the health variable to 100" class="wp-image-1251" srcset="https://couchlearn.com/wp-content/uploads/2020/08/image-36.png 330w, https://couchlearn.com/wp-content/uploads/2020/08/image-36-300x55.png 300w" sizes="(max-width: 330px) 100vw, 330px" /></figure>



<p>Next create a Get node for Health, subtract Damage from Health and then set Health to this new value.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="516" height="259" src="https://couchlearn.com/wp-content/uploads/2020/08/image-37.png" alt="Calculating the remaining health after dealing the damage" class="wp-image-1252" srcset="https://couchlearn.com/wp-content/uploads/2020/08/image-37.png 516w, https://couchlearn.com/wp-content/uploads/2020/08/image-37-300x151.png 300w" sizes="(max-width: 516px) 100vw, 516px" /></figure>



<p>From the Set Health node create a &#8220;Less than or Equal&#8221; node, create a branch node and connect them together. This checks if the player&#8217;s health is less than or equal to zero after taking the damage</p>



<figure class="wp-block-image size-large"><img decoding="async" width="617" height="269" src="https://couchlearn.com/wp-content/uploads/2020/08/image-38.png" alt="Checking if the players new health is less than or equal to zero" class="wp-image-1253" srcset="https://couchlearn.com/wp-content/uploads/2020/08/image-38.png 617w, https://couchlearn.com/wp-content/uploads/2020/08/image-38-300x131.png 300w" sizes="(max-width: 617px) 100vw, 617px" /><figcaption>Checking if the actor has no health remaining</figcaption></figure>



<p>Finally, on the True execution pin create a &#8220;SetActorLocation&#8221; node and set the New Location value to where you want your actors to respawn when they run out of health.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="309" src="https://couchlearn.com/wp-content/uploads/2020/08/image-39-1024x309.png" alt="If the actor's health is less than or equal to zero" class="wp-image-1255" srcset="https://couchlearn.com/wp-content/uploads/2020/08/image-39-1024x309.png 1024w, https://couchlearn.com/wp-content/uploads/2020/08/image-39-300x91.png 300w, https://couchlearn.com/wp-content/uploads/2020/08/image-39-768x232.png 768w, https://couchlearn.com/wp-content/uploads/2020/08/image-39.png 1127w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Here is the complete Event AnyDamage blueprint nodes:</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="200" src="https://couchlearn.com/wp-content/uploads/2020/08/image-40-1024x200.png" alt="The complete Event AnyDamage blueprint nodes" class="wp-image-1256" srcset="https://couchlearn.com/wp-content/uploads/2020/08/image-40-1024x200.png 1024w, https://couchlearn.com/wp-content/uploads/2020/08/image-40-300x59.png 300w, https://couchlearn.com/wp-content/uploads/2020/08/image-40-768x150.png 768w, https://couchlearn.com/wp-content/uploads/2020/08/image-40.png 1410w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<h3 class="wp-block-heading">Demonstration</h3>



<figure class="wp-block-image size-large"><img decoding="async" width="800" height="269" src="https://couchlearn.com/wp-content/uploads/2020/08/healthdamage.gif" alt="The multiplayer FPS health and damage system working in engine." class="wp-image-1257"/><figcaption>Players being hit with damage and respawning when running out of health.</figcaption></figure>



<p><em>To visualise the health of the hit player easier we added a &#8220;Print String&#8221; node here:</em></p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="295" src="https://couchlearn.com/wp-content/uploads/2020/08/image-41-1024x295.png" alt="Easily debugging player health by adding a print string node" class="wp-image-1258" srcset="https://couchlearn.com/wp-content/uploads/2020/08/image-41-1024x295.png 1024w, https://couchlearn.com/wp-content/uploads/2020/08/image-41-300x86.png 300w, https://couchlearn.com/wp-content/uploads/2020/08/image-41-768x221.png 768w, https://couchlearn.com/wp-content/uploads/2020/08/image-41.png 1416w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<h3 class="wp-block-heading">Download the Project Files</h3>



<script src="https://gumroad.com/js/gumroad-embed.js"></script>
<div class="gumroad-product-embed" data-gumroad-product-id="hqpJJ"><a href="https://gumroad.com/l/hqpJJ">Loading&#8230;</a></div>



<h3 class="wp-block-heading">Conclusion</h3>



<p>Now your game or project has a fully multiplayer compatible damage system all using blueprints!</p>



<h4 class="wp-block-heading"><strong>Expanding this System</strong></h4>



<p>To improve this system you could add a widget to the screen showing when a player is defeated and with what weapon they were defeated by.<br><br>Another way to improve this shooter style game would be to add attenuation to the shooting sound effects. <br><br>This would reduce the volume over distance and make the game more realistic. <a href="https://couchlearn.com/simple-audio-attenuation-in-unreal-engine-4/">Click here to check out our guide on attenuation in Unreal Engine 4.</a><br><br>Lastly, try expanding from this guide by creating AI character with health and damage with our easy AI movement guide. <a href="https://couchlearn.com/easy-ai-movement-in-unreal-engine-4/">https://couchlearn.com/easy-ai-movement-in-unreal-engine-4/</a></p>



<h4 class="wp-block-heading">Further Reading</h4>



<p>Unreal Engine&#8217;s blog post on their damage system: <a href="https://www.unrealengine.com/en-US/blog/damage-in-ue4#:~:text=Damage%20support%20is%20a%20feature,your%20damage%20model%20when%20needed.">https://www.unrealengine.com/en-US/blog/damage-in-ue4#:~:text=Damage%20support%20is%20a%20feature,your%20damage%20model%20when%20needed.</a><br><br>The full damage blueprint node documentation can be found here: <a href="https://docs.unrealengine.com/en-US/BlueprintAPI/Game/Damage/index.html">https://docs.unrealengine.com/en-US/BlueprintAPI/Game/Damage/index.html</a></p>
<p>The post <a href="https://couchlearn.com/multiplayer-damage-and-health-system-in-unreal-engine-4/">Multiplayer Damage and Health System in Unreal Engine 4</a> appeared first on <a href="https://couchlearn.com">Couch Learn</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://couchlearn.com/multiplayer-damage-and-health-system-in-unreal-engine-4/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Basic First Person Line Trace in Unreal Engine 4</title>
		<link>https://couchlearn.com/basic-first-person-line-trace-in-unreal-engine-4/</link>
					<comments>https://couchlearn.com/basic-first-person-line-trace-in-unreal-engine-4/#respond</comments>
		
		<dc:creator><![CDATA[Matt]]></dc:creator>
		<pubDate>Wed, 05 Aug 2020 13:06:16 +0000</pubDate>
				<category><![CDATA[Medium Difficulty]]></category>
		<category><![CDATA[UE4 Basics]]></category>
		<category><![CDATA[Unreal Basics]]></category>
		<category><![CDATA[Unreal Engine]]></category>
		<category><![CDATA[line trace]]></category>
		<category><![CDATA[ue4]]></category>
		<category><![CDATA[ue4 basics]]></category>
		<category><![CDATA[ue4 first person]]></category>
		<category><![CDATA[ue4 first person line trace]]></category>
		<category><![CDATA[ue4 fps]]></category>
		<category><![CDATA[ue4 line trace]]></category>
		<category><![CDATA[ue4 raycast]]></category>
		<category><![CDATA[ue4 trace]]></category>
		<category><![CDATA[unreal engine]]></category>
		<category><![CDATA[unreal engine 4]]></category>
		<category><![CDATA[unreal engine fps]]></category>
		<guid isPermaLink="false">https://couchlearn.com/?p=1215</guid>

					<description><![CDATA[<p>In this guide we will explain what a Line Trace is an how to create a Basic First Person Line Trace in Unreal Engine 4 <a class="mh-excerpt-more" href="https://couchlearn.com/basic-first-person-line-trace-in-unreal-engine-4/" title="Basic First Person Line Trace in Unreal Engine 4">[...]</a></p>
<p>The post <a href="https://couchlearn.com/basic-first-person-line-trace-in-unreal-engine-4/">Basic First Person Line Trace in Unreal Engine 4</a> appeared first on <a href="https://couchlearn.com">Couch Learn</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>In this guide we will explain what a Line Trace is an how to create a Basic First Person Line Trace in Unreal Engine 4<br><br><strong>This guide builds upon the First Person Example template built into Unreal Engine 4.</strong></p>



<h3 class="wp-block-heading">How a Line Trace Works</h3>



<p>A line trace is a way to check if an object is intersecting a line. The hit data is then broken down access more information such as location of hit, normal of hit. the actor that was hit and distance from hit.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="719" height="480" src="https://couchlearn.com/wp-content/uploads/2020/08/image-22.png" alt="An example of a line trace hitting a first person character" class="wp-image-1229" srcset="https://couchlearn.com/wp-content/uploads/2020/08/image-22.png 719w, https://couchlearn.com/wp-content/uploads/2020/08/image-22-300x200.png 300w" sizes="(max-width: 719px) 100vw, 719px" /></figure>



<h3 class="wp-block-heading">Different Types of Line Traces</h3>



<p>&#8220;Line Trace for Objects&#8221; checks an intersection with a specific collision object type. (WorldStatic, WorldDynamic, Pawn, Ragdoll, PhysicsActor, etc)</p>



<figure class="wp-block-image size-large"><img decoding="async" width="381" height="465" src="https://couchlearn.com/wp-content/uploads/2020/08/image-23.png" alt="Calculate a line trace by collision object type" class="wp-image-1230" srcset="https://couchlearn.com/wp-content/uploads/2020/08/image-23.png 381w, https://couchlearn.com/wp-content/uploads/2020/08/image-23-246x300.png 246w" sizes="(max-width: 381px) 100vw, 381px" /></figure>



<p>&#8220;Line Trace by Channel&#8221; checks for an intersection with a specific line trace collision channel. (Visibility and Camera are the default options)</p>



<figure class="wp-block-image size-large"><img decoding="async" width="350" height="383" src="https://couchlearn.com/wp-content/uploads/2020/08/image-24.png" alt="Calculate a line trace by trace channel" class="wp-image-1231" srcset="https://couchlearn.com/wp-content/uploads/2020/08/image-24.png 350w, https://couchlearn.com/wp-content/uploads/2020/08/image-24-274x300.png 274w" sizes="(max-width: 350px) 100vw, 350px" /></figure>



<p>&#8220;Line Trace by Channel&#8221; checks for an intersection with a specific collision profile by name. (These can be viewed and created in the collision tab of the project settings)</p>



<figure class="wp-block-image size-large"><img decoding="async" width="349" height="353" src="https://couchlearn.com/wp-content/uploads/2020/08/image-25.png" alt="Calculate a line trace by collision profile" class="wp-image-1232" srcset="https://couchlearn.com/wp-content/uploads/2020/08/image-25.png 349w, https://couchlearn.com/wp-content/uploads/2020/08/image-25-297x300.png 297w" sizes="(max-width: 349px) 100vw, 349px" /></figure>



<h3 class="wp-block-heading">How to Calculate the First Person Line Trace</h3>



<p>All line traces have the same basic setup. The nodes below setup the vector maths required to check for any collisions wherever the camera is located and facing.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="599" height="332" src="https://couchlearn.com/wp-content/uploads/2020/08/image-17.png" alt="The universal setup for all first person line traces" class="wp-image-1222" srcset="https://couchlearn.com/wp-content/uploads/2020/08/image-17.png 599w, https://couchlearn.com/wp-content/uploads/2020/08/image-17-300x166.png 300w" sizes="(max-width: 599px) 100vw, 599px" /></figure>



<h4 class="wp-block-heading">Breaking down the Maths</h4>



<p>Firstly you use the FirstPersonCamera variable connected to the GetWorldLocation node to begin the line trace from your character&#8217;s camera position.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="227" height="129" src="https://couchlearn.com/wp-content/uploads/2020/08/image-18.png" alt="Getting the world location of the first person camera" class="wp-image-1223"/></figure>



<p>Next using the Get Controller node, get the controller rotation from the Get Control Rotation node. This will get the rotation of your camera and even works multiplayer games.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="232" height="164" src="https://couchlearn.com/wp-content/uploads/2020/08/image-19.png" alt="Getting the control rotation for multiplayer compatibility" class="wp-image-1224"/></figure>



<p>Afterwards connect the Get Control Rotation node to the Get Forward Vector node. This will get the direction your camera is facing of your camera.<br><br>Multiply this Get Forward Vector value by 5000 (Multiple Vector by Float) to get a point in space from 0,0,0 that is 5000 units away facing the direction of the camera.<br><em>(This is the distance away from the camera to check fora collision. Change this to whichever distance you need for your project).</em><br><br>Finally add the Get World Location return value of your First Person Camera to the multiplied value. This gets the point in 3D space that you are looking at 5000 units in front of your camera.</p>



<h3 class="wp-block-heading">Accessing the Hit Data</h3>



<p>Connecting the return value to a branch only allows successful line traces to be accessed. Not including this branch will cause lots of console errors when accessing the hit result data.<br><br>To access this data click and drag from the Out Hit value and create a Break Hit Result node.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="729" height="489" src="https://couchlearn.com/wp-content/uploads/2020/08/image-20.png" alt="Accessing the data from a line trace" class="wp-image-1226" srcset="https://couchlearn.com/wp-content/uploads/2020/08/image-20.png 729w, https://couchlearn.com/wp-content/uploads/2020/08/image-20-300x201.png 300w" sizes="(max-width: 729px) 100vw, 729px" /></figure>



<h3 class="wp-block-heading">The Complete First Person Line Trace</h3>



<p>This is one example of a complete first person line trace. <br><br>To use this system simply connect the execution pins to any event you want e.g. Event Tick or an event</p>



<figure class="wp-block-image size-large"><img decoding="async" width="967" height="376" src="https://couchlearn.com/wp-content/uploads/2020/08/image-16.png" alt="An example of a complete first person line trace" class="wp-image-1221" srcset="https://couchlearn.com/wp-content/uploads/2020/08/image-16.png 967w, https://couchlearn.com/wp-content/uploads/2020/08/image-16-300x117.png 300w, https://couchlearn.com/wp-content/uploads/2020/08/image-16-768x299.png 768w" sizes="(max-width: 967px) 100vw, 967px" /></figure>



<h3 class="wp-block-heading">Conclusion</h3>



<p>Your project now is setup to use a basic First Person Line Trace in Unreal Engine 4!<br><br>Your project can now detect when objects are in front of the camera. Many use this system for weapons, interacting with objects such as doors, pickups and much more!<br><br><strong>Further Reading</strong>:<br><br>Combine this line trace system with our easy AI movement guide to create computer controlled character that can interact with objects! <a href="https://couchlearn.com/easy-ai-movement-in-unreal-engine-4/">https://couchlearn.com/easy-ai-movement-in-unreal-engine-4/</a><br><br>Unreal Engine&#8217;s documentation on single line traces: <a href="https://docs.unrealengine.com/en-US/Engine/Physics/Tracing/HowTo/SingleLineTraceByChannel/index.html">https://docs.unrealengine.com/en-US/Engine/Physics/Tracing/HowTo/SingleLineTraceByChannel/index.html</a><br><br>Unreal Engine&#8217;s full documentation on traces: <a href="https://docs.unrealengine.com/en-US/Engine/Physics/Tracing/Overview/index.html">https://docs.unrealengine.com/en-US/Engine/Physics/Tracing/Overview/index.html</a></p>
<p>The post <a href="https://couchlearn.com/basic-first-person-line-trace-in-unreal-engine-4/">Basic First Person Line Trace in Unreal Engine 4</a> appeared first on <a href="https://couchlearn.com">Couch Learn</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://couchlearn.com/basic-first-person-line-trace-in-unreal-engine-4/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Easy LODs for Static Meshes in Unreal Engine 4</title>
		<link>https://couchlearn.com/easy-lods-for-static-meshes-in-unreal-engine-4/</link>
					<comments>https://couchlearn.com/easy-lods-for-static-meshes-in-unreal-engine-4/#respond</comments>
		
		<dc:creator><![CDATA[Matt]]></dc:creator>
		<pubDate>Fri, 01 May 2020 03:44:38 +0000</pubDate>
				<category><![CDATA[Medium Difficulty]]></category>
		<category><![CDATA[Unreal Engine]]></category>
		<category><![CDATA[automatic lod]]></category>
		<category><![CDATA[how to generate LODs automatically]]></category>
		<category><![CDATA[level of detail]]></category>
		<category><![CDATA[lod]]></category>
		<category><![CDATA[ue4]]></category>
		<category><![CDATA[ue4 lod]]></category>
		<category><![CDATA[unreal engine]]></category>
		<category><![CDATA[unreal engine 4]]></category>
		<category><![CDATA[unreal engine 4 LOD]]></category>
		<guid isPermaLink="false">https://couchlearn.com/?p=1107</guid>

					<description><![CDATA[<p>In this guide we will be showing you how to automatically generate and configure levels of detail for static meshes in Unreal Engine 4. What <a class="mh-excerpt-more" href="https://couchlearn.com/easy-lods-for-static-meshes-in-unreal-engine-4/" title="Easy LODs for Static Meshes in Unreal Engine 4">[...]</a></p>
<p>The post <a href="https://couchlearn.com/easy-lods-for-static-meshes-in-unreal-engine-4/">Easy LODs for Static Meshes in Unreal Engine 4</a> appeared first on <a href="https://couchlearn.com">Couch Learn</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>In this guide we will be showing you how to automatically generate and configure levels of detail for static meshes in Unreal Engine 4.</p>



<h3 class="wp-block-heading">What are LODs?</h3>



<p>LOD (Level of Detail) is a technique found in all game engines that switches between different complexities of a 3D mesh over distance to reduce the amount of polygons that are needed to draw the scene.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1015" height="619" src="https://couchlearn.com/wp-content/uploads/2020/04/image-2.png" alt="Lod different before and after" class="wp-image-1118" srcset="https://couchlearn.com/wp-content/uploads/2020/04/image-2.png 1015w, https://couchlearn.com/wp-content/uploads/2020/04/image-2-300x183.png 300w, https://couchlearn.com/wp-content/uploads/2020/04/image-2-768x468.png 768w" sizes="(max-width: 1015px) 100vw, 1015px" /></figure>



<p>These LODs, when setup correctly, will improve your games GPU performance!</p>



<h3 class="wp-block-heading">Creating Levels of Detail</h3>



<p>Firstly, to automatically generate different LODs for your static mesh, open the mesh from the content browser.<br><br>Once the mesh is shown find the LOD Settings tab in the details section on the right.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="554" src="https://couchlearn.com/wp-content/uploads/2020/04/image-3-1024x554.png" alt="Level of detail settings" class="wp-image-1120" srcset="https://couchlearn.com/wp-content/uploads/2020/04/image-3-1024x554.png 1024w, https://couchlearn.com/wp-content/uploads/2020/04/image-3-300x162.png 300w, https://couchlearn.com/wp-content/uploads/2020/04/image-3-768x416.png 768w, https://couchlearn.com/wp-content/uploads/2020/04/image-3-1536x831.png 1536w, https://couchlearn.com/wp-content/uploads/2020/04/image-3.png 1926w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>In the LOD settings section, increase the &#8220;Number of LODs&#8221; section to the amount of different levels of detail you want Unreal Engine to automatically generate.<br><br><strong>Before we start, untick the Auto Computer LOD Distance box.</strong></p>



<figure class="wp-block-image size-large"><img decoding="async" width="321" height="179" src="https://couchlearn.com/wp-content/uploads/2020/05/image-3.png" alt="Adding new LOD states and disabling auto compute LOD distance" class="wp-image-1127" srcset="https://couchlearn.com/wp-content/uploads/2020/05/image-3.png 321w, https://couchlearn.com/wp-content/uploads/2020/05/image-3-300x167.png 300w" sizes="(max-width: 321px) 100vw, 321px" /></figure>



<p><strong>For this guide we are using four levels of detail.</strong></p>



<p>Once this is done, press the Apply Changes button.</p>



<h3 class="wp-block-heading">Reducing the Triangles</h3>



<p>Underneath the LOD Picker section of the detail menu, you will see the current selected LOD. <br><br><strong>As the LOD is set to AUTO the current LOD visible is based on the distance to the camera in the editor&#8217;s viewport.</strong><br><br><strong>To change which LOD you are adjusting, press the LOD drop down and select which LOD distance you want to edit.</strong><br><br>To change the reduction amount for the selected LOD, simply open the reduction settings tab.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="476" height="203" src="https://couchlearn.com/wp-content/uploads/2020/05/image-1.png" alt="Reduction Settings" class="wp-image-1123" srcset="https://couchlearn.com/wp-content/uploads/2020/05/image-1.png 476w, https://couchlearn.com/wp-content/uploads/2020/05/image-1-300x128.png 300w" sizes="(max-width: 476px) 100vw, 476px" /></figure>



<p>To lower the quality of this LOD, change the &#8220;Percent Triangles&#8221; to a smaller percentage.<br><br>The best method is to lower the percentage slowly over the different LODs.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="481" height="436" src="https://couchlearn.com/wp-content/uploads/2020/05/image-2.png" alt="Reducing the triangle percentage" class="wp-image-1124" srcset="https://couchlearn.com/wp-content/uploads/2020/05/image-2.png 481w, https://couchlearn.com/wp-content/uploads/2020/05/image-2-300x272.png 300w" sizes="(max-width: 481px) 100vw, 481px" /></figure>



<p>For this guide I have setup the Percent Triangles like so:<br><strong>LOD 0:</strong> 100.0<br><strong>LOD 1:</strong> 85.0<br><strong>LOD 2:</strong> 65.0<br><strong>LOD 3:</strong> 35.0</p>



<h3 class="wp-block-heading">Setting the Distances</h3>



<p>To switch between the different LODs, the engine uses the screen size setting. This determines how big the object is on the screen before it changes LOD state.<br><br>To change this value, select the LOD that you want to edit in the LOD Picker above and find the Screen Size box. Change this value to what you think is best for your meshes. <br><br><strong>Its best to tweak these values and test until you find a sweet spot for the asset that you are configuring</strong>.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="481" height="206" src="https://couchlearn.com/wp-content/uploads/2020/05/image-4.png" alt="Changing the screen size option for LOD state 0" class="wp-image-1134" srcset="https://couchlearn.com/wp-content/uploads/2020/05/image-4.png 481w, https://couchlearn.com/wp-content/uploads/2020/05/image-4-300x128.png 300w" sizes="(max-width: 481px) 100vw, 481px" /></figure>



<p>For this guide I have setup the distances like so:<br><strong>LOD 0:</strong> 1.0<br><strong>LOD 1:</strong> 0.55<br><strong>LOD 2:</strong> 0.175<br><strong>LOD 3:</strong> 0.035</p>



<h3 class="wp-block-heading">Demonstration</h3>



<p>Creating a blueprint that uses the newly adjusted mesh or just dragging in your new mesh into the level will automatically switch between the LODs.<br><br>As you can see in the video below the triangles used to render the object is heavily reduced.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="800" height="486" src="https://couchlearn.com/wp-content/uploads/2020/05/lodtrichanges.gif" alt="Changing triangle count over distance" class="wp-image-1143"/></figure>



<h3 class="wp-block-heading">Conclusion</h3>



<p>Now your meshes fade between LOD states improving performance for your game!</p>



<p>This technique is essential for creating games that will perform well on many different power of PCs and other platforms.<br><br>To improve on this, enable LOD dithering to fade between LOD states smoothly. <a href="https://couchlearn.com/fading-between-lods-in-unreal-engine-4/">Click here for a link to our guide on using LOD Dithering in Unreal Engine 4!</a></p>



<p>For more information on LODs in Unreal Engine 4 click here for the official documentation: <a href="https://docs.unrealengine.com/en-US/Engine/Content/Types/StaticMeshes/HowTo/index.html">https://docs.unrealengine.com/en-US/Engine/Content/Types/StaticMeshes/HowTo/index.html</a></p>
<p>The post <a href="https://couchlearn.com/easy-lods-for-static-meshes-in-unreal-engine-4/">Easy LODs for Static Meshes in Unreal Engine 4</a> appeared first on <a href="https://couchlearn.com">Couch Learn</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://couchlearn.com/easy-lods-for-static-meshes-in-unreal-engine-4/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Open World Navigation in Unreal Engine 4</title>
		<link>https://couchlearn.com/open-world-navigation-in-unreal-engine-4/</link>
					<comments>https://couchlearn.com/open-world-navigation-in-unreal-engine-4/#comments</comments>
		
		<dc:creator><![CDATA[Matt]]></dc:creator>
		<pubDate>Wed, 11 Dec 2019 20:32:10 +0000</pubDate>
				<category><![CDATA[AI]]></category>
		<category><![CDATA[Medium Difficulty]]></category>
		<category><![CDATA[Unreal Engine]]></category>
		<category><![CDATA[large world pathfinding]]></category>
		<category><![CDATA[open world pathfinding]]></category>
		<category><![CDATA[terrain pathfinding]]></category>
		<category><![CDATA[ue4]]></category>
		<category><![CDATA[ue4 AI]]></category>
		<category><![CDATA[ue4 ai movement]]></category>
		<category><![CDATA[ue4 dynamic pathfinding]]></category>
		<category><![CDATA[ue4 open world]]></category>
		<category><![CDATA[ue4 open world pathfinding]]></category>
		<category><![CDATA[unreal engine 4]]></category>
		<category><![CDATA[unreal engine 4 ai]]></category>
		<category><![CDATA[unreal engine AI]]></category>
		<guid isPermaLink="false">https://couchlearn.com/?p=939</guid>

					<description><![CDATA[<p>In this guide we will enable open world navigation in Unreal Engine 4 using the Navigation Invoker system. One annoyance that most developers forget to <a class="mh-excerpt-more" href="https://couchlearn.com/open-world-navigation-in-unreal-engine-4/" title="Open World Navigation in Unreal Engine 4">[...]</a></p>
<p>The post <a href="https://couchlearn.com/open-world-navigation-in-unreal-engine-4/">Open World Navigation in Unreal Engine 4</a> appeared first on <a href="https://couchlearn.com">Couch Learn</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p> In this guide we will enable open world navigation in Unreal Engine 4 using the Navigation Invoker system.<br><br>One annoyance that most developers forget to think about when creating open world or procedural levels is the navigation system taking hours to generate the nav mesh.<br><br>Using navigation invokers, we can generate the nav mesh during runtime without a long wait in the editor.</p>



<h3 class="wp-block-heading">Before we Start</h3>



<p>To enable these features, dynamic pathfinding must be enabled to allow the navigation mesh to generate during runtime.<br><br><a href="https://couchlearn.com/easy-dynamic-pathfinding-in-unreal-engine-4/">To learn how to enable dynamic generation during runtime click here for our guide.</a></p>



<p class="has-text-align-center"><strong>Only the areas of the level that possessed pawns are near will be generated. </strong></p>



<h3 class="wp-block-heading">Enabling Generation around Nav Invokers</h3>



<p>To enable this setting we must firstly go to the project settings.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="560" height="477" src="https://couchlearn.com/wp-content/uploads/2019/11/image.png" alt="Project settings" class="wp-image-944" srcset="https://couchlearn.com/wp-content/uploads/2019/11/image.png 560w, https://couchlearn.com/wp-content/uploads/2019/11/image-300x256.png 300w" sizes="(max-width: 560px) 100vw, 560px" /></figure>



<p>Once the project settings are open, click on the<strong> Navigation System</strong> tab.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="278" height="402" src="https://couchlearn.com/wp-content/uploads/2019/11/image-1.png" alt="Navigation system" class="wp-image-945" srcset="https://couchlearn.com/wp-content/uploads/2019/11/image-1.png 278w, https://couchlearn.com/wp-content/uploads/2019/11/image-1-207x300.png 207w" sizes="(max-width: 278px) 100vw, 278px" /></figure>



<p>Tick the checkbox named: <strong>Generate Navigation Only Around Navigation Invoker. </strong><br><br>This tells the engine to only generate around actors that have the navigation invoker component.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="743" height="472" src="https://couchlearn.com/wp-content/uploads/2019/11/image-2.png" alt="Enable nav invoker generation" class="wp-image-946" srcset="https://couchlearn.com/wp-content/uploads/2019/11/image-2.png 743w, https://couchlearn.com/wp-content/uploads/2019/11/image-2-300x191.png 300w" sizes="(max-width: 743px) 100vw, 743px" /></figure>



<h3 class="wp-block-heading">Nav Invoker Component</h3>



<p>To enable navigation generation on an actor, we first need to add the Navigation Invoker Component.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="282" height="140" src="https://couchlearn.com/wp-content/uploads/2019/11/image-3.png" alt="Nav invoker component" class="wp-image-948"/></figure>



<p>To add this to your actor, click the Add Component button in the top left of your blueprint editor and search for Navigation Invoker.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="361" height="145" src="https://couchlearn.com/wp-content/uploads/2019/11/image-4.png" alt="Adding the nav invoker" class="wp-image-949" srcset="https://couchlearn.com/wp-content/uploads/2019/11/image-4.png 361w, https://couchlearn.com/wp-content/uploads/2019/11/image-4-300x120.png 300w" sizes="(max-width: 361px) 100vw, 361px" /></figure>



<p>Once this component is added, setup the radius that the navigation mesh will be generated and removed.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="287" height="169" src="https://couchlearn.com/wp-content/uploads/2019/11/image-5.png" alt="Adding the nav invoker" class="wp-image-950"/></figure>



<p>From my testing, the default values work well for open world landscape levels.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="544" height="334" src="https://couchlearn.com/wp-content/uploads/2019/11/image-6.png" alt="Default settings for nav invoker" class="wp-image-951" srcset="https://couchlearn.com/wp-content/uploads/2019/11/image-6.png 544w, https://couchlearn.com/wp-content/uploads/2019/11/image-6-300x184.png 300w" sizes="(max-width: 544px) 100vw, 544px" /></figure>



<p>When creating a procedurally generated indoor level, I recommend slightly higher values.<br><br>This prevents the actor from being trapped in their current room or area.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="533" height="88" src="https://couchlearn.com/wp-content/uploads/2019/11/image-7.png" alt="Settings for procedural halls" class="wp-image-952" srcset="https://couchlearn.com/wp-content/uploads/2019/11/image-7.png 533w, https://couchlearn.com/wp-content/uploads/2019/11/image-7-300x50.png 300w" sizes="(max-width: 533px) 100vw, 533px" /></figure>



<h3 class="wp-block-heading">Demonstration and Example Files</h3>



<script src="https://gumroad.com/js/gumroad-embed.js"></script>
<div class="gumroad-product-embed" data-gumroad-product-id="tTeLu"><a href="https://gumroad.com/l/tTeLu">Loading&#8230;</a></div>



<h3 class="wp-block-heading">Conclusion</h3>



<p>That is all for enabling open world navigation in Unreal Engine 4!<br><br>Characters and pawns can now traverse large open or procedurally generated levels.<br><br>For further reading into the navigation functions in Unreal Engine, <a href="https://docs.unrealengine.com/en-US/BlueprintAPI/AI/Navigation/index.html">click here for the official documentation.</a></p>
<p>The post <a href="https://couchlearn.com/open-world-navigation-in-unreal-engine-4/">Open World Navigation in Unreal Engine 4</a> appeared first on <a href="https://couchlearn.com">Couch Learn</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://couchlearn.com/open-world-navigation-in-unreal-engine-4/feed/</wfw:commentRss>
			<slash:comments>9</slash:comments>
		
		
			</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/

Page Caching using Disk: Enhanced 
Minified using Disk

Served from: couchlearn.com @ 2026-04-15 17:07:04 by W3 Total Cache
-->