<?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>ue4 fps Archives - Couch Learn</title>
	<atom:link href="https://couchlearn.com/tag/ue4-fps/feed/" rel="self" type="application/rss+xml" />
	<link>https://couchlearn.com/tag/ue4-fps/</link>
	<description>Detailed Game Programming Tutorials</description>
	<lastBuildDate>Sat, 25 Jan 2025 17:33:29 +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>ue4 fps Archives - Couch Learn</title>
	<link>https://couchlearn.com/tag/ue4-fps/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<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 fetchpriority="high" 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>How to Unlock FPS in Unreal Engine 4</title>
		<link>https://couchlearn.com/how-to-unlock-fps-in-unreal-engine-4/</link>
					<comments>https://couchlearn.com/how-to-unlock-fps-in-unreal-engine-4/#respond</comments>
		
		<dc:creator><![CDATA[Matt]]></dc:creator>
		<pubDate>Thu, 06 Feb 2020 17:42:33 +0000</pubDate>
				<category><![CDATA[Easy Difficulty]]></category>
		<category><![CDATA[UE4 Basics]]></category>
		<category><![CDATA[Unreal Basics]]></category>
		<category><![CDATA[Unreal Engine]]></category>
		<category><![CDATA[ue4]]></category>
		<category><![CDATA[ue4 console commands]]></category>
		<category><![CDATA[ue4 fixed frame rate]]></category>
		<category><![CDATA[ue4 fps]]></category>
		<category><![CDATA[ue4 framerate smooth]]></category>
		<category><![CDATA[ue4 max fps]]></category>
		<category><![CDATA[ue4 unlock fps]]></category>
		<category><![CDATA[ue4 vsync]]></category>
		<category><![CDATA[unreal engine]]></category>
		<category><![CDATA[unreal engine 4]]></category>
		<category><![CDATA[unreal engine 4 fps]]></category>
		<guid isPermaLink="false">https://couchlearn.com/?p=1043</guid>

					<description><![CDATA[<p>By default, Unreal Engine 4 is setup to aim for a smooth 60fps performance in every project. With a few easy steps you can change <a class="mh-excerpt-more" href="https://couchlearn.com/how-to-unlock-fps-in-unreal-engine-4/" title="How to Unlock FPS in Unreal Engine 4">[...]</a></p>
<p>The post <a href="https://couchlearn.com/how-to-unlock-fps-in-unreal-engine-4/">How to Unlock FPS in Unreal Engine 4</a> appeared first on <a href="https://couchlearn.com">Couch Learn</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>By default, Unreal Engine 4 is setup to aim for a smooth 60fps performance in every project.<br><br>With a few easy steps you can change these default settings to run your project at over 240fps.<br><br>In this guide we will go through how to unlock FPS in Unreal Engine 4.</p>



<h3 class="wp-block-heading">Updating the Project Settings</h3>



<p>Firstly, open the project settings menu found in the Edit tab of the editor.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="597" height="456" src="https://couchlearn.com/wp-content/uploads/2020/01/image-11.png" alt="project settings" class="wp-image-1062" srcset="https://couchlearn.com/wp-content/uploads/2020/01/image-11.png 597w, https://couchlearn.com/wp-content/uploads/2020/01/image-11-300x229.png 300w" sizes="(max-width: 597px) 100vw, 597px" /></figure>



<p>Once the project settings menu is open, click the general settings option.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="420" height="545" src="https://couchlearn.com/wp-content/uploads/2020/01/image-12.png" alt="general settings" class="wp-image-1063" srcset="https://couchlearn.com/wp-content/uploads/2020/01/image-12.png 420w, https://couchlearn.com/wp-content/uploads/2020/01/image-12-231x300.png 231w" sizes="(max-width: 420px) 100vw, 420px" /></figure>



<p>Now you can access the framerate options.</p>



<h4 class="wp-block-heading">Fixed Framerate</h4>



<p>To make sure that the frame rate can go above the limit, disable Use Fixed Frame Rate.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="512" height="195" src="https://couchlearn.com/wp-content/uploads/2020/01/image-7.png" alt="disabling the fixed frame rate" class="wp-image-1052" srcset="https://couchlearn.com/wp-content/uploads/2020/01/image-7.png 512w, https://couchlearn.com/wp-content/uploads/2020/01/image-7-300x114.png 300w" sizes="(max-width: 512px) 100vw, 512px" /></figure>



<h4 class="wp-block-heading">FPS Smoothing</h4>



<p>Smooth Frame Rate will try to make your FPS consistent in the range that you set. <br><br>Disabling this will prevent UE4 from adjusting your frame rate.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="534" height="194" src="https://couchlearn.com/wp-content/uploads/2020/01/image-8.png" alt="disabling smooth frame rate" class="wp-image-1053" srcset="https://couchlearn.com/wp-content/uploads/2020/01/image-8.png 534w, https://couchlearn.com/wp-content/uploads/2020/01/image-8-300x109.png 300w" sizes="(max-width: 534px) 100vw, 534px" /></figure>



<h3 class="wp-block-heading">Console Commands and Game Settings</h3>



<p>These settings can be changed in any blueprint. In this example we used the level blueprint.</p>



<h4 class="wp-block-heading">Disable VSync</h4>



<p>Using Unreal Engine 4&#8217;s game user settings, VSync (vertical sync) can be disabled. <br><br>Vertical sync locks the frame rate of the game to 60fps.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="467" height="149" src="https://couchlearn.com/wp-content/uploads/2020/01/image-10.png" alt="disabling vsync" class="wp-image-1058" srcset="https://couchlearn.com/wp-content/uploads/2020/01/image-10.png 467w, https://couchlearn.com/wp-content/uploads/2020/01/image-10-300x96.png 300w" sizes="(max-width: 467px) 100vw, 467px" /></figure>



<h4 class="wp-block-heading">Set Max Framerate</h4>



<p>Using the Execute Console Command node we can enable the console command <strong>t.maxfps</strong>. <br><br>This command tells the engine what the maximum frame rate cap should be.<br><br><strong>The number after the command is the frame rate cap. </strong><br><br><strong>This can be as high or as low as your project requires.</strong></p>



<figure class="wp-block-image size-large"><img decoding="async" width="410" height="132" src="https://couchlearn.com/wp-content/uploads/2020/01/image-9.png" alt="changing the maxfps console variable" class="wp-image-1057" srcset="https://couchlearn.com/wp-content/uploads/2020/01/image-9.png 410w, https://couchlearn.com/wp-content/uploads/2020/01/image-9-300x97.png 300w" sizes="(max-width: 410px) 100vw, 410px" /></figure>



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



<p>With these settings enabled, your project can now reach the maximum performance without limits or frame rate locks.<br><br>For more information on this topic, read the documentation linked below from the official Unreal Engine site.<br><br>Further resources:<br><a href="https://docs.unrealengine.com/en-US/Engine/Performance/SmoothFrameRate/index.html">Smooth frame rate documentation from Unreal Docs</a><br><a href="https://docs.unrealengine.com/en-US/Engine/Performance/index.html">Performance and profiling documentation from Unreal Docs </a></p>
<p>The post <a href="https://couchlearn.com/how-to-unlock-fps-in-unreal-engine-4/">How to Unlock FPS 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-unlock-fps-in-unreal-engine-4/feed/</wfw:commentRss>
			<slash:comments>0</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:08:57 by W3 Total Cache
-->