Add Base Telemetry Triggers
This commit is contained in:
parent
69bf3555e3
commit
1707d13fb9
BIN
EndlessVendetta/Content/BP_Telemetry.uasset
(Stored with Git LFS)
Normal file
BIN
EndlessVendetta/Content/BP_Telemetry.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
EndlessVendetta/Content/FirstPerson/GunMechanicWorld.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/FirstPerson/GunMechanicWorld.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/Levels/NewMiamiTemp.umap
(Stored with Git LFS)
BIN
EndlessVendetta/Content/Levels/NewMiamiTemp.umap
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/Levels/TrainingFacility.umap
(Stored with Git LFS)
BIN
EndlessVendetta/Content/Levels/TrainingFacility.umap
(Stored with Git LFS)
Binary file not shown.
@ -3,14 +3,13 @@
|
|||||||
|
|
||||||
#include "AICharacter.h"
|
#include "AICharacter.h"
|
||||||
|
|
||||||
#include "AI_EnemyController.h"
|
|
||||||
#include "Components/CapsuleComponent.h"
|
#include "Components/CapsuleComponent.h"
|
||||||
#include "Engine/DamageEvents.h"
|
#include "Engine/DamageEvents.h"
|
||||||
#include "GameFramework/CharacterMovementComponent.h"
|
#include "GameFramework/CharacterMovementComponent.h"
|
||||||
#include "Perception/AIPerceptionStimuliSourceComponent.h"
|
#include "Perception/AIPerceptionStimuliSourceComponent.h"
|
||||||
#include "Perception/AISense_Sight.h"
|
#include "Perception/AISense_Sight.h"
|
||||||
#include "BehaviorTree/BlackboardComponent.h"
|
#include "BehaviorTree/BlackboardComponent.h"
|
||||||
#include "Blueprint/AIBlueprintHelperLibrary.h"
|
#include "../Telemetry.h"
|
||||||
|
|
||||||
|
|
||||||
// Sets default values
|
// Sets default values
|
||||||
@ -100,4 +99,5 @@ void AAICharacter::OnDeath()
|
|||||||
}
|
}
|
||||||
|
|
||||||
SetLifeSpan(30.0f);
|
SetLifeSpan(30.0f);
|
||||||
|
Cast<ATelemetry>(GetWorld()->GetGameState())->SendEvent("kill", "");
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "WaypointActor.h"
|
#include "WaypointActor.h"
|
||||||
#include "EndlessVendetta/EndlessVendettaCharacter.h"
|
#include "EndlessVendetta/EndlessVendettaCharacter.h"
|
||||||
|
#include "EndlessVendetta/Telemetry.h"
|
||||||
#include "GameFramework/Actor.h"
|
#include "GameFramework/Actor.h"
|
||||||
#include "CheckpointClass.generated.h"
|
#include "CheckpointClass.generated.h"
|
||||||
|
|
||||||
@ -32,11 +33,11 @@ class ENDLESSVENDETTA_API ACheckpointClass : public AActor
|
|||||||
AWaypointActor* WaypointActor;
|
AWaypointActor* WaypointActor;
|
||||||
// ----------------------------------------
|
// ----------------------------------------
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable, Category = "Checkpoint")
|
UFUNCTION(BlueprintCallable, Category = "Checkpoint")
|
||||||
void BroadcastCompletion()
|
void BroadcastCompletion()
|
||||||
{
|
{
|
||||||
CompletedCheckpoint.Broadcast();
|
CompletedCheckpoint.Broadcast();
|
||||||
|
Cast<ATelemetry>(GetWorld()->GetGameState())->SendEvent("Check", CheckpointTip);
|
||||||
}
|
}
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable)
|
UFUNCTION(BlueprintCallable)
|
||||||
@ -55,29 +56,34 @@ public:
|
|||||||
void SpawnWaypoint();
|
void SpawnWaypoint();
|
||||||
|
|
||||||
UFUNCTION(BlueprintImplementableEvent)
|
UFUNCTION(BlueprintImplementableEvent)
|
||||||
void CheckpointActivated();
|
void CheckpointActivated();
|
||||||
|
|
||||||
// ------ Getters for CP Properties ------
|
// ------ Getters for CP Properties ------
|
||||||
FString GetCheckpointDesc()
|
FString GetCheckpointDesc()
|
||||||
{
|
{
|
||||||
return CheckpointDescription;
|
return CheckpointDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
FString GetCheckpointTip()
|
FString GetCheckpointTip()
|
||||||
{
|
{
|
||||||
return CheckpointTip;
|
return CheckpointTip;
|
||||||
}
|
}
|
||||||
|
|
||||||
FVector GetWaypointLoc()
|
FVector GetWaypointLoc()
|
||||||
{
|
{
|
||||||
return WaypointLoc;
|
return WaypointLoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
UTexture2D* GetWaypointIcon()
|
UTexture2D* GetWaypointIcon()
|
||||||
{
|
{
|
||||||
return WaypointIcon;
|
return WaypointIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
FTransform GetCheckpointSpawnTransform()
|
FTransform GetCheckpointSpawnTransform()
|
||||||
{
|
{
|
||||||
return CheckpointSpawnTransform;
|
return CheckpointSpawnTransform;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------
|
// ---------------------------------------
|
||||||
|
|
||||||
// Sets default values for this actor's properties
|
// Sets default values for this actor's properties
|
||||||
@ -85,7 +91,4 @@ public:
|
|||||||
|
|
||||||
// Called every frame
|
// Called every frame
|
||||||
virtual void Tick(float DeltaTime) override;
|
virtual void Tick(float DeltaTime) override;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -11,7 +11,8 @@ public class EndlessVendetta : ModuleRules
|
|||||||
PublicDependencyModuleNames.AddRange(new string[]
|
PublicDependencyModuleNames.AddRange(new string[]
|
||||||
{
|
{
|
||||||
"Core", "CoreUObject", "Engine", "InputCore", "HeadMountedDisplay", "EnhancedInput", "AIModule",
|
"Core", "CoreUObject", "Engine", "InputCore", "HeadMountedDisplay", "EnhancedInput", "AIModule",
|
||||||
"GameplayTasks", "NavigationSystem", "UMG", "Slate", "SlateCore", "Niagara", "NiagaraCore", "NiagaraShader"
|
"GameplayTasks", "NavigationSystem", "UMG", "Slate", "SlateCore", "Niagara", "NiagaraCore", "NiagaraShader",
|
||||||
|
"HTTP", "Json", "JsonUtilities"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -7,6 +7,7 @@
|
|||||||
#include "EnhancedInputComponent.h"
|
#include "EnhancedInputComponent.h"
|
||||||
#include "EnhancedInputSubsystems.h"
|
#include "EnhancedInputSubsystems.h"
|
||||||
#include "InteractionInterface.h"
|
#include "InteractionInterface.h"
|
||||||
|
#include "Telemetry.h"
|
||||||
#include "AI/EnemyCharacter.h"
|
#include "AI/EnemyCharacter.h"
|
||||||
#include "Engine/DamageEvents.h"
|
#include "Engine/DamageEvents.h"
|
||||||
#include "GameFramework/CharacterMovementComponent.h"
|
#include "GameFramework/CharacterMovementComponent.h"
|
||||||
@ -292,6 +293,7 @@ void AEndlessVendettaCharacter::EquipPrimary()
|
|||||||
PrimaryWeapon = nullptr;
|
PrimaryWeapon = nullptr;
|
||||||
bHasRifle = false;
|
bHasRifle = false;
|
||||||
GLog->Log("Primary Weapon Put Away");
|
GLog->Log("Primary Weapon Put Away");
|
||||||
|
Cast<ATelemetry>(GetWorld()->GetGameState())->SendEvent("DeEquip", "Pri");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(bIsWeaponPickedUp)
|
if(bIsWeaponPickedUp)
|
||||||
@ -318,6 +320,7 @@ void AEndlessVendettaCharacter::EquipPrimary()
|
|||||||
// bIsPrimaryWeaponCreated = true;
|
// bIsPrimaryWeaponCreated = true;
|
||||||
// }
|
// }
|
||||||
if (!IsValid(PrimaryWeaponActor)) return;
|
if (!IsValid(PrimaryWeaponActor)) return;
|
||||||
|
Cast<ATelemetry>(GetWorld()->GetGameState())->SendEvent("Equip", "Pri");
|
||||||
PrimaryWeaponActor->AttachToComponent(Mesh1P, AttachmentRules, FName("GripPoint"));
|
PrimaryWeaponActor->AttachToComponent(Mesh1P, AttachmentRules, FName("GripPoint"));
|
||||||
PrimaryWeapon = Cast<ABaseWeaponClass>(PrimaryWeaponActor);
|
PrimaryWeapon = Cast<ABaseWeaponClass>(PrimaryWeaponActor);
|
||||||
PrimaryWeapon->SetActorHiddenInGame(false);
|
PrimaryWeapon->SetActorHiddenInGame(false);
|
||||||
|
29
EndlessVendetta/Source/EndlessVendetta/Telemetry.cpp
Normal file
29
EndlessVendetta/Source/EndlessVendetta/Telemetry.cpp
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
|
||||||
|
#include "Telemetry.h"
|
||||||
|
#include "Misc/Guid.h"
|
||||||
|
|
||||||
|
void ATelemetry::SendEvent(FString EventKey, FString EventData)
|
||||||
|
{
|
||||||
|
const FString EventID = FGuid::NewGuid().ToString();
|
||||||
|
const FString EventTime = FDateTime::Now().ToString();
|
||||||
|
const auto Request = FHttpModule::Get().CreateRequest();
|
||||||
|
Request->SetURL(TelemetryURLEvents);
|
||||||
|
Request->SetVerb("POST");
|
||||||
|
Request->SetHeader("Content-Type", "application/json");
|
||||||
|
Request->SetHeader("Accept", "application/json");
|
||||||
|
Request->SetContentAsString( "{\"SessionID\":\"" + SessionID + "\",\"PlayerGUID\":\"" + PlayerGUID + "\",\"EventID\":\"" + EventID + "\",\"Timestamp\":\"" + EventTime + "\",\"EventKey\":\"" + EventKey + "\",\"EventData\":\"" + EventData + "\"}" );
|
||||||
|
Request->OnProcessRequestComplete().BindLambda([](FHttpRequestPtr request, FHttpResponsePtr response, bool success)
|
||||||
|
{
|
||||||
|
GLog->Log("Telemetry Event Response: " + response->GetContentAsString());
|
||||||
|
});
|
||||||
|
Request->ProcessRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ATelemetry::BeginPlay()
|
||||||
|
{
|
||||||
|
Super::BeginPlay();
|
||||||
|
SessionID = FGuid::NewGuid().ToString().Left(5).ToUpper();
|
||||||
|
SendEvent("start", "");
|
||||||
|
}
|
33
EndlessVendetta/Source/EndlessVendetta/Telemetry.h
Normal file
33
EndlessVendetta/Source/EndlessVendetta/Telemetry.h
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "GameFramework/GameState.h"
|
||||||
|
#include "Http.h"
|
||||||
|
#include "Telemetry.generated.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
UCLASS()
|
||||||
|
class ENDLESSVENDETTA_API ATelemetry : public AGameState
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Telemetry")
|
||||||
|
FString TelemetryURLEvents = "https://ev.api.philipwhite.dev/api/event";
|
||||||
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Telemetry")
|
||||||
|
FString TelemetryURLUsers = "https://ev.api.philipwhite.dev/api/user";
|
||||||
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Telemetry")
|
||||||
|
FString SessionID = "AAAAA";
|
||||||
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Telemetry")
|
||||||
|
FString PlayerGUID = "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee";
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable, Category = "Telemetry")
|
||||||
|
void SendEvent(FString EventKey, FString EventData);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void BeginPlay() override;
|
||||||
|
};
|
@ -7,6 +7,7 @@
|
|||||||
#include "EndlessVendetta/EndlessVendettaCharacter.h"
|
#include "EndlessVendetta/EndlessVendettaCharacter.h"
|
||||||
#include "Kismet/KismetMathLibrary.h"
|
#include "Kismet/KismetMathLibrary.h"
|
||||||
#include "Components/CapsuleComponent.h"
|
#include "Components/CapsuleComponent.h"
|
||||||
|
#include "EndlessVendetta/Telemetry.h"
|
||||||
#include "Kismet/GameplayStatics.h"
|
#include "Kismet/GameplayStatics.h"
|
||||||
#include "Engine/DamageEvents.h"
|
#include "Engine/DamageEvents.h"
|
||||||
#include "EndlessVendetta/AI/EnemyCharacter.h"
|
#include "EndlessVendetta/AI/EnemyCharacter.h"
|
||||||
@ -242,6 +243,7 @@ void ABaseWeaponClass::Interact()
|
|||||||
{
|
{
|
||||||
if(!IsValid(this)) return;
|
if(!IsValid(this)) return;
|
||||||
endlessVendettaChar->WeaponSwitcher(this);
|
endlessVendettaChar->WeaponSwitcher(this);
|
||||||
|
Cast<ATelemetry>(GetWorld()->GetGameState())->SendEvent("pickup", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ABaseWeaponClass::InteractPrompt()
|
void ABaseWeaponClass::InteractPrompt()
|
||||||
|
Loading…
Reference in New Issue
Block a user