7 Commits

Author SHA1 Message Date
8c1de34eb5 Merge pull request 'Solved movement and basic replication' (#1) from multiplayerv2 into main
Reviewed-on: http://git.keeper317.com/Keeper317/open-conflict/pulls/1
2025-11-23 03:22:14 +00:00
c0152e2db4 Expanded playground play area 2025-11-22 22:18:41 -05:00
44d54457ae fixed character movement issue 2025-11-22 22:18:21 -05:00
73a3aac159 renamed files to fit convention 2025-11-22 19:07:48 -05:00
bb0d0a8660 problem solved, no idea why 2025-11-22 16:28:39 -05:00
a59399ebfe continued setup 2025-11-22 00:34:20 -05:00
c91d73ed33 Base files added
May have an idea of what caused problem
2025-11-21 23:38:16 -05:00
17 changed files with 265 additions and 1 deletions

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -7,7 +7,10 @@
{ {
"Name": "OpenConflict", "Name": "OpenConflict",
"Type": "Runtime", "Type": "Runtime",
"LoadingPhase": "Default" "LoadingPhase": "Default",
"AdditionalDependencies": [
"Engine"
]
} }
], ],
"Plugins": [ "Plugins": [

View File

@@ -0,0 +1,5 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "DDIGamemodeBase.h"

View File

@@ -0,0 +1,17 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/GameModeBase.h"
#include "DDIGamemodeBase.generated.h"
/**
*
*/
UCLASS()
class OPENCONFLICT_API ADDIGamemodeBase : public AGameModeBase
{
GENERATED_BODY()
};

View File

@@ -0,0 +1,35 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "DDICharacter.h"
// Sets default values
ADDICharacter::ADDICharacter()
{
// Set this character to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
bReplicates = true;
// bReplicateMovement = true;
CameraComponent = CreateDefaultSubobject<UCameraComponent>(TEXT("CameraComponent"));
CameraComponent->SetupAttachment(GetMesh());
CameraComponent->SetRelativeLocation(FVector(0.0f, 0.0f, 50.0f));
CameraComponent->bUsePawnControlRotation = true;
}
// Called when the game starts or when spawned
void ADDICharacter::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void ADDICharacter::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}

View File

@@ -0,0 +1,29 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Camera/CameraComponent.h"
#include "GameFramework/Character.h"
#include "DDICharacter.generated.h"
UCLASS()
class OPENCONFLICT_API ADDICharacter : public ACharacter
{
GENERATED_BODY()
public:
// Sets default values for this character's properties
ADDICharacter();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Camera")
UCameraComponent* CameraComponent;
};

View File

@@ -0,0 +1,100 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "DDIPlayerController.h"
#include "EnhancedInputComponent.h"
#include "EnhancedInputSubsystems.h"
#include "GameFramework/Character.h"
ADDIPlayerController::ADDIPlayerController()
{
}
void ADDIPlayerController::BeginPlay()
{
Super::BeginPlay();
if (UEnhancedInputLocalPlayerSubsystem* Subsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(GetLocalPlayer()))
{
for (UInputMappingContext* CurrentContext : MappingContexts)
{
Subsystem->AddMappingContext(CurrentContext, 0);
}
}
}
void ADDIPlayerController::SetupInputComponent()
{
Super::SetupInputComponent();
if (UEnhancedInputComponent* Subsystem = Cast<UEnhancedInputComponent>(InputComponent))
{
if (MoveAction) Subsystem->BindAction(MoveAction, ETriggerEvent::Triggered, this, &ADDIPlayerController::Move);
if (LookAction) Subsystem->BindAction(LookAction, ETriggerEvent::Triggered, this, &ADDIPlayerController::Look);
if (JumpAction)
{
Subsystem->BindAction(JumpAction, ETriggerEvent::Started, this, &ADDIPlayerController::Jump);
Subsystem->BindAction(JumpAction, ETriggerEvent::Completed, this, &ADDIPlayerController::JumpEnd);
}
}
}
void ADDIPlayerController::OnPossess(APawn* InPawn)
{
Super::OnPossess(InPawn);
// is this a shooter character?
// if (ADDICharacter* DDICharacter = Cast<ADDICharacter>(InPawn))
// {
// // add the player tag
// DDICharacter->Tags.Add(PlayerPawnTag);
// }
}
void ADDIPlayerController::Move(const FInputActionValue& Value)
{
const FVector2D MovementVector = Value.Get<FVector2D>();
if (APawn* ControlledPawn = GetPawn())
{
FRotator CameraRotation = GetControlRotation();
FRotator YawRotation(0.f, CameraRotation.Yaw, 0.f);
FVector ForwardDiection = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::X);
FVector RightDirection = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::Y);
ControlledPawn->AddMovementInput(ForwardDiection, MovementVector.Y);
ControlledPawn->AddMovementInput(RightDirection,MovementVector.X);
}
}
void ADDIPlayerController::Look(const FInputActionValue& Value)
{
const FVector2D LookAxisVector = Value.Get<FVector2D>();
if (APawn* ControlledPawn = GetPawn())
{
AddYawInput(LookAxisVector.X);
AddPitchInput(LookAxisVector.Y);
}
}
void ADDIPlayerController::Jump(const FInputActionValue& Value)
{
if (ACharacter* character = GetCharacter())
{
character->Jump();
}
}
void ADDIPlayerController::JumpEnd(const FInputActionValue& Value)
{
if (ACharacter* character = GetCharacter())
{
character->StopJumping();
}
}

View File

@@ -0,0 +1,70 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "EnhancedInputComponent.h"
#include "EnhancedInputSubsystems.h"
#include "GameFramework/PlayerController.h"
#include "DDIPlayerController.generated.h"
/**
*
*/
UCLASS()
class OPENCONFLICT_API ADDIPlayerController : public APlayerController
{
GENERATED_BODY()
/*UPROPERTY and UFUNCTION declarations*/
private:
/*Properties*/
/*Functions*/
protected:
/*Properties*/
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "INPUT", meta = (AllowPrivateAccess = "true"))
TArray<class UInputMappingContext*> MappingContexts;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "INPUT", meta = (AllowPrivateAccess = "true"))
UInputAction* JumpAction;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "INPUT", meta = (AllowPrivateAccess = "true"))
UInputAction* MoveAction;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "INPUT", meta = (AllowPrivateAccess = "true"))
UInputAction* LookAction;
UPROPERTY(EditAnywhere, Category="Shooter")
FName PlayerPawnTag = FName("Player");
/*Functions*/
public:
/*Properties*/
/*Functions*/
/*C++ only declarations*/
private:
/*Properties*/
/*Functions*/
protected:
/*Properties*/
/*Functions*/
virtual void SetupInputComponent() override;
virtual void BeginPlay() override;
virtual void OnPossess(APawn *InPawn) override;
void Move(const FInputActionValue& Value);
void Look(const FInputActionValue& Value);
void Jump(const FInputActionValue& Value);
void JumpEnd(const FInputActionValue& Value);
public:
/*Properties*/
/*Functions*/
ADDIPlayerController();
};