Questions about procedural biome generation with event dispatchers,

Hello. For the last while I have been trying to figure out the best method of returning a boolean value of whether or not the player has entered a created component sphere within a seperate blueprint; and if they have entered the collision, and return a true value, another blueprint is called that deals with the specific biome generation parameters. (ie, temp, noise algorithms, altitudes, splines, etc). Alongside that I’ve been trying to figure out how to get a value of where exactly the player is between the centre and radius; so having the world pos of the player returning a value relative to the sphere radius and location.

I have a basic to intermediate understanding of how to do things inside unreal, but yet I cannot wrap my head around the most effective ways of using event dispatchers (nor have I really done procedural generation before). That is, assuming that is what I need.

The images below are under the DiscriminateBiome function, which may not be entirely accurate anymore. (Majority of code, anyways)


Some relevant code from the terrain gen bp

player bp

To further organize (and optimize), the last moving part is another actor which does only the sphere collision generation.

Tl;dr - How to use event dispatchers to determine whether the player actor has entered a collision sphere built as a component?
Thank you.

Feel free to ignore the bottom. Just some other concepts I need assistance in realizing.

(and additonally, limit the procedural mesh generation to the component; get a normalized gradient between the centre and radius of the collision sphere, and limit procedural mesh generation to a little bit outside the confines of a collision sphere; and I suppose reiterate and create another sphere when the player reaches an activation threshold on the gradiant)

To achieve what you described, you can use a combination of collision detection, event dispatchers, and Blueprint scripting in Unreal Engine. Here’s a step-by-step guide on how you can implement it:

1. Setting up Collision Sphere Component:

  • In your player actor blueprint, add a Collision Sphere component.
  • Adjust the size and position of the collision sphere as needed.

2. Collision Detection:

  • Implement overlap or collision events in your player actor blueprint to detect when it enters or exits the collision sphere.

3. Event Dispatchers:

  • Create a custom event dispatcher in your collision sphere actor blueprint. This dispatcher will be triggered when the player enters the collision sphere.
  • Bind this event dispatcher to the overlap or collision event in your player actor blueprint.

4. Procedural Biome Generation:

  • In response to the event dispatcher being triggered, call a function or event in another blueprint that handles biome generation.
  • Pass relevant parameters (such as temperature, noise algorithms, etc.) to this blueprint for biome generation.

5. Getting Player Position Relative to Sphere:

  • In the overlap or collision event in your player actor blueprint, you can get the player’s world position.
  • Calculate the distance between the player and the center of the collision sphere.
  • Normalize this distance to get a value between 0 and 1, representing the player’s position relative to the sphere radius.

6. Limiting Procedural Mesh Generation:

  • Use the normalized distance calculated above to determine how far outside the collision sphere the procedural mesh generation should occur.
  • Generate procedural mesh only within this range.

7. Reiterating Sphere Activation Threshold:

  • Set a threshold value for the normalized distance at which you want to trigger the generation of a new collision sphere.
  • Monitor the player’s position relative to the sphere and activate a new sphere when this threshold is reached.

Additional Tips:

  • Ensure proper management of event bindings and unbindings to avoid memory leaks.
  • Test and iterate on your implementation to ensure it behaves as expected in different scenarios.

By following these steps, you should be able to use event dispatchers to determine whether the player actor has entered a collision sphere and trigger biome generation accordingly. Let me know if you need further clarification or assistance with any specific part of the implementation!