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"

MoveComponent Severe Performance Issues?

I have been messing with the TwinStickShooter example project to learn how to use UE4. I have created an Enemy Pawn (AEnemy) which has a very simple behavior in its tick function: it finds the closest player and moves towards them. They also detect when they are overlapping with other AEnemy objects and push themselves away from each other.

My issue is that when I get to a certain threshold of spawned enemies (about 100 to 200), the game starts to lag horribly, and it only gets worse exponentially as they keep spawning. I understand how performance works in game engines, but this just seems like far too low of a number of spawned actors so I am just assuming I am doing something wrong here. This is what my profiler is showing:alt text

Now, I don't know if I am reading this correctly since I am very new to the engine, but it seems like all the time loss is coming from the MoveComponent function inside of the Enemy class' tick function. I don't understand how this could be draining so much time though, since I am literally using the verbatim example from the player Pawn class that gets created with the example project:

     FHitResult Hit(1.f);
     RootComponent->MoveComponent(Movement, RootComponent->GetComponentRotation(), true, &Hit);
     if (Hit.IsValidBlockingHit())
     {
         const FVector Normal2D = Hit.Normal.GetSafeNormal2D();
         const FVector Deflection = FVector::VectorPlaneProject(Movement, Normal2D) * (1.f - Hit.Time);
         RootComponent->MoveComponent(Deflection, RootComponent->GetComponentRotation(), true);
     }

Is this the wrong method of moving around pawns? Is the engine just not capable of handling 100-200 Pawns all moving around simultaneously? Am I just reading the profiler incorrectly? I have so many questions about this but I can't seem to find any existing answers on this subject on here or elsewhere on the internet... I hope someone can help me figure this out. Thanks in advance!

Product Version: UE 4.14
Tags:
untitled.png (274.7 kB)
more ▼

asked Dec 06 '16 at 02:56 PM in C++ Programming

avatar image

K6L2
34 1 1 5

avatar image marineuac 6 days ago

necro 4 characters needed

(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