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. 

Whats the performance of PawnInterator and similar?

Hi, im making some AI systems(Rocket new AI is awesome but not even close to be used) and ive added some things like OnSeePawn event to my controller and noise signals. What im doing with the OnSeePawn its to do a PawnInterator and check angle and trace if he can be seen. But im not very sure of whats the performance of that iterator, and as its something i do several times a second(its a timer), on every AI, i want to know if its performance hungry or not. I would optimize it by storing those pawns in a array in the gameinfo, and instead of using the iterator, grab the pawns from there. Iterating from that its kinda fast. But, of course, if the performance of PawnIterator is minimal, i dont need to do that. Exactly the same with another interface im doing to detect sounds. I have a "DoNoise" function wich sends a message to all close AIs, and i have to iterate trough an iterator. I can also do what i said above, storing them when they are created and use that, but it adds some overhead causing me to take care that every AI registers itself and unregisters when dies/gets destroyed. On short, if the PawnIterator and ActorIterator are usefull and dont take too much performance compared to just storing them somewhere.

Product Version: Not Selected
Tags:
more ▼

asked Mar 11 '14 at 02:40 AM in C++ Programming

avatar image

ue4-archive ♦♦ STAFF
49.9k 3665 1993 9119

avatar image ue4-archive ♦♦ STAFF Mar 11 '14 at 02:40 AM

Hi Victor,

UWorlds maintain a pawn list, which PawnIterator uses, so this should be performant. The same holds true for the other iterators in World.h.

Cheers! Jeff

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

1 answer: sort voted first

Dear Victor,

I know that ActorIterator got a massive acceleration recently, as did ObjectIterator,

post on my question about actoriterator:

https://rocket.unrealengine.com/questions/13741/concerned-i-am-very-concerned-for-the-well-being-o.html

Obviously there is nothing faster than iterating only over an actor array that you yourself create and maintain,

but the additional code and array maintenance required could be large enough to offset any gains from the slightly shorter list that you are iterating over.

In my own experience of iterating over actor lists constantly, ObjectIterator and ActorIterator are so fast that I would never want to do all the array maintainence myself and forsake the convenience and accuracy of ActorIterator

Huge advantage of ActorIterator is that it is always accurate!

You never have to wonder if you mismanaged the array somehow

so for gain of engine-level accuracy of what actors are actually currently in the game, any price of checking a few extra actors is worth it to me.

It removes an entire layer of wondering from your mind when you are trying to debug something, if you know that the actor array is always accurate!

In the process of game development, you could use actoriterator for accuracy and ease now, and ultimately make things more complicated for yourself later on, much later, after all the core code is in and debugging has been done.

Project will grow much faster that way :)

And you'll probably never end up going back and making this more complicated for yourself anyways :)

:)

Rama

more ▼

answered Mar 11 '14 at 02:40 AM

avatar image

ue4-archive ♦♦ STAFF
49.9k 3665 1993 9119

avatar image ue4-archive ♦♦ STAFF Mar 11 '14 at 02:40 AM

I wonder if you have made any measurements. Just out of curiosity. How long would it take for 50 characters, to iterate over each other at the same time ?

I though about using actor iterator to gather information about actors that are hit and affected by character, and pass striped information back the UI, but I had some serious accuracy considerations, if I had to iterate over 1000 actors, over entire level, if I just need information about those 10 close to character.

Just to be clear I have solved this as well, with different approach.

I remember measuring looping inside ticker (hehe, I know that is plain stupid ;p), loop iterate over fairly small array of 4 elements, and there was also function to call over each ticker iteration. In the end delay was from about 200 ms to even 400 ms, which i though was unacceptable, for the accuracy I wanted. I have change it since, but now I'm quite wary of iterating over lots of data, when many actors must iterate over the same data at the same time.

(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