Sample Overview

A tour of the Simple Framework project, which has sample code using the EOS SDK.

This overview provides a tour of the Simple Framework sample project, which uses the Epic Online Services (EOS) SDK.

EOSSDK_SimpleFramework_0.png

Before You Begin

The sample application uses Epic Account Services to authenticate the local user for demonstration purposes. This requires that the Client Credentials used to initialize the SDK have been assigned to an Application used for Epic Account Services.

The demonstrated SDK functionality can be used with any of the supported identity providers for user authentication.

Source Code and Project

You can find the Simple Framework project inside the EOSSDK/Samples/Simple Framework/ directory, which has the following subdirectories:

Subdirectory

Contents

/Bin/

The output location where you will find the game's executable. The exact subdirectory where the executable appears after building varies based on your configuration and platform.

/cmake/

Helper files for making builds with CMake on Mac and Linux.

/Intermediate/

Intermediate build files.

/Source/

Project source code.

You can also find certain shared sample files inside the EOSSDK/Samples/Shared/ directory. They are broken up into subdirectories as follows:

Subdirectory

Contents

/Assets/

Shared game runtime texture and font assets.

/External/

Shared libraries.

/Source/

All shared source code.

The Shared/Source/Core/ directory contains sample code using the EOS SDK to log in, authenticate users, and query friends. The source directories also contain code to manage the game itself.

Building the Sample

Windows DirectX

To compile and build the Simple Framework, open the solution, Samples.sln with Microsoft Visual Studio 2017, and build the desired configuration (either Debug_DX or Release_DX) for the target platform (either Win32 or Win64).

Following a successful build, the /Bin/ directory will contain the executable (SimpleFramework.exe) in a subdirectory based on your configuration and target platform. The subdirectory will also contain a copy of the data assets and SDK binaries.

Windows SDL

To compile and build the Simple Framework, open the solution, SimpleFrameworkSDL.sln with Microsoft Visual Studio 2017 and build the desired configuration (either Debug or Release) for the target platform (either Win32 or Win64).

Following a successful build, the /Bin/SDL/ directory will contain the executable, (SimpleFrameworkSDL.exe), in a subdirectory based on your configuration and target platform. The subdirectory will also contain a copy of the data assets and SDK binaries.

Mac OSX

To build on a Mac, you will need to install the following dependencies:

  • SDL2

  • SDL2_ttf

  • GLEW

  • cmake

  • gcc (through Command Line Tools for Xcode)

To compile and build the Simple Framework, execute Build.command or Build.sh from the Terminal.

Following a successful build, the /Build/ directory will contain the executable (SimpleFramework). The subdirectory will also contain a copy of the data assets and makefile build files.

To run the SimpleFramework sample, execute Run.command or Run.sh from the Terminal.

Linux

To build on Linux, you will need to install the following dependencies:

  • SDL2 (runtime + headers)

  • SDL2_ttf (runtime + headers)

  • GLEW (runtime + headers)

  • cmake

  • gcc/g++

To compile and build the Simple Framework, execute Build.sh from the Terminal.

Following a successful build, the /Build/ directory will contain the executable (SimpleFramework). The subdirectory will also contain a copy of the data assets and makefile build files.

To run the SimpleFramework sample, execute Run.sh from the Terminal.

Exploring the Sample

If you would like to explore the sample, keep reading to learn about the available command line parameters, console commands, and features.

Command Line Parameters

The Simple Framework sample supports the following optional command line parameters:

Command Line Parameter

Usage

Description

userid

-userid <string>

The user id box will be filled out with the text, and the user (specified by the id ) will be logged in when the "LOGIN" button is clicked (or via the autologin process). Additionally, can be an email, display name or Facebook ID.

password

-password <string>

The password box will be filled out with the text and the user (with password ) will logged in when the "LOGIN" button is clicked or via the autologin process.

autologin

-autologin 1

The user specified with "userid" and "password" will be logged in automatically when the game starts after the EOS SDK has been initialized.

productid

-productid <string>

Overrides the Product ID when creating the EOS SDK Platform Options. See SampleConstants.ProductId for the default value.

sandboxid

-sandboxId <string>

Overrides the Sandbox ID when creating the EOS SDK Platform Options. See SampleConstants.SandboxId for the default value.

clientid

-clientid <string>

