Skip to content

Bearwaves/eos4j

Repository files navigation

eos4j

eos4j is a minimal Java wrapper around the Epic Online Services (EOS) SDK. It provides a Java-native interface while aiming to conform very closely to the structure of the EOS C SDK.

It was originally implemented to support the release of Feud on the Epic Games Store.

A simple sample application showing basic functionality is available.

Compatibility

eos4j supports Java 8 and above, and has natives built for the following platforms:

  • Windows x64
  • macOS x64
  • macOS ARM64 (Apple Silicon)
  • Linux x64

A loader based on LWJGL is included, but you are welcome to provide your own.

Showcase

Built your game using eos4j? Submit a pull request to put it here!

Feud Age of Conquest IV Retro Commander Demise of Nations

Getting started

Releases are published to Maven Central, so you can use your favourite dependency management tool to fetch it.

// Gradle
dependencies {
    implementation "com.bearwaves:eos4j:1.1.0"
}

Snapshots are also published, if you want to be at the bleeding edge. Make sure you have the OSS Snapshots repository declared.

// Gradle
maven { url "https://s01.oss.sonatype.org/content/repositories/snapshots/" }
dependencies {
    implementation "com.bearwaves:eos4j:1.2.0-SNAPSHOT"
}

If you just want the JAR, see the releases page.

eos4j provides utilities to load the native libraries, but it does not include the natives for the EOS SDK itself due to licensing restrictions. You should download the SDK yourself from EOS portal and ensure the library binaries are in your classpath. They are:

Platform File
Windows EOSSDK-Win64-Shipping.dll
macOS libEOSSDK-Mac-Shipping.dylib
Linux libEOSSDK-Linux-Shipping.so

Once your build is set up, you can initialise the library in your Java code like so:

import com.bearwaves.eos4j.EOS;

if (!EOS.loadLibraries()){
    throw new RuntimeException("Couldn't load EOS libraries");
}

From here on you can follow the EOS C SDK documentation and adapt it as you see fit.

Documentation

eos4j is documented very minimally - this is a deliberate choice. Instead, every effort has been made to have the structure of the library conform as closely as possible to that of the EOS C SDK, meaning you should be able to use the official documentation without issue.

Callbacks are implemented as interfaces and lambdas can be used.

If you find something which doesn't map neatly, is confusing, or would benefit from additional documentation, please do open an issue.

Completeness

The goal is for eos4j to implement the entirety of the EOS SDK, but it isn't quite there yet. At the time of writing, the following are implemented.

Releasing is implemented as methods on returned classes, rather than as a function.

Platform interface

  • Create and release
  • Tick
  • Get handles for implemented interfaces

Logging interface

  • Set callback
  • Set level

Auth interface

  • Logging in
  • Logging out
  • Copying ID token
  • Copying auth token

Connect interface

  • Logging in
  • Creating a user
  • Coping ID token
  • Token expiry callback

Stats interface

  • Ingest stat
  • Query stat
  • Get stat count
  • Copy stat by name
  • Copy stat by index

Achievements interface

  • Unlock achievements

Leaderboards interface

  • Leaderboard definitions (query/count/copy)
  • Leaderboard ranks (query/count/copy)
  • Leaderboard user scores (query/count/copy)

Ecom interface

  • Catalog offers (query/count/copy)
  • Entitlements (query/count/copy), entitlement token, redeem
  • Query ownership, ownership token
  • Checkout
  • Transactions
    • Count and copy by ID/index
    • Get transaction ID, count and copy entitlements

If there's something missing that you need, please do open an issue. PRs are very welcome.

Acknowledgements

eos4j is heavily inspired by the excellent steamworks4j.