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"

How would I go about spawning actors/component for one player?

How would I go about spawning actors/components for a single player?

I'm working on creating a chunk based world and the server is responsible for generating the terrain data. However, not all players need all the generated data. Is it possible to only spawn actors/components for the relevant players?

Product Version: UE 4.14
more ▼

asked Dec 31 '16 at 10:11 PM in Using UE4

avatar image

827 38 40 242

avatar image Dartanlla Jan 01 '17 at 04:38 AM

Have you looked at level streaming? It has some limitations, but is fairly close to what you are describing. It got an update in 4.14 to support world origin shifting and now it kind of supports multiplayer. The docs for it say the it only replicates actors to players who need the data, but all actors are on the server.

avatar image MJ_01 Jan 01 '17 at 11:30 PM

I had tried that but that requires the level to already exist. I also tried level instances but they only load on the server.

avatar image Dartanlla Jan 02 '17 at 12:00 AM

Yeah, I was afraid of that. I have a feeling that if you want to do exactly what you are saying you are going to have to dive in to the source code related to level streaming and then build your system based on that. It sounds like a lot of work.

For what I want to do, level streaming just doesn't seem to work well for multiplayer, even with the 4.14 fixes. So I am using map levels as chunks to build a larger world and instead of streaming them I am transferring the player between the map servers. Yeah, it has an annoying 1 or 2 second load time, but I get to build worlds of infinite size and performance as long as I have enough map servers. I don't see any other solution using what is built in to the engine.

avatar image MJ_01 Jan 02 '17 at 03:45 AM

After a bit more playing around, it looks like what I want to do is create a subclass of actor that overrides AActor::IsNetRelevantFor. In this function, I can implement a view distance based system. If an actor is outside that view distance, then the server automatically removes it from the client and it no longer replicates to the client until it has entered that view distance again. The view distance used will be the same value used to load and unload chunks.

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

0 answers: sort voted first
Be the first one to answer this question
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