{"id":481,"date":"2024-03-01T14:34:20","date_gmt":"2024-03-01T14:34:20","guid":{"rendered":"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/?p=481"},"modified":"2024-03-01T14:34:20","modified_gmt":"2024-03-01T14:34:20","slug":"bsc2a-hypercasual-c","status":"publish","type":"post","link":"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/2024\/03\/01\/bsc2a-hypercasual-c\/","title":{"rendered":"BSc2a &#8211; Hypercasual C++"},"content":{"rendered":"\n<p>Following up from my previous C++ practice, I need to start applying that knowledge to my hypercasual game.<\/p>\n\n\n\n<p>Looking at my game, I&#8217;ve got two choices, I either take a copy of the prototype blueprint and try to swap the controller blueprint with C++ files or make the game in C++ and add the blueprint widgets to support it. I think it would be good to start simple and make a separate C++ prototype for the barebones mechanics.<\/p>\n\n\n\n<p>Making a new project from blank, I found it confusing where to start from blank since you don&#8217;t have the same details panels that blueprint comes with, looking through online tutorials few people seem to even bother setting up C++ projects with a C++ game mode file over a blueprint one. My first task is setting up the player but I&#8217;m already having some trouble, I set up the blueprint version with all the player&#8217;s functionality on player controller but I can&#8217;t find online any resources instructing how to setup a controller on a C++ gamemode class, I looked at the third person template and set up a character blueprint instead of a controller.<\/p>\n\n\n\n<p>I see I have a choice between pawn and a character for implementing input, as the player will not need to have a mesh, collision or movement I can use a pawn instead of a character file.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"369\" height=\"153\" src=\"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2024\/02\/image-13.png\" alt=\"\" class=\"wp-image-484\" srcset=\"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2024\/02\/image-13.png 369w, https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2024\/02\/image-13-300x124.png 300w\" sizes=\"auto, (max-width: 369px) 100vw, 369px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"110\" src=\"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2024\/02\/image-15-1024x110.png\" alt=\"\" class=\"wp-image-486\" srcset=\"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2024\/02\/image-15-1024x110.png 1024w, https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2024\/02\/image-15-300x32.png 300w, https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2024\/02\/image-15-768x83.png 768w, https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2024\/02\/image-15.png 1085w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>I made a &#8216;TestActor&#8217; with a print string running on beginplay and tested it to make sure I have a working function for testing of the player has managed to load in the level. I added to the player pawn so I had a good way of knowing it has loaded into the game which it did not, it took a moment to remember that since I&#8217;m using a player pawn, I need to place it in the world first. Upon testing this I got my first good news for the C++ game, the player character has loaded.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"601\" height=\"179\" src=\"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2024\/02\/image-14.png\" alt=\"\" class=\"wp-image-485\" srcset=\"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2024\/02\/image-14.png 601w, https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2024\/02\/image-14-300x89.png 300w\" sizes=\"auto, (max-width: 601px) 100vw, 601px\" \/><\/figure>\n\n\n\n<p>Next up is functionality, these are the primary tasks to get the core functionality going:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>4 Variables (CO2Current, CO2Goal, TempCurrent, TempGoal) <\/li>\n\n\n\n<li>4 inputs to increase\/decrease CO2Current and TempCurrent<\/li>\n\n\n\n<li>StartRound Function (Randomise CO2Goal and TempGoal in range 0-100)<\/li>\n\n\n\n<li>print on deltatime the 4 variables.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"495\" height=\"255\" src=\"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2024\/02\/image-19.png\" alt=\"\" class=\"wp-image-493\" srcset=\"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2024\/02\/image-19.png 495w, https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2024\/02\/image-19-300x155.png 300w\" sizes=\"auto, (max-width: 495px) 100vw, 495px\" \/><\/figure>\n\n\n\n<p>Declared my 4 floats.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"214\" src=\"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2024\/02\/image-16-1024x214.png\" alt=\"\" class=\"wp-image-489\" srcset=\"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2024\/02\/image-16-1024x214.png 1024w, https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2024\/02\/image-16-300x63.png 300w, https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2024\/02\/image-16-768x161.png 768w, https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2024\/02\/image-16.png 1041w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"200\" height=\"97\" src=\"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2024\/02\/image-18.png\" alt=\"\" class=\"wp-image-491\"\/><\/figure>\n\n\n\n<p>Implemented a tick to display them.<\/p>\n\n\n\n<p>I&#8217;ve ran into a problem however where I cannot seem to include the necessary input library to the actor. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"421\" height=\"145\" src=\"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2024\/02\/image-20.png\" alt=\"\" class=\"wp-image-494\" srcset=\"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2024\/02\/image-20.png 421w, https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2024\/02\/image-20-300x103.png 300w\" sizes=\"auto, (max-width: 421px) 100vw, 421px\" \/><\/figure>\n\n\n\n<p>It seems to be an issue with having a pawn for the player over a character, I&#8217;ll set up a character file the same way and see if that fixes things.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"598\" height=\"369\" src=\"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2024\/02\/image-21.png\" alt=\"\" class=\"wp-image-496\" srcset=\"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2024\/02\/image-21.png 598w, https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2024\/02\/image-21-300x185.png 300w\" sizes=\"auto, (max-width: 598px) 100vw, 598px\" \/><\/figure>\n\n\n\n<p>The issue persists on the character class, I tried looking at solutions such as the one on this post https:\/\/forums.unrealengine.com\/t\/cannot-open-source-file-name-generated-hc\/413312 but it hasn&#8217;t resolved it.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"231\" src=\"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2024\/02\/image-23-1024x231.png\" alt=\"\" class=\"wp-image-498\" srcset=\"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2024\/02\/image-23-1024x231.png 1024w, https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2024\/02\/image-23-300x68.png 300w, https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2024\/02\/image-23-768x173.png 768w, https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-content\/uploads\/2024\/02\/image-23.png 1394w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>I&#8217;ve eventually found including it in the build.cs file in this manor did not remove the red line but allowed the code to compile without error. I&#8217;m not sure if this means the code will be fine but I&#8217;ll proceed with adding inputs to see if it will work.<\/p>\n\n\n\n<p>I think working from a blank project has added far too many troubleshooting hurdles, I think it would be worth switching to a different unreal template to work off of.<\/p>\n\n\n\n<p>I&#8217;m working on CPP_Template now<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Following up from my previous C++ practice, I need to start applying that knowledge to my hypercasual game. Looking at my game, I&#8217;ve got two choices, I either take a copy of the prototype blueprint and try to swap the controller blueprint with C++ files or make the game in C++ and add the blueprint&hellip; <a class=\"more-link\" href=\"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/2024\/03\/01\/bsc2a-hypercasual-c\/\">Continue reading <span class=\"screen-reader-text\">BSc2a &#8211; Hypercasual C++<\/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-481","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\/481","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=481"}],"version-history":[{"count":9,"href":"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-json\/wp\/v2\/posts\/481\/revisions"}],"predecessor-version":[{"id":502,"href":"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-json\/wp\/v2\/posts\/481\/revisions\/502"}],"wp:attachment":[{"href":"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=481"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=481"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lloydmills.nuacomputerscience.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=481"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}