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"

First person spectator camera

Hi,

I'm doing a project for school, and I am struggling with blueprints. What I want to achieve with networking is, while someone is playing a FPS character as the server, every client which are connecting to the server spawn as a first person spectator camera seeing what the server player is doing.

I would use this setup for a VR Showcase, in order to allow the audience to see what the VR player is doing in game.

I guess it's easily doable but I'm a noob with BPs, and I could not figure it out. Even after reading the documentation and exploring First Person Shooter example and UT BPs.

Some assistance would be greatly appreciated !

Product Version: Not Selected
Tags:
more ▼

asked Mar 24 '15 at 02:49 PM in Blueprint Scripting

avatar image

as3ef2th1
31 1 3 4

avatar image alperenakyuz Mar 25 '15 at 06:35 AM

It's fairly straightforward actually. Give me some time untl i return to my pc and I'll post you a proper answer with intructions.

avatar image as3ef2th1 Mar 25 '15 at 09:24 AM

Thanks ! It would be really helpful.

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

2 answers: sort voted first

Hey,

I needed similar thing and managed to find a solution.

It turns out, that UE4 has spectator functionality built-in. It's just not properly documented and advertised.

There's a set of functions that allows you to cycle through players if you are curently spectating.

I'm attaching the project that has this figured out. I've tried it on GearVR and PC. GearVR was acting as a server (so that spectating functionality is optional).

By default the game loads an entry map, that immediately chainloads another map but with ?listen parameter to make sure that the game starts as a listen server.

Next, you can connect from PC with another instance of the game:

 cd C:\Program Files\Epic Games\4.10\Engine\Binaries\Win64
 UE4Editor.exe C:\Path\to\project\NetTest.uproject 10.0.0.5?SpectatorOnly=1 -game

Replace path and ip accordingly. The SpectatorOnly=1 causes the player to immediately become a spectator (Look at AGameMode::Login()).

After you connect, press PageUp and PageDown to cycle through players, and Home to go back to free flight camera (in this example it's quite limited becuase it's set up for mobile controls).

Relevant logic (not much of it) is implemented in Content\FirstPersonBP\Blueprints\Spectator asset and in ANetTestPlayerController class.

Effectively, spectator functionality is implemeted as changing the view target in PlayerController/PlayerCameraManager ( APlayerController::SetViewTarget() ).

If you have more questions, feel free to ask.

Link to example: https://www.dropbox.com/s/po8hqbmni20lnir/NetTest.zip?dl=0

more ▼

answered Jan 28 '16 at 09:46 AM

avatar image

MiKom
535 17 10 39

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

Ok, the best way I think would be to start all players with spectator pawns and let the server one switch to a playable character later on. It is also possible to set up spectator/player classes properly as in a regular competitive FPS, but no need for it right now.

Start with the Default Pawn (it comes with the engine and is set by default if you ) set as your character in the Game Mode. Then spawn a playable character from the server blueprint (you can put a has authority switch to check if it's indeed the server) and get your player controller to possess it.

more ▼

answered Mar 25 '15 at 11:38 AM

avatar image

alperenakyuz
2k 62 24 111

avatar image as3ef2th1 Mar 29 '15 at 03:35 PM

Back again

So I did what you suggested, and indeed it works fine. Everyone connecting to the game spawn as a spectator and only the host can possess the character pawn.

Now I struggle with the first person camera thing. I tried to create an camera actor, and then to attach it to my playable character pawn. Obviously it's tied to the mesh and not the actual camera of the character pawn.

So far I was unable to replicate the camera view of my playable character pawn to the other camera actor. Any idea?

avatar image alperenakyuz Mar 30 '15 at 09:15 PM

As long as the playable pawn character has a camera, possessing it would automatically activate its camera and deactivate others actually.

avatar image as3ef2th1 Mar 30 '15 at 09:34 PM

I think I have not explained the situation well enough. It's a two players showcase :

  1. One player is the host, and will take control of the playable character pawn (with the oculus rift)

  2. The other player is a spectator, always. He starts as a default spectator pawn, but I want him to be able to see the playable character pawn point of view. To be honest, the point is to record this second view on another computer without impacting the first player (the oculus rift is very needy in ressources).

I don't know why what seems a really basic feature of every multiplayer game seems so hard to achieve, I guess I'm not familiar enough with the BPs. But to be honest, I litteraly lost half a day toying with BPs with little results.

avatar image BlackDog Dec 10 '15 at 02:13 AM

Curious - did you ever solve this problem? I'm looking at something similar and would love to hear how you resolved.

avatar image as3ef2th1 Dec 10 '15 at 06:45 AM

Not really.

I was able to "stitch" the camera to the player someway but I could not figure out how to make it follow the view of the player. The camera was linked to the head of my character but it did no't take into account head movements. Time was going on and I just gave up to be honest.

I have the feeling that you can adapt the C++ code from Unreal Tournament multiplayer to achieve this. I looked into the code at the time (a few months ago) and it seems it requires some deep editing in order to transpose a working spectator camera to another project.

Maybe it's easier nowadays since I work on other projects right now and don't really have time to toy with the new UE releases. If you find a way somehow, it would be nice to post it here.

(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