Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Relrin committed Dec 23, 2017
1 parent 64c563c commit 09a2e59
Show file tree
Hide file tree
Showing 67 changed files with 629 additions and 0 deletions.
71 changes: 71 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Visual Studio 2015 user specific files
.vs/

# Visual Studio 2015 database file
*.VC.db

# Compiled Object files
*.slo
*.lo
*.o
*.obj
*.pdb
*.modules
*.target

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib

# Fortran module files
*.mod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app
*.ipa

# These project files can be generated by the engine
*.xcodeproj
*.xcworkspace
*.sln
*.suo
*.opensdf
*.sdf
*.VC.db
*.VC.opendb

# Precompiled Assets
SourceArt/**/*.png
SourceArt/**/*.tga

# Builds
Build/*

# Whitelist PakBlacklist-<BuildConfiguration>.txt files
!Build/*/
Build/*/**
!Build/*/PakBlacklist*.txt

# Don't ignore icon files in Build
!Build/**/*.ico

# Configuration files generated by the Editor
Saved/*

# Compiled source files for the engine to use
Intermediate/*

# Cache files for the editor to use
DerivedDataCache/*
Binary file added Binaries/Win64/UE4Editor-FPSGame.dll
Binary file not shown.
10 changes: 10 additions & 0 deletions Config/DefaultEditor.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[UnrealEd.SimpleMap]
SimpleMapName=/Game/FirstPerson/Maps/FirstPersonExampleMap

[EditoronlyBP]
bAllowClassAndBlueprintPinMatching=true
bReplaceBlueprintWithClass= true
bDontLoadBlueprintOutsideEditor= true
bBlueprintIsNotBlueprintType= true


76 changes: 76 additions & 0 deletions Config/DefaultEngine.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
[/Script/Engine.CollisionProfile]
+Profiles=(Name="Projectile",CollisionEnabled=QueryOnly,ObjectTypeName="Projectile",CustomResponses=,HelpMessage="Preset for projectiles",bCanModify=True)
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel1,Name="Projectile",DefaultResponse=ECR_Block,bTraceType=False,bStaticObject=False)
+EditProfiles=(Name="Trigger",CustomResponses=((Channel=Projectile, Response=ECR_Ignore)))

[/Script/EngineSettings.GameMapsSettings]
EditorStartupMap=/Game/Maps/FirstPersonExampleMap.FirstPersonExampleMap
LocalMapOptions=
TransitionMap=
bUseSplitscreen=True
TwoPlayerSplitscreenLayout=Horizontal
ThreePlayerSplitscreenLayout=FavorTop
GameInstanceClass=/Script/Engine.GameInstance
GameDefaultMap=/Game/Maps/FirstPersonExampleMap.FirstPersonExampleMap
ServerDefaultMap=/Engine/Maps/Entry
GlobalDefaultGameMode=/Script/FPSGame.FPSGameMode
GlobalDefaultServerGameMode=None

[/Script/IOSRuntimeSettings.IOSRuntimeSettings]
MinimumiOSVersion=IOS_8


[/Script/Engine.Engine]
+ActiveGameNameRedirects=(OldGameName="TP_FirstPerson",NewGameName="/Script/FPSGame")
+ActiveGameNameRedirects=(OldGameName="/Script/TP_FirstPerson",NewGameName="/Script/FPSGame")
+ActiveClassRedirects=(OldClassName="TP_FirstPersonProjectile",NewClassName="FPSProjectile")
+ActiveClassRedirects=(OldClassName="TP_FirstPersonHUD",NewClassName="FPSHUD")
+ActiveClassRedirects=(OldClassName="TP_FirstPersonGameMode",NewClassName="FPSGameMode")
+ActiveClassRedirects=(OldClassName="TP_FirstPersonCharacter",NewClassName="FPSCharacter")

[/Script/HardwareTargeting.HardwareTargetingSettings]
TargetedHardwareClass=Desktop
AppliedTargetedHardwareClass=Desktop
DefaultGraphicsPerformance=Maximum
AppliedDefaultGraphicsPerformance=Maximum

[/Script/Engine.PhysicsSettings]
DefaultGravityZ=-980.000000
DefaultTerminalVelocity=4000.000000
DefaultFluidFriction=0.300000
SimulateScratchMemorySize=262144
RagdollAggregateThreshold=4
TriangleMeshTriangleMinAreaThreshold=5.000000
bEnableAsyncScene=False
bEnableShapeSharing=False
bEnablePCM=True
bEnableStabilization=False
bWarnMissingLocks=True
bEnable2DPhysics=False
LockedAxis=Invalid
DefaultDegreesOfFreedom=Full3D
BounceThresholdVelocity=200.000000
FrictionCombineMode=Average
RestitutionCombineMode=Average
MaxAngularVelocity=3600.000000
MaxDepenetrationVelocity=0.000000
ContactOffsetMultiplier=0.020000
MinContactOffset=2.000000
MaxContactOffset=8.000000
bSimulateSkeletalMeshOnDedicatedServer=True
DefaultShapeComplexity=CTF_UseSimpleAndComplex
bDefaultHasComplexCollision=True
bSuppressFaceRemapTable=False
bSupportUVFromHitResults=False
bDisableActiveActors=False
bDisableCCD=False
bEnableEnhancedDeterminism=False
MaxPhysicsDeltaTime=0.033333
bSubstepping=False
bSubsteppingAsync=False
MaxSubstepDeltaTime=0.016667
MaxSubsteps=6
SyncSceneSmoothingFactor=0.000000
AsyncSceneSmoothingFactor=0.990000
InitialAverageFrameRate=0.016667
PhysXTreeRebuildRate=10
7 changes: 7 additions & 0 deletions Config/DefaultGame.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[ProjectSettings]
ProjectID=(A=1823396784,B=1298598689,C=1743498150,D=-2048051708)
ProjectName=First Person Template


[/Script/EngineSettings.GeneralProjectSettings]
ProjectID=84280D9543200F6157F566BBB17DFDAE
31 changes: 31 additions & 0 deletions Config/DefaultInput.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[/Script/Engine.InputSettings]
+ActionMappings=(ActionName="Jump", Key=SpaceBar)
+ActionMappings=(ActionName="Jump", Key=Gamepad_FaceButton_Bottom)
+ActionMappings=(ActionName="Jump",Key=MotionController_Left_Trigger,bShift=False,bCtrl=False,bAlt=False,bCmd=False)

+ActionMappings=(ActionName="Fire", Key=LeftMouseButton)
+ActionMappings=(ActionName="Fire", Key=Gamepad_RightTrigger)
+ActionMappings=(ActionName="Fire",Key=MotionController_Right_Trigger,bShift=False,bCtrl=False,bAlt=False,bCmd=False)

+ActionMappings=(ActionName="ResetVR",Key=R,bShift=False,bCtrl=False,bAlt=False,bCmd=False)
+ActionMappings=(ActionName="ResetVR",Key=MotionController_Left_Grip1,bShift=False,bCtrl=False,bAlt=False,bCmd=False)

+AxisMappings=(AxisName="MoveForward", Key=W, Scale=1.f)
+AxisMappings=(AxisName="MoveForward", Key=S, Scale=-1.f)
+AxisMappings=(AxisName="MoveForward", Key=Up, Scale=1.f)
+AxisMappings=(AxisName="MoveForward", Key=Down, Scale=-1.f)
+AxisMappings=(AxisName="MoveForward", Key=Gamepad_LeftY, Scale=1.f)
+AxisMappings=(AxisName="MoveForward",Key=MotionController_Left_Thumbstick_Y,Scale=-1.000000)

+AxisMappings=(AxisName="MoveRight", Key=A, Scale=-1.f)
+AxisMappings=(AxisName="MoveRight", Key=D, Scale=1.f)
+AxisMappings=(AxisName="MoveRight", Key=Gamepad_LeftX, Scale=1.f)
+AxisMappings=(AxisName="MoveRight",Key=MotionController_Left_Thumbstick_X,Scale=1.000000)

+AxisMappings=(AxisName="TurnRate", Key=Gamepad_RightX, Scale=1.f)
+AxisMappings=(AxisName="TurnRate", Key=Left, Scale=-1.f)
+AxisMappings=(AxisName="TurnRate", Key=Right, Scale=1.f)
+AxisMappings=(AxisName="Turn", Key=MouseX, Scale=1.f)

+AxisMappings=(AxisName="LookUpRate", Key=Gamepad_RightY, Scale=1.f)
+AxisMappings=(AxisName="LookUp", Key=MouseY, Scale=-1.f)
Binary file added Content/Animations/FirstPerson_AnimBP.uasset
Binary file not shown.
Binary file added Content/Animations/FirstPerson_Fire.uasset
Binary file not shown.
Binary file added Content/Animations/FirstPerson_Idle.uasset
Binary file not shown.
Binary file added Content/Animations/FirstPerson_JumpEnd.uasset
Binary file not shown.
Binary file added Content/Animations/FirstPerson_JumpLoop.uasset
Binary file not shown.
Binary file added Content/Animations/FirstPerson_JumpStart.uasset
Binary file not shown.
Binary file added Content/Animations/FirstPerson_Run.uasset
Binary file not shown.
Binary file not shown.
Binary file added Content/Blueprints/BP_Player.uasset
Binary file not shown.
Binary file added Content/Blueprints/BP_Projectile.uasset
Binary file not shown.
Binary file added Content/Character/M_PlayerArms.uasset
Binary file not shown.
Binary file added Content/Character/Mesh/SK_Mannequin_Arms.uasset
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added Content/Character/Textures/UE4_LOGO_CARD.uasset
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added Content/Effects/Materials/M_Burst.uasset
Binary file not shown.
Binary file not shown.
Binary file added Content/Effects/Materials/M_radial_ramp.uasset
Binary file not shown.
Binary file added Content/Effects/Materials/M_smoke_subUV.uasset
Binary file not shown.
Binary file added Content/Effects/Materials/m_flare_01.uasset
Binary file not shown.
Binary file added Content/Effects/P_Explosion.uasset
Binary file not shown.
Binary file added Content/Effects/Textures/T_Burst_M.uasset
Binary file not shown.
Binary file added Content/Effects/Textures/T_Explosion_SubUV.uasset
Binary file not shown.
Binary file added Content/Effects/Textures/T_Smoke_SubUV.uasset
Binary file not shown.
Binary file added Content/Effects/Textures/T_Smoke_Tiled_D.uasset
Binary file not shown.
Binary file not shown.
Binary file added Content/Environment/MF_WorldUVs.uasset
Binary file not shown.
Binary file added Content/Environment/MI_BlockoutBasic.uasset
Binary file not shown.
Binary file not shown.
Binary file added Content/Environment/M_Blockout.uasset
Binary file not shown.
Binary file added Content/Environment/M_BlockoutSimple.uasset
Binary file not shown.
Binary file added Content/Environment/M_Cube.uasset
Binary file not shown.
Binary file added Content/Environment/M_Cube_Inst.uasset
Binary file not shown.
Binary file added Content/Environment/Shape_Cube.uasset
Binary file not shown.
Binary file added Content/Maps/FirstPersonExampleMap.umap
Binary file not shown.
Binary file not shown.
Binary file added Content/UI/FirstPersonCrosshair.uasset
Binary file not shown.
Binary file added Content/Weapon/FirstPersonProjectileMesh.uasset
Binary file not shown.
Binary file added Content/Weapon/M_FPGun.uasset
Binary file not shown.
Binary file added Content/Weapon/M_Projectile.uasset
Binary file not shown.
Binary file added Content/Weapon/SK_FPGun.uasset
Binary file not shown.
Binary file added Content/Weapon/SK_FPGun_PhysicsAsset.uasset
Binary file not shown.
Binary file added Content/Weapon/SK_FPGun_Skeleton.uasset
Binary file not shown.
Binary file added Content/Weapon/T_FPGun_M.uasset
Binary file not shown.
Binary file added Content/Weapon/T_FPGun_N.uasset
Binary file not shown.
16 changes: 16 additions & 0 deletions FPSGame.uproject
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"FileVersion": 3,
"EngineAssociation": "4.18",
"Category": "",
"Description": "",
"Modules": [
{
"Name": "FPSGame",
"Type": "Runtime",
"LoadingPhase": "Default",
"AdditionalDependencies": [
"Engine"
]
}
]
}
13 changes: 13 additions & 0 deletions Source/FPSGame.Target.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.

using UnrealBuildTool;
using System.Collections.Generic;

public class FPSGameTarget : TargetRules
{
public FPSGameTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Game;
ExtraModuleNames.Add("FPSGame");
}
}
13 changes: 13 additions & 0 deletions Source/FPSGame/FPSGame.Build.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.

using UnrealBuildTool;

public class FPSGame : ModuleRules
{
public FPSGame(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;

PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });
}
}
7 changes: 7 additions & 0 deletions Source/FPSGame/FPSGame.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.

#include "FPSGame.h"
#include "Modules/ModuleManager.h"

IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, FPSGame, "FPSGame" );

5 changes: 5 additions & 0 deletions Source/FPSGame/FPSGame.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.

#pragma once

#include "CoreMinimal.h"
101 changes: 101 additions & 0 deletions Source/FPSGame/Private/FPSCharacter.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.

#include "FPSCharacter.h"
#include "FPSProjectile.h"
#include "Animation/AnimInstance.h"
#include "Camera/CameraComponent.h"
#include "Components/CapsuleComponent.h"
#include "Kismet/GameplayStatics.h"


AFPSCharacter::AFPSCharacter()
{
// Create a CameraComponent
CameraComponent = CreateDefaultSubobject<UCameraComponent>(TEXT("FirstPersonCamera"));
CameraComponent->SetupAttachment(GetCapsuleComponent());
CameraComponent->RelativeLocation = FVector(0, 0, BaseEyeHeight); // Position the camera
CameraComponent->bUsePawnControlRotation = true;

// Create a mesh component that will be used when being viewed from a '1st person' view (when controlling this pawn)
Mesh1PComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("CharacterMesh"));
Mesh1PComponent->SetupAttachment(CameraComponent);
Mesh1PComponent->CastShadow = false;
Mesh1PComponent->RelativeRotation = FRotator(2.0f, -15.0f, 5.0f);
Mesh1PComponent->RelativeLocation = FVector(0, 0, -160.0f);

// Create a gun mesh component
GunMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("FP_Gun"));
GunMeshComponent->CastShadow = false;
GunMeshComponent->SetupAttachment(Mesh1PComponent, "GripPoint");
}


void AFPSCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
// set up gameplay key bindings
check(PlayerInputComponent);

PlayerInputComponent->BindAction("Jump", IE_Pressed, this, &ACharacter::Jump);
PlayerInputComponent->BindAction("Fire", IE_Pressed, this, &AFPSCharacter::Fire);

PlayerInputComponent->BindAxis("MoveForward", this, &AFPSCharacter::MoveForward);
PlayerInputComponent->BindAxis("MoveRight", this, &AFPSCharacter::MoveRight);

PlayerInputComponent->BindAxis("Turn", this, &APawn::AddControllerYawInput);
PlayerInputComponent->BindAxis("LookUp", this, &APawn::AddControllerPitchInput);
}


void AFPSCharacter::Fire()
{
// try and fire a projectile
if (ProjectileClass)
{
FVector MuzzleLocation = GunMeshComponent->GetSocketLocation("Muzzle");
FRotator MuzzleRotation = GunMeshComponent->GetSocketRotation("Muzzle");

//Set Spawn Collision Handling Override
FActorSpawnParameters ActorSpawnParams;
ActorSpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AdjustIfPossibleButDontSpawnIfColliding;

// spawn the projectile at the muzzle
GetWorld()->SpawnActor<AFPSProjectile>(ProjectileClass, MuzzleLocation, MuzzleRotation, ActorSpawnParams);
}

// try and play the sound if specified
if (FireSound)
{
UGameplayStatics::PlaySoundAtLocation(this, FireSound, GetActorLocation());
}

// try and play a firing animation if specified
if (FireAnimation)
{
// Get the animation object for the arms mesh
UAnimInstance* AnimInstance = Mesh1PComponent->GetAnimInstance();
if (AnimInstance)
{
AnimInstance->PlaySlotAnimationAsDynamicMontage(FireAnimation, "Arms", 0.0f);
}
}
}


void AFPSCharacter::MoveForward(float Value)
{
if (Value != 0.0f)
{
// add movement in that direction
AddMovementInput(GetActorForwardVector(), Value);
}
}


void AFPSCharacter::MoveRight(float Value)
{
if (Value != 0.0f)
{
// add movement in that direction
AddMovementInput(GetActorRightVector(), Value);
}
}
16 changes: 16 additions & 0 deletions Source/FPSGame/Private/FPSGameMode.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.

#include "FPSGameMode.h"
#include "FPSHUD.h"
#include "FPSCharacter.h"
#include "UObject/ConstructorHelpers.h"

AFPSGameMode::AFPSGameMode()
{
// set default pawn class to our Blueprinted character
static ConstructorHelpers::FClassFinder<APawn> PlayerPawnClassFinder(TEXT("/Game/Blueprints/BP_Player"));
DefaultPawnClass = PlayerPawnClassFinder.Class;

// use our custom HUD class
HUDClass = AFPSHUD::StaticClass();
}
Loading

0 comments on commit 09a2e59

Please sign in to comment.