Skip to content

Commit

Permalink
chore: Update to version 4.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
wijayaadhisurya committed Aug 5, 2021
1 parent 73a7bf2 commit 6cfb4ce
Show file tree
Hide file tree
Showing 23 changed files with 1,639 additions and 293 deletions.
82 changes: 82 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Rider user specific files
.idea

# Visual Studio 2015 user specific files
.vs/

# Visual Studio 2015 database file
*.VC.db

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# 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

# Binary Files
Binaries/*

# Builds
Build/*

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

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

# Built data for maps
*_BuiltData.uasset

# Configuration files generated by the Editor
Saved/*

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

# Cache files for the editor to use
DerivedDataCache/*
Content/StarterContent/*

# Doxygen generated files
Doxygen/*
6 changes: 6 additions & 0 deletions .releaseignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Jenkins
SteamHelper
TestUtilities
jenkinsfile
jenkins.config.json
Plugins/AccelByteUe4Sdk/Source/AccelByteUe4Sdk/Private/Tests
45 changes: 22 additions & 23 deletions AccelByteUe4Sdk.uplugin
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
{
"FileVersion": 3,
"Version": 1,
"VersionName": "1.0",
"FriendlyName": "AccelByte Unreal Engine 4 SDK",
"Description": "Official AccelByte SDK for Unreal Engine 4",
"Category": "Online Platform",
"CreatedBy": "Accelbyte Inc",
"CreatedByUrl": "https://www.accelbyte.net/",
"DocsUrl": "https://docs.accelbyte.net/sdk/ue4/index.html",
"MarketplaceUrl": "",
"SupportUrl": "",
"CanContainContent": false,
"IsBetaVersion": false,
"Installed": false,
"Modules": [
{
"Name": "AccelByteUe4Sdk",
"Type": "Runtime",
"LoadingPhase": "PreDefault"
}
],
"Plugins": [
]
"FileVersion": 3,
"Version": 1,
"VersionName": "1.0",
"FriendlyName": "AccelByte Unreal Engine 4 SDK",
"Description": "Official AccelByte SDK for Unreal Engine 4",
"Category": "Online Platform",
"CreatedBy": "Accelbyte Inc",
"CreatedByUrl": "https://www.accelbyte.net/",
"DocsUrl": "https://docs.accelbyte.net/sdk/ue4/index.html",
"MarketplaceUrl": "",
"SupportUrl": "",
"CanContainContent": false,
"IsBetaVersion": false,
"Installed": false,
"Modules": [
{
"Name": "AccelByteUe4Sdk",
"Type": "Runtime",
"LoadingPhase": "PreDefault"
}
],
"Plugins": []
}
854 changes: 854 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

130 changes: 130 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# AccelByte Unreal SDK

AccelByte Unreal SDK is a plugin for Unreal Engine.

## Assumptions

This documentation assumes that you are already familiar with modern C++, Unreal Engine, HTTP, REST API, microservice architecture, OAuth2, OpenID Connect, JWT, WebSocket.

## Dependencies

AccelByte SDK is compatible with these AccelByte Services version 3.2.0

## Features

AccelByte Unreal SDK features:

- Access the API from C++ and blueprint. C++
- Provides easy-to-use client APIs for:
- User authentication (access tokens stored in memory)
- User management (create user, reset password, verify user.)
- User profile (create, update, view).
- Ecommerce (get item categories, get items, create orders, etc.)
- Lobby (chatting, party management)
- Server API.
- Supported Unreal versions: 4.25 - 4.26

## Architecture

The classes are categorized as follow:

- The `Model` classes are used for JSON deserialization and serialization using Unreal Engine [JsonUtilities.h](https://api.unrealengine.com/INT/API/Runtime/JsonUtilities/).
- The `Api` classes provides interface to C++ functions.
- The `Blueprint` classes are simple _glue code_ to provide interface to Unreal Engine Blueprint.
- The `Core` classes are for core functionalities (error handler, settings, credential store, and HTTP retry system).

## Terminology

> There are only two hard things in Computer Science: cache invalidation and naming things. ―Phil Karlton
### `UserId` vs `LoginId` vs `Username`

The backend call it `LoginId`, but in here it's called username. It can be email address or phone number. `UserId` is the user unique ID.

### AccelByte IAM

The AccelByte IAM is an identity and access management service for online video games.

It is written in Go.

### AccelByte Platform

AccelByte Platform is a platform service for online video games.

These modules are written in Java to take advantage of the rich eco-system of libraries, mature development environment and tools, and rapid development and flexibility and customization.

### AccelByte Lobby

AccelByte Lobby is for chatting and party management. Unlike other servers which use HTTP, Lobby server uses WebSocket (RFC 6455).

It is also written in Go.

# Quickstart Guide

Here's how to get it up and running quickly.

## Setup

1. The first step is to download and install [Visual Studio 2019](https://visualstudio.microsoft.com/downloads/).

2. Download and install [Unreal Engine 4.25](https://www.unrealengine.com).

3. If you want to run the examples, skip to step 7.

4. Create or open existing Unreal Engine project.

5. Copy the the top folder to your game's plugins folder as `AccelbyteUe4Sdk` folder.

6. Add the plugin to your `/MyAwesomeGame.uproject` file,
```java
"Plugins": [
...
{
"Name": "AccelByteUe4Sdk",
"Enabled": true
},
...
```
in `/Source/MyAwesomeGame.Target.cs`, and in `/Source/MyAwesomeGameEditor.Target.cs`.
```cs
ExtraModuleNames.AddRange(new string[]
{
...
"AccelByteUe4Sdk",
...
}
```
also in `/Source/MyAwesomeGame/MyAwesomeGame.Build.cs`.
```cs
PublicDependencyModuleNames.AddRange(
new string[] {
...
"AccelByteUe4Sdk",
...
}
```
7. Open Unreal Editor and click File -> Project Settings.
![](Documentation/images/setup_001.png)

8. Fill out the settings then click on set as default. The settings will be saved to `DefaultEngine.ini`.
![](Documentation/images/setup_002.png)

# Blueprint

**Note**: We have halted support for blueprints, new features will be added with no blueprint. Please contact us if you want to use new features on the blueprints.

Supported features:
* Achievement
* Could Storage
* Entitlement
* Store Category
* Store Item
* Lobby
* Order
* Statistic
* User
* Wallet

# Commit Message Standardization

We are following Conventional Commits as a standard to follow for writing commit messages. The details of the rules can be found in the [conventional commits website](https://www.conventionalcommits.org/en/v1.0.0/).
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void GameTelemetry::Send(FAccelByteModelsTelemetryBody TelemetryBody, const FVoi
{
bTelemetryJobStarted = true;
GameTelemetryTickDelegate = FTickerDelegate::CreateRaw(this, &GameTelemetry::PeriodicTelemetry);
GameTelemetryTickDelegateHandle = FTicker::GetCoreTicker().AddTicker(GameTelemetryTickDelegate, (float)TelemetryInterval.GetSeconds());
GameTelemetryTickDelegateHandle = FTicker::GetCoreTicker().AddTicker(GameTelemetryTickDelegate, static_cast<float>(TelemetryInterval.GetTotalSeconds()));
}
}
}
Expand Down
16 changes: 15 additions & 1 deletion Source/AccelByteUe4Sdk/Private/Api/AccelByteLobbyApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ namespace Api
const FString JoinParty = TEXT("partyJoinRequest");
const FString RejectParty = TEXT("partyRejectRequest");
const FString KickParty = TEXT("partyKickRequest");
const FString PartyGenerateCodeRequest = TEXT("partyGenerateCodeRequest");
const FString PartyGetCodeRequest = TEXT("partyGetCodeRequest");
const FString PartyDeleteCodeRequest = TEXT("partyDeleteCodeRequest");
const FString PartyJoinViaCodeRequest = TEXT("partyJoinViaCodeRequest");
Expand Down Expand Up @@ -97,6 +98,7 @@ namespace Api
const FString PartyKick = TEXT("partyKickResponse");
const FString PartyKickNotif = TEXT("partyKickNotif");
const FString PartyDataUpdateNotif = TEXT("partyDataUpdateNotif");
const FString PartyGenerateCode = TEXT("partyGenerateCodeResponse");
const FString PartyGetCode = TEXT("partyGetCodeResponse");
const FString PartyDeleteCode = TEXT("partyDeleteCodeResponse");
const FString PartyJoinViaCode = TEXT("partyJoinViaCodeResponse");
Expand Down Expand Up @@ -356,6 +358,13 @@ FString Lobby::SendKickPartyMemberRequest(const FString& UserId)
FString::Printf(TEXT("memberID: %s\n"), *UserId));
}

FString Lobby::SendPartyGenerateCodeRequest()
{
FReport::Log(FString(__FUNCTION__));

return SendRawRequest(LobbyRequest::PartyGenerateCodeRequest, Prefix::Party);
}

FString Lobby::SendPartyGetCodeRequest()
{
FReport::Log(FString(__FUNCTION__));
Expand Down Expand Up @@ -398,6 +407,11 @@ FString Lobby::SendSetPresenceStatus(const Availability Availability, const FStr
}

FString Lobby::SendGetOnlineUsersRequest()
{
return Lobby::SendGetOnlineFriendPresenceRequest();
}

FString Lobby::SendGetOnlineFriendPresenceRequest()
{
FReport::Log(FString(__FUNCTION__));

Expand Down Expand Up @@ -1223,7 +1237,6 @@ if (lobbyResponseType.Equals(MessageType)) \
} \
return; \
} \

// NOTIF
// Party
HANDLE_LOBBY_MESSAGE_NOTIF(LobbyResponse::DisconnectNotif, FAccelByteModelsDisconnectNotif, DisconnectNotif);
Expand Down Expand Up @@ -1330,6 +1343,7 @@ if (lobbyResponseType.Equals(MessageType)) \
HANDLE_LOBBY_MESSAGE_RESPONSE(LobbyResponse::PartyReject, FAccelByteModelsPartyRejectResponse, PartyRejectResponse);
HANDLE_LOBBY_MESSAGE_RESPONSE(LobbyResponse::PartyKick, FAccelByteModelsKickPartyMemberResponse, PartyKickResponse);
HANDLE_LOBBY_MESSAGE_RESPONSE(LobbyResponse::PartyGetCode, FAccelByteModelsPartyGetCodeResponse, PartyGetCodeResponse);
HANDLE_LOBBY_MESSAGE_RESPONSE(LobbyResponse::PartyGenerateCode, FAccelByteModelsPartyGenerateCodeResponse, PartyGenerateCodeResponse);
HANDLE_LOBBY_MESSAGE_RESPONSE(LobbyResponse::PartyDeleteCode, FAccelByteModelsPartyDeleteCodeResponse, PartyDeleteCodeResponse);
HANDLE_LOBBY_MESSAGE_RESPONSE(LobbyResponse::PartyJoinViaCode, FAccelByteModelsPartyJoinReponse, PartyJoinViaCodeResponse);
HANDLE_LOBBY_MESSAGE_RESPONSE(LobbyResponse::PartyPromoteLeader, FAccelByteModelsPartyPromoteLeaderResponse, PartyPromoteLeaderResponse);
Expand Down
2 changes: 1 addition & 1 deletion Source/AccelByteUe4Sdk/Private/Api/AccelByteOauth2Api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void Oauth2::GetTokenWithAuthorizationCode(const FString& ClientId, const FStrin

FHttpRequestPtr Request = FHttpModule::Get().CreateRequest();
Request->SetVerb(TEXT("POST"));
Request->SetURL(FString::Printf(TEXT("%s/v3/oauth/token"), *FRegistry::Settings.IamServerUrl));
Request->SetURL(FString::Printf(TEXT("%s/oauth/token"), *FRegistry::Settings.IamServerUrl));
Request->SetHeader(TEXT("Authorization"), TEXT("Basic " + FBase64::Encode(ClientId + ":" + ClientSecret)));
Request->SetHeader(TEXT("Accept"), TEXT("application/json"));
Request->SetHeader(TEXT("Content-Type"), TEXT("application/x-www-form-urlencoded"));
Expand Down
20 changes: 20 additions & 0 deletions Source/AccelByteUe4Sdk/Private/Api/AccelByteSessionBrowserApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,5 +137,25 @@ namespace Api

FRegistry::HttpRetryScheduler.ProcessRequest(Request, CreateHttpResultHandler(OnSuccess, OnError), FPlatformTime::Seconds());
}

void SessionBrowser::GetGameSession(const FString& SessionId, const THandler<FAccelByteModelsSessionBrowserData>& OnSuccess, const FErrorHandler& OnError){
FReport::Log(FString(__FUNCTION__));

FString Authorization = FString::Printf(TEXT("Bearer %s"), *Credentials.GetAccessToken());
FString SessionBrowserServerUrl = GetSessionBrowserUrl();
FString Url = FString::Printf(TEXT("%s/namespaces/%s/gamesession/%s"), *SessionBrowserServerUrl, *Credentials.GetNamespace(), *SessionId);
FString Verb = TEXT("GET");
FString ContentType = TEXT("application/json");
FString Accept = TEXT("application/json");

FHttpRequestPtr Request = FHttpModule::Get().CreateRequest();
Request->SetURL(Url);
Request->SetHeader(TEXT("Authorization"), Authorization);
Request->SetVerb(Verb);
Request->SetHeader(TEXT("Content-Type"), ContentType);
Request->SetHeader(TEXT("Accept"), Accept);

FRegistry::HttpRetryScheduler.ProcessRequest(Request, CreateHttpResultHandler(OnSuccess, OnError), FPlatformTime::Seconds());
}
}
}
8 changes: 7 additions & 1 deletion Source/AccelByteUe4Sdk/Private/Api/AccelByteUGCApi.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2019 - 2021 AccelByte Inc. All Rights Reserved.
// Copyright (c) 2021 AccelByte Inc. All Rights Reserved.
// This is licensed software from AccelByte Inc, for limitations
// and restrictions contact your company contract manager.

Expand Down Expand Up @@ -129,6 +129,12 @@ void UGC::GetContentByContentId(const FString& ContentId,
{
FReport::Log(FString(__FUNCTION__));

if (ContentId.IsEmpty())
{
OnError.ExecuteIfBound(404, TEXT("Url is invalid. ContentId is empty."));
return;
}

FString Authorization = FString::Printf(TEXT("Bearer %s"), *Credentials.GetAccessToken());
FString Url = FString::Printf(TEXT("%s/v1/public/namespaces/%s/contents/%s"), *Settings.UGCServerUrl, *Settings.Namespace, *ContentId);
FString Verb = TEXT("GET");
Expand Down
Loading

0 comments on commit 6cfb4ce

Please sign in to comment.