Working with level streaming and random content

Hey there,

I’m trying to get my idea going on building a space game with randomly generated areas.
(note I kinda described it with at https://www.udemy.com/unrealcourse/learn/v4/questions/1905492 )

There are several issues I am encountering.

  • As the issue in the link started… I just can’t seem to get the simple concept going of loading a new skybox when I enter a new region… one would think it’s as simple center of new location = center of old location + width of cube … right?

I tried to accomplish this in the code below and I’m not entirely sure what I’m doing wrong. The GetSafeNormal is kinda confusing as well as one would expect something to return like: 0,0,1… but in stead it get’s non rounded values which is quite frustrating

(OnEndOverlap event in ASkyDome)

FVector direction = (theActor->GetActorLocation() - this->GetActorLocation()).GetSafeNormal();
FVector loc;
FVector boundsExtend;	
GetActorBounds(false, loc, boundsExtend);
FVector location = loc + boundsExtend.Y * direction;
FRotator rotation(0.0f, 0.0f, 0.0f);
FActorSpawnParameters spawnInfo;	
GetWorld()->SpawnActor<ASkyDome>(ASkyDome::StaticClass(), location, rotation, spawnInfo);

  • I’m not sure if my mindset is the right one… I’m thinking:

  • Player get’s to edge of room it spawns a new empty box (skybox) I defined this by having 2 cubes, inner and outer… when inner get’s passed the above overlap event is triggering

  • New Level get’s streamed into said box, this level either get’s loaded from disk/network (multiplayer?) or generated if it doesn’t exist (kinda thinking in the “chunk” thinking of minecraft)

  • When in the new Level the Overlap Enter is triggered of the inner cube, destroy the old level from memory

  • Also I’m not 100% sure what to do with the skybox actually… like I am not keen on the idea of a static skybox … (ergo I have created the ASkyDome class) … like how would one create a dynamic skybox based on existing level data and actually show this? If I go by wht’s in my mind, it should be generated based on existing level center point (stars if you will) but I can imagine this being a pain.
    This said, not every cube in said idea has to be one with a star … this should be kinda random… could even be an empty cube. This to generate the feeling of space ofc…

Well if you’re trying to determine the direction an actor leaves a trigger volume, why not just use the normalised velocity of it?

ah that makes sense… I could try that… but the above should work right? I’m not going nuts? :stuck_out_tongue:

I don’t think so, but then again I suck at vector maths.

if only anyone could help :stuck_out_tongue:

I’m trying to do it in little steps… but if even the little steps fail … it kinda kicks down motivation

Privacy & Terms