Cropout Sample Project - Unreal 5.5.4 - Mega Learning Thread

Hello,
I hope this is the right place to start a Cropout Sample Project specific mega thread for solving issues / learning new things / implementing new features using the aforementioned project whether development or automation oriented with Unreal 5. If not, please direct me to a better place as I would love to start a ‘mega thread’ somewhere for all things Cropout project centric.

I’m new with Unreal and as I go through the ‘Ask a Dev’ Tutorial videos I decided to slowly implement the knowledge I have towards the Cropout project as it felt simpler than the shooter one. I have stumbled upon some snags due to my lack of proper terminology /knowledge so was hoping somę of you could speed up my syruggles. :smiley:

  1. Can someone help me in understanding how I can access the values inside the blueprint nodes likę in the Screenshot as I am scratching my head trying to figurę out where exactly the array is stored and how to edit that. Or, any documentation will do as well. I like reading.

  2. As part of the automation testing I wanted to understand how the save/load system works + deleting sales before tests (slowly getting there). This is mainly due to the issue I am having where a new villager is being spawned on most of the game starts (the default is 3 but the more I restart I can reach 20+ villagers and have tough time to debug that)

More questions to come, I guess, but for now I will be grateful for petting some light shed on those probably straightforward problems I want to learn operate around. Blueprints is so visually helpful but still, it takes time to get the hang of all the things. :smiley:

I have figured out that in the Play mode, you can mouse over the nodes to see the values inside instead of a cropped text, so at least I know the array has 3 resource types (obviously). No idea how to edit that still, though. I guess it’s something super stupidly easy, as usual…

On a side note, I have exported the BP_Spawner file as .T3D via Asset Actions, no luck there either. Back to digging. :smiley:

Indeed, it was obviously in plan sight. Focused too much on BluePrints side of things while completely overlooking the in-level hierarchy. Oh well, one problem solved, so can play with that. :smiley:

I’m getting closer to figuring out the save/load system and fixing the extra Villager problem I am experiencing on Game Continue (still not event sure whether that’s by design or not), but anyways.

It seems that the moment I choose any villager and drag them to an interactable object to switch their job, Spawn villager or a call to increase the villager count is being triggered somewhere, which then the Save data pick up, resulting in the game state having 1 extra villager spawned if you Quit and Continue.

If I don’t drag to target any of the Villagers, the Quit and Continue keep the number the same.
If I Restart, the number of the villagers is set back to 3 as the Save data is cleared in that flow (the +1 Villager issue might stem from BP_GM or BP_GI, but debugging is difficult as don’t have enough experience yet how to navigate around, but soon :D).

I’m finally getting the hang of understanding debugging with breakpoint’s help. This helped me find out that for some reason the Set Array Elem inside the BP_GI is the problem as oftentimes it returns number of villagers as +2 per step instead of +1, ending with more Villagers that it should be set(?).

Weirdly, the Villager Count in BP_GM breaks and returns 0 while that happens, so no idea why is that, so far. Back to more digging… :smiley:

For whoever will be working with the Cropout project in the future (if that’s not changed by then) I have found out the cause of the extra Villagers being spawned, short explanation:

  • ‘Event Update All Villagers’ is meant to update Villagers logic
  • For some reason the ‘Get All Actors Of Class’ looks for the Pawn type
  • BP_Player is of the Pawn Type too (game start limits the number of Villagers to 3 so despite the count being 4 with Player included, only 3 Villagers are spawned)
  • Changing Actor Class inside the ‘Get All Actors Of Class’ to BP_Villager fixes the issue

And with that, I can return to Automation Tests for the Cropout project with a clear mind now. :smiley:

[INFO DUMP: QA Automation: Functional Tests]

I did some investigating around the automated functional tests in Unreal 5.x and here are my initial findings (which might change as I learn the systems and rules around those more), which I feel are worth sharing:

  1. Most likely due to performance/time considerations (couldn’t find a good source for that other than the very old posts in this forum - when I find the post again, I will post a link here) the ‘Take Automation Screenshot’ blueprints can take only a single screenshot per started test run, whether the test run consists of only one individual test or multiple tests.

