This repository contains a plugin project for Flax Engine games with Steam online platform implementation that covers: user profile, friends list, online presence, achevements, cloud savegames and more.
Minimum supported Flax version: 1.3
.
-
Clone repo into
<game-project>\Plugins\OnlinePlatformSteam
-
Add reference to OnlinePlatformSteam project in your game by modyfying
<game-project>.flaxproj
as follows:
...
"References": [
{
"Name": "$(EnginePath)/Flax.flaxproj"
},
{
"Name": "$(ProjectPath)/Plugins/OnlinePlatformSteam/OnlinePlatformSteam.flaxproj"
}
]
- Add reference to Steam plugin module in you game code module by modyfying
Source/Game/Game.Build.cs
as follows (or any other game modules using Online):
/// <inheritdoc />
public override void Setup(BuildOptions options)
{
base.Setup(options);
...
switch (options.Platform.Target)
{
case TargetPlatform.Windows:
case TargetPlatform.Linux:
case TargetPlatform.Mac:
options.PublicDependencies.Add("OnlinePlatformSteam");
break;
}
}
This will add reference to OnlinePlatformSteam
module on Windows/Linux/Mac platforms that are supported by Steam.
- Test it out!
Finally you can use Steam as online platform in your game:
// C#
using FlaxEngine.Online;
using FlaxEngine.Online.Steam;
var platform = new OnlinePlatformSteam();
Online.Initialize(platform);
// C++
#include "Engine/Online/Online.h"
#include "OnlinePlatformSteam/OnlinePlatformSteam.h"
auto platform = New<OnlinePlatformSteam>();
Online::Initialize(platform);
Then use Online system to access online platform (user profile, friends, achievements, cloud saves, etc.).
- Setup settings
Steam plugin automatically creates steam_appid.txt
file with Steam AppId (for both Editor and cooked Game). You can add own settings in Content window by using right-click, then New -> Settings, specify name, select SteamSettings type and confirm.
This plugin ais released under MIT License.