This allows you to override the Client Credentials Id when creating the EOS SDK Platform Options. Also, see SampleConstants.ClientCredentialsId for the default value.

clientsecret

clientsecret <string>

This enables you to override the Client Credentials Secret when creating the EOS SDK Platform Options. Also, see SampleConstants.ClientCredentialsSecret for the default value.

fullscreen

-fullscreen 1

If this is added to the command line, the game will start up in full screen mode (window mode is the default).

logfile

-logfile <string>

The debug output log will be written out to the file name specified by . Additionally, the default debug output log file is "DebugOuput.log", and it is saved in the same folder as the solution file.

devhost

-devhost <string>

The "Host" port box in the "Dev Auth" login options will contain the parameter.

devcred

-devcred <string>

The "Credentials" box in the "Dev Auth" login options will contain the parameter.

Console Commands

The Simple Framework sample supports the following console commands, which you can enter in-game:

Console Command

Usage

Description

TEST

TEST

Prints out a test message to the console.

CLEAR

CLEAR

Clears all the text lines in the console output window.

EXIT

EXIT

Exits and closes down the game.

LOGIN

LOGIN <USER_ID> <PASSWORD>

Attempts to login the user with user ID and password .

LOGOUT

LOGOUT <USER_NAME>

Attempts to logout the user named .

INVITE

INVITE <FRIEND_NAME>

Send a friend invite to the user with display name .

PREV

PREV

Shows info for the previous logged in user (if more than one user is logged in).

NEXT

NEXT

Shows info for the next logged in user (if more than one user is logged in).

NEW

NEW

Shows login dialog to allow logging in as an additional user.

HELP

HELP

Prints info to the console output about all the above console commands.

To add more console commands, see the Game::CreateConsoleCommands function in Game.cpp.

Features

The Simple Framework has a few features, including Login and Logout methods, a Console Window, a Friends List, and Presence Information.

Login

The following image shows the Login section with Dev Auth. To log in, click each text box, replacing "Host" with the port you are using for the Dev Auth Tool and "Credentials" with the Credentials name from the Dev Auth Tool. You can then click LOG IN.

EOSSDK_SimpleFramework_DevAuth.png

Successful Login

Whichever method you use, if you have successfully logged in, your user display name will appear in the Friends menu (see image below).

EOSSDK_SimpleFramework_4.png

Logging Out

Click LOG OUT to log out again (see image below). You can also click on the NEW button to log in with a new account. If multiple accounts are logged in at the same time, the left and right arrows will cycle through them.

EOSSDK_SimpleFramework_4Logout.png

Console Window

The Console logs relevant debug output from various EOS SDK operations. Additionally, the Console displays debug output from the following:

Function

Text Color

FDebugLog::Log()

White

FDebugLog::LogWarning()

Orange

FDebugLog::LogError()

Red

Note: Errors from EOS SDK operations display red text, and warnings display orange text.

Refer to the following image to learn more about the Console Window:

EOSSDK_SimpleFramework_5.png

The console output (1) logs relevant debug information. Additionally, you can enter console commands (2) or clear all times from the console output (3). Finally, you can select and copy text highlighted in yellow from the console output by clicking, dragging, and then then using the Ctrl+C keyboard combination. If you want to select all text in the console ouput, use the Ctrl+A keyboar combination.

Note: Text is copied to the clipboard.

Friends List

Friends List is a separate part of a window that shows friends and their statuses, friend invitations, and enables interaction. You have to be logged in to be able to use Friends List (see below).

EOSSDK_SimpleFramework_6.png

Friends List also contains a text field that serves two purposes. First, it can filter friends by their display name. And second, it is possible to search for new friends by typing in a user display name and pressing the Enter key. If there are no friends with the entered display name in your list, a search operation is executed, and the user will be shown in the list with an option to add them (see below):

EOSSDK_SimpleFramework_7.png

After pressing the + button, a friend invitation is sent. Invited friends are shown in Friends List until the user accepts or rejects the invitation.

Note: Incoming friend invitations display buttons to accept or reject the invitation.

Presence Information

After a user accepts an invitation, they become your Friend, enabling additional information to be displayed. For example, it is possible to see what a friend's status is (for example, if they are Online, Away or Offline). Additionally, presence information is available for friends who are currently playing a game, and a green label next to their name shows the application name and platform they are currently using (see image below).

EOSSDK_SimpleFramework_8.png