As a temporary workaround (thanks to this post: How to take a screenshot including UI only using Blueprint? - #26 by Danthomo87) I have created a custom Macro using the ‘Execute Console Command’ node (when making tests work in a macro first, you will thank me later, as automation is lots of repeated code).

This way I have a first step towards recording the game visuals per test step, even if those screenshots are not high quality ones (not sure if those can be used as ground truths for Screen Comparisons - something I will look into later).

Reference images below. Since it’s a macro, you need to make it variable agnostic - what I mean by that is that all the variables should be provider from the outside of the macro as once the macro is edited, it will edit itself globally (think editing ‘for loop’ that would affect whole project instead of single blueprint).

In simple terms:

  • Create a macro
  • Add the macro to the Blueprint
  • Hook up and set variables needed by the macro


  1. Annoyingly, though to a degree it makes sense, any red type error message which gets triggered during the test run (regardless if set by you or in the project itself) will result in that particular Functional Test result being marked as ‘Fail’ even when the test itself succeeds (reference example below).

I am yet to find any command or option in the Unreal engine that would suppress those errors just for the Functional Tests so that the test can remain as Success despite the potentially unrelated issues.

Not really a workaround but a way to make a less invasive warnings at least for your own control that I have figured out is by simply using the ‘Log Message’ node instead, should you want to raise awareness while not impacting the test status.

  1. Sadly, there is no way of ordering tests you are starting via the Session Frontend. Presets might be the workaround (or some C++ way), however, I have not given it a proper look yet, but soon.

  1. Functional Tests have no way to emulate inputs on their own, at least I couldn’t find any answers on how to do that. The only way to go I have managed to find and simple enough to understand and replicate is by creating your own events side by side with the ones called in the UI widgets. Then you can call them in your Functional Test blueprint.

This does not subsistute UI testing, it’s just a means to move through UI without user input (i.e., for comparison screenshot gathering), until proper input can be emulated. Clicking through UI is still advised to be the manuał job for QA. :slight_smile:

  1. Functional Tests need to be attached to a level for them to be started. This poses a problem since when you switch levels the test itself is not persistent, resulting in it being marked as ‘Aborted’ and failing. I am yet to find a way to make it as a persistent presence (something in the likes of DoNotDestroy in Unity).

That is all for now. More to come as I learn via the Cropout Sample Project. :smiley:

[INFO DUMP: Island Generator Blueprint]

I couldn’t make the Functional Tests work with the current project set up (levels being opened and everything being destroyed afterwards), so those are still being aborted on level change. Not a big deal at the moment as my Functional UI Tests within a single scene are almost done (that topic next time).

Decided to detour towards understanding the Cropout project better one blueprint at a time before I attempt at making the world a streaming one (Main Menu being persistent while Village becomes a sub level). Below are the results for the Island Generator:

1. Preparing the Dynamic Mesh

Few things to note:

  • Original Blueprint moves the Island on each creation alongside the Z place, thus, keeping the Actor at the Origin point will save us from potential headaches later (should we play this game for a long time)
  • I have added in the later sections the Array for Cone Sizes which is closely tied to Spawn Marker (this will be useful for spawning objects within bounds of the cones which I am rewriting slowly) - we need to clear the said Array otherwise it will store the values each time you start the blueprint which we don’t want

2. Spawning the Cylinders

Main Point:

  • Expose as many variables as it makes sense - it will speed up your iteration process and reduce the chance of you scratching your head on why something is not working to find out it was because you have forgotten about some obscure Magic Number you set ages ago
  • Reroute Nodes are your Friends :smiley:

3. Forming the Island

Main Point:

  • Again, exposing the variables makes understanding the code so much easier. Especially when trying to figure out the Mesh Plant Cut or the importance of the Z Dimenation in the Blueprint
  • Other than that, cool learning experience in regards to transforming cylinders - worth digging deeper

4. Clean Up

Few things to note:

  • Releasing All Compute Meshes is used here as an anti-memory leak since we use the Geometry Script (if I understand the documentation related to those nodes correctly)
  • Moving slightly the Island is means for faster (?) iteration (again, just an assumption as it’s quite convenient to see changes on each variable change, although quite slow on my machine)
  • My brain didn’t initially click but Col is obviously Colour and not column (oh, my Excel part of the brain :smiley: )

[INFO DUMP: Island Generator / Spawner]

As I was figuring out the Island Generator related Blueprints I have noticed that in some cases (most likely due to me messing up with a few things) the Interactables were being spawned on the water and that made me think on why and how to potentially fix it (or improve it).

Below are the results of my trials with many errors. :smiley:

1. Addition to the BP_IslandGen


I decided to go for the simplest approach my brain could put first on paper and then somehow into Blueprints, and that was to spawn the Interactables within a specific radius range (see math: calculus - How to calculate cone radius for given height - Mathematics Stack Exchange).

Things to note:

  • Obviously, island is made out of combined cylinders turned into cones for the slope effect (once all the geometry magic happens), so referring to the Radius already in the BP would be the solution, right? Yes, but not exactly. Despite Radius used and having the Nav Volume Bounds already in the original set up, the Villagers and Interactables behaved as if that didn’t matter (the Area seemed correct when pressing P which shows you the navigable space)
  • Silly for me, and it took me a while, the Radius was the base side of the cone which resulted in the spawning/walking area being way bigger) - additionally, the Z point of the Bottom Plane Cut influenced that as well, as watever was under the water added to the whole problem even after I have swapped out the ‘Get Random Location in the Navigable Radius’ for ‘Get Random Reachable Point In Radius’ which didn’t make any difference (I am keeping it for future iteration of the Villager logic as I have read the Reachable Point is used for smarter AI navigation, if I understand it all correctly)
  • Then the Math Spirit hit me and I found a way to calculate the radius I needed (see the calculus link above) - still, in some cases the things appeared above water. To avoid those situations I have implemented a check to measure the Vector Distance from the Center Point of the Place Cut Radius (BP below for reference) and with a Buffer for the Sand Edges it worked out quite nicely

