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"

How can I set up pathfinding of a pawn of a player controller in a networked game?

Hello,

I'm developing a basket ball game.

I would like, when a basket is scored, to move all players to pre-defined spots on the court, where they will be able to do the throw in.

To move the bots, I use the function AAIController::MoveToLocation, and everything goes fine, either in a standalone game or in a networked game.

The problem is with the player controllers: in a standalone game, everything is fine, whereas when networking is involved, the pawns move to their destination, but the movement is jerky.

To make the pawns of the player controller move, I tried two solutions (which are pretty similar):

  • The first solution was to use the UNavigationSystem class, and call SimpleMoveToLocation on it.

  • The other solution consisted in implementing in my custom PlayerController class almost the same code found in AAIController. But the result is the same as the code above.

My guess for the jerky movement is that the component which manages the position the pawn must be along the path is in conflict with the server movement prediction.

I've started to dig in the source code of PlayerController, to check if I can override a function to disable this behavior while the pawn is in pathfinding mode, but I didn't have much success until now.

I was also thinking to another solution, and I'd like your opinion about that: do you think it would be a good idea, when I use pathfinding on a player controller, to switch the controller of the pawn to an AIController, then execute the path finding and the moving of the pawn to the desired location, and when the pawn is there, switch back to the previous PlayerController?

Or do you think there may be another solution?

Thanks in advance

Product Version: Not Selected
Tags:
more ▼

asked May 05 '14 at 01:56 PM in C++ Programming

avatar image

Zoubi
172 22 30 35

avatar image Omberone May 09 '14 at 11:56 AM

I have the same problem, but with a MOBA-type control scheme. I'm afraid I can't switch to an AI controller everytime I need to pathfind. Did you come up with something that suited your needs?

avatar image Zoubi May 09 '14 at 12:03 PM

Unfortunately no :/

avatar image Omberone May 10 '14 at 01:36 PM

Wanna brainstorm with me with what could be causing this? I'm thinking that the client-prediction (since it has no path to follow) has something to do with it. But then again the server is in total control here, and it should still move the clients pawn forcefully if it had to. The client shouldn't have any control of the positioning or translation of the pawn in the end.

(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