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"

[Networking] Spawning players on specific player starts

Okay so I am currently working on a small game to play for me and my friends.

Assigning teams is the same logic as in the ShooterGame template.

Now I found out that the way it is programmed in the shootergame template it does not work. This is because the moment a playerstart is chosen the playercontroller doesn't know yet on what team it is.

I also found a really old bug pointing to this. https://issues.unrealengine.com/issue/UE-27464

If somebody would be so nice to point me into the right direction. Preferable someone with networking experience.

I already found the GameMode call logic which is: PreLogin -> ChoosePlayerStart -> Login -> PostLogin

So the moment my playercontroller is assigned a team at the moment is in the PostLogin method which I think is the correct method to put such logic in.

I don't understand why ChoosePlayerStart is called before the Login method because that one creates the PlayerController.

Product Version: UE 4.20
Tags:
more ▼

asked Oct 11 '18 at 02:03 PM in C++ Programming

avatar image

MrMightyErik
8 1 2 4

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

When a PlayerController is initialized it calls FindPlayerStart that calls ChoosePlayerStart and moves the PlayerController and Camera to this spot.

On PostLogin RestartPlayer is called and FindPlayerStart and ChoosePlayerStart is called again to get a spawn location for the Pawn. You may just want to override RestartPlayer and perhaps get the team from there?

more ▼

answered Oct 11 '18 at 04:43 PM

avatar image

GarnerP57
656 2 4 6

avatar image MrMightyErik Oct 12 '18 at 09:48 AM

Got it working. Thanks for pointing me in the right direction.

(comments are locked)
10|2000 characters needed characters left

That's the cleanest way. Another dirtier way is to make the decault pawn class a spectator pawn, and when the player Spawns, do your own GetAllActorsWithTag and use whatever tag you added to the playerstarts you want it to be able to use, and then Spawn at that playerstart's location and possess the pawn.

But I recommend the clean way

more ▼

answered Oct 11 '18 at 06:20 PM

avatar image

mightyenigma
3.7k 18 19 20

(comments are locked)
10|2000 characters needed characters left
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