The outcome with some follow up things to do (in case I forget or others want to take a bite at it):

  • More even randomisation of the Interactables (as you can see, some areas are more empty than others)
  • Elements spawning only within the sand area (sea sheels or crabs would feel nice :slight_smile:)

With that figured out and done now, all I need to do next is to rewrite the SpawnAssets function to do the same to see all the Stone and Trees and Bushes working together on a single map and fix new problem from that, which will happening for sure. :smiley:

[INFO DUMP: Island Generator / Spawner > Continued]

I did finally rewrite the SpawnAssets function, and as I was doing so, I came to realise that I could just make a macro out of it (at least whatever code gets repeated to make it less time consuming if I end up adding something new). Here is how it ended up looking. :slight_smile:

P.s. I’ve noticed that some of my images ended up being blurry in previous posts (can’t edit anymore) so will try to cut things into more manageable pieces making in a better quality.

1. The Macro


I think the most important things to note here would be:

  • Making a local variable requires 2 parts: Local and Assign nodes (for more specialised types I have used Local Wildcard, not sure whether that’s the way to go or not but all seems to work exactly the same as before)
  • Since macro’s insides are a bit naming dry you really need to make sure the flow and important bits are well documents (even better than I did it :smiley: ), ideally with comments and meaningful name in the Input/Output nodes

2. The updated Functions (SpawnInst)

3. The updated Functions (SpawnAssets)

Haven’t exposed all the variables yet for both of the functions as still need to check what does what and whether it’s even worth it. Anyways, since that’s done, I can check the Event Graph of the BP_Spawner itself. :smiley:

Oh, and here is the island with everything put together, while I detour to another problem to figure out: Why villlagers walk on water?