x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Procedural level generation + streaming in c++

Hi guys,

i have a 'little' problem where i don't know how to proceed. I'm working on a game which wholly relies on runtime procedural generation. (Starting the game will calculate the game world/levels, code inside GameMode works fine)

What i can't figure out, is how to add streaming levels to my world. Level generation is not the problem, but i would like them to be streamed, since i have multiple floors. The floors themselves can be quite big, so my ultimate goal would be to divide one floor into multiple parts too, but floor by floor is more important.

My questions:

  • How do i convert a UWORLD to a ULEVEL? Direct cast doesn't work (no wonder) and i didn't find any functions to save a world to disk (functions which are not based on editor code).

  • Will levels automatically be loaded/shown if i set the streaming volumes correctly or do i need additional code for that? (added with uworld->AddLevel)

  • Will levels added to the World in StartPlay of the GameMode be ok or do i have to pre-generate the world with the levels, then save and reload?

Regards

Algorithman

Product Version: UE 4.13
Tags:
more ▼

asked Oct 10 '16 at 10:37 AM in C++ Programming

avatar image

Algorithman
53 5 7 10

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

An UWorld is not an ULevel, so you can not just save/load or transform between them. If you use streaming volumes and out-of-the-box level streaming all will be handled automatically.

While I guess you are not seeking for adding level in editor rather than in runtime. For a more procedural approach of levels you can use the BP node Load Level Instance, you can use it to load a level and spawn in your current world. Thus it does not get replicated automatically, neither do BSPs work in them (every BSP will stay at they relative position).

The bad news is that the method is not available to C++ because it's exposed as the MinimalApi but again, you can just check what it does. In my case I use my own one that implements replication.

Regarding when to generate the level I generate the data in the server (GameMode could be a good place, depends on your game though). Once you know what to generate you just send that source data to each client and sync the world generation. Same applies for a SP game where you just load/save the source data used to generate your level.

Cheers, Moss

more ▼

answered Oct 10 '16 at 01:26 PM

avatar image

Moss
6.4k 127 98 606

avatar image Algorithman Oct 10 '16 at 04:54 PM

Thx Moss for the answer.

I see what you referring to. But Load Level Instance isn't what i'm looking for.

What i need is:

  • Empty UWorld to add streaming levels to(ok)

  • Empty Map/Level (how?)

  • Create content in empty map (should be no problem)

  • Save Map (needed, since calculation take some time)

  • Load Map parts on demand aka streaming

My content generation builds on instanced static meshes and quite a bit dynamic lighting. While the ISM's can easily be occluded, the light sources steal quite a bit fps. Thats why i want to try it with streamed levels. 100 lights or 500 lights make quite a difference even when not shown (Particle effects etc). I probably can optimize them more but my thought was: whats not loaded cant be calculated -> doesn't eat fps.

avatar image Moss Oct 11 '16 at 12:42 PM

You can just open a new map from code in the editor but you wont be able to load/save a map in runtime without editor support.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question