{"id":217,"date":"2023-04-20T01:13:15","date_gmt":"2023-04-20T00:13:15","guid":{"rendered":"http:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/?p=217"},"modified":"2023-04-20T01:13:15","modified_gmt":"2023-04-20T00:13:15","slug":"bsc1b-indie-development-19-04-2023","status":"publish","type":"post","link":"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/2023\/04\/20\/bsc1b-indie-development-19-04-2023\/","title":{"rendered":"BSc1b &#8211; Indie Development &#8211; 19.04.2023"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Focal point for today is introducing player death and restarting in the game, as well as making gameplay elements such as gold and experience persist between runs.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Before implementing a &#8216;restart&#8217; in my game, I will figure out where I will exactly be calling this first. The most straightforward spot I see is after the player&#8217;s health is decreased, and if the player&#8217;s health is below 0 then we will run the death and restart blueprints here.<br><br>Thinking further ahead for this, the player&#8217;s input needs to be disabled as dead people can&#8217;t move. I put that in and tested it and saw the player just stops moving completely while being surrounded, that would probably look a lot better with other means of player feedback such as the death screen itself or a death scream\/ lose sound effect but I liked the idea of the player&#8217;s pawn being knocked around, I tried toggling the physics and I think it looks a lot better.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"349\" src=\"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2023\/04\/image-67-1024x349.png\" alt=\"\" class=\"wp-image-218\" srcset=\"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2023\/04\/image-67-1024x349.png 1024w, https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2023\/04\/image-67-300x102.png 300w, https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2023\/04\/image-67-768x262.png 768w, https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2023\/04\/image-67.png 1123w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">Before I get too far ahead of myself, this is the code for that so far. I&#8217;ve included test input to trigger the death code immediately for debugging.<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">I really wanted to make the character ragdoll on death, so I&#8217;ve set the third person camera to activate on death as well as simulate physics on the player&#8217;s mesh, and after testing I think it looks really good.<\/p>\n\n\n\n<figure class=\"wp-block-video\"><video height=\"1080\" style=\"aspect-ratio: 1920 \/ 1080;\" width=\"1920\" controls src=\"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2023\/04\/RagdollClip.mp4\"><\/video><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Lastly, a quickly assembled widget for the deathscreen called after the previous blueprints.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"461\" src=\"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2023\/04\/image-70-1024x461.png\" alt=\"\" class=\"wp-image-222\" srcset=\"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2023\/04\/image-70-1024x461.png 1024w, https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2023\/04\/image-70-300x135.png 300w, https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2023\/04\/image-70-768x346.png 768w, https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2023\/04\/image-70.png 1038w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Next, I want to pass stats on after each restart which is done by using a game instance and they are a lot easier to set up than I thought. The distinction I understand is gamemode is per map whilst instance is per game. I&#8217;ve set up BP_Enemy to pass onto gold and xp gains to the instance now in a function that adds these values.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"528\" height=\"235\" src=\"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2023\/04\/image-72.png\" alt=\"\" class=\"wp-image-224\" srcset=\"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2023\/04\/image-72.png 528w, https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2023\/04\/image-72-300x134.png 300w\" sizes=\"auto, (max-width: 528px) 100vw, 528px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-video\"><video height=\"1080\" style=\"aspect-ratio: 1920 \/ 1080;\" width=\"1920\" controls src=\"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2023\/04\/InstanceClip.mp4\"><\/video><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Next remaining key element I want to add in is a dash, activated by shift the player will have a &#8216;burst of movement&#8217; in the direction they are currently moving.<br>The core of this idea to give the player an extra piece in their toolkit for mobility to help evade enemies a little, there&#8217;s a few ways I think I could go about it.<br>I like the idea of adding a dash due to its simplicity, I want to be really simple and as least overwhelming for the player as possible.<br>-dash examples in FPS games: dishonored, ghost runner, BPM, gunfire reborn.<br>Best example out of the bunch is the use in Gunfire Reborn, a little PvE shooter based in a lot of small quarters fights. The dash very subtle in both the difference that it makes and the visual effects.<\/p>\n\n\n\n<figure class=\"wp-block-video\"><video height=\"1080\" style=\"aspect-ratio: 1920 \/ 1080;\" width=\"1920\" controls src=\"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2023\/04\/GRDashClip.mp4\"><\/video><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">This is the exact idea I had in mind and to see it in another example assures me it&#8217;s effective, especially with the comparable scenario.<br>I ought to take further notes however on good hud elements to include such as how clear the abilities are presented to the player and their cooldowns.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I&#8217;ve tried out using launch character, with a technique where you raise the character a little so they don&#8217;t clip on the floor. This works nicely though <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"312\" src=\"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2023\/04\/image-73-1024x312.png\" alt=\"\" class=\"wp-image-229\" srcset=\"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2023\/04\/image-73-1024x312.png 1024w, https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2023\/04\/image-73-300x91.png 300w, https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2023\/04\/image-73-768x234.png 768w, https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2023\/04\/image-73.png 1124w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-video\"><video height=\"1080\" style=\"aspect-ratio: 1920 \/ 1080;\" width=\"1920\" controls src=\"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2023\/04\/DashClip.mp4\"><\/video><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">This worked very nicely to start off but I felt it was too jumpy and made the player fly around way too much when used while airborne.<br>I tried out adjusting the player&#8217;s character movement settings including adding a braking friction of 2, a falling lateral friction of 20, reduced jump Z velocity from 700 to 500, air control to 0.5, reduced the gravity from 1.75 to 1.5 and most importantly max speed 500. the 500 max speed and braking friction combined with a stronger burst means the player gets a good burst of speed that only has a temporary effect on velocity. The player now has a nice balance dash of speed that doesn&#8217;t sent them flying in a given direction.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">While the game is becoming much more movement focsued, I&#8217;m noticing that the player body isn&#8217;t fixed to the camera rotation, and while troubleshooting I found the option to switch between my third person camera and first person fixed this rotation issue. Fixing the character rotation to the camera however made the dash work in one rotation as the calculation used the character rotation.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So I don&#8217;t think I can&#8217;t use rotation to determine the dash location, I had trouble figuring out an effective way to determine the launch velocity for the character, best way I could figure out was to take the currently velocity and multiply it and this seems to work best since the player can&#8217;t dash from idle, though I&#8217;ll add a branch so they can&#8217;t waste it.<br><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This is the only fix I could figure out for the third person character not rotating with the camera.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"519\" height=\"146\" src=\"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2023\/04\/image-74.png\" alt=\"\" class=\"wp-image-231\" srcset=\"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2023\/04\/image-74.png 519w, https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2023\/04\/image-74-300x84.png 300w\" sizes=\"auto, (max-width: 519px) 100vw, 519px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Focal point for today is introducing player death and restarting in the game, as well as making gameplay elements such as gold and experience persist between runs. Before implementing a &#8216;restart&#8217; in my game, I will figure out where I will exactly be calling this first. The most straightforward spot I see is after the&hellip; <a class=\"more-link\" href=\"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/2023\/04\/20\/bsc1b-indie-development-19-04-2023\/\">Continue reading <span class=\"screen-reader-text\">BSc1b &#8211; Indie Development &#8211; 19.04.2023<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-217","post","type-post","status-publish","format-standard","hentry","category-uncategorised","entry"],"_links":{"self":[{"href":"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-json\/wp\/v2\/posts\/217","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=217"}],"version-history":[{"count":3,"href":"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-json\/wp\/v2\/posts\/217\/revisions"}],"predecessor-version":[{"id":240,"href":"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-json\/wp\/v2\/posts\/217\/revisions\/240"}],"wp:attachment":[{"href":"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=217"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=217"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=217"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}