Alright, so I did some intensive searching before posting this thread, as it could be a complicated question. I haven’t the foggiest idea where to start.
- Our game is a 2D fighting game, that can have up to 4 potential players. This is based upon a combination of how many controllers there are and selection at the character select screen.
- This is (not at the moment) at networked game, I am addressing the issue of a fully local (1PC) multi controller fighting game.
We started with the Paper2D C++ template, and so far it has brought us a considerable way. Massive Kudos to the Unreal team for including that. It saved us allot of research time, and allowed us to dive right into the engine. On to the issue:
We need a camera similar to Smash Bros, where the camera will expand and shrink taking all 4 players (or less) into account.
Issue #1: RESOLVED
I’ve stripped out most of the original template stuff with no problem, the only bit left is the camera code. <- For some reason, I tried it again after cleaning out the ‘Intermediate’ folder and it compiled after removing this code.
// Create a camera boom attached to the root (capsule) CameraBoom = PCIP.CreateDefaultSubobject<USpringArmComponent>(this, TEXT("CameraBoom")); CameraBoom->AttachTo(RootComponent); CameraBoom->TargetArmLength = 200.0f; CameraBoom->SocketOffset = FVector(0.0f, 0.0f, 0.0f); CameraBoom->bAbsoluteRotation = true; CameraBoom->RelativeRotation = FRotator(0.0f, -90.0f, 0.0f); SideViewCameraComponent = PCIP.CreateDefaultSubobject<UCameraComponent>(this, TEXT("SideViewCamera")); SideViewCameraComponent->ProjectionMode = ECameraProjectionMode::Perspective; SideViewCameraComponent->OrthoWidth = 2048.0f; SideViewCameraComponent->AttachTo(CameraBoom, USpringArmComponent::SocketName); // Prevent all automatic rotation behavior on the camera, character, and camera component CameraBoom->bAbsoluteRotation = true; SideViewCameraComponent->bUsePawnControlRotation = false;
When I try to remove it, the editor just flat out crashes on compile. I removed all references to this camera in the headers, and in the base character code. It persist to crash my editor.
How would I go about having a camera detect all 4 players and reference their position? I don’t mind completely writing the camera in the blueprint editor and making a copy for each stage. I assume I can’t be attaching a new camera component to each player, as is done by default in the base character code now.
How do I even handle mutliplayer? I’ve searched and searched on this and keep finding information networked games. I’ve unticked the ‘Split Screen’ option, but am lost from that point on.
I think this is probably a silly question, but I will ask anyhow. When handling multiplayer, I noticed the spawn points are already randomized, which is exactly what we wanted, however, we don’t want 2 players starting at the same spawn point, is there a flag to check if a spawn point is occupied? I assume this is along the lines of what I am looking for?
I think I am just going to use the tag field, and ‘mark’ a spawn point once a player has been initialized there.
This is a shot of what we’re working with:
Basically, I can use any information on setting up a local player game (no networking of any kind involved) using one or more controllers, and how to make them all use a single camera during a game mode via C++. I could also place the camera as a blueprint per level, and set it up that way. We are using a plugin for direct input controllers, but advice on standard controllers will work just as well.
Thanks again for helping out. It is very appreciated. We are transitioning our entire project from Game Maker and I haven’t used Unreal for game development since the old UDK, so any help is welcome.