• Stars
    star
    106
  • Rank 325,871 (Top 7 %)
  • Language Haxe
  • License
    MIT License
  • Created almost 9 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Haxe native extension for the Steam API

SteamWrap

Simple Haxe native extension Steam API wrapper. This code originally shipped in Papers, Please and the changes in this fork were made for the PC release of rymdkapsel. Windows, OS X and Linux/SteamOS builds are supported.

Current Features:

  • Achievements & Leaderboards
  • Steam Controller Support
  • UGC (user generated content)
  • Stats (not well-tested)

This repository comes with prebuilt binaries, which means it should work "out of the box".

(I'm in the process of updating the binaries, right now all it has is Windows)

Dependencies / Requirements:

  • Haxe 3.2 or greater
  • hxcpp 3.2.205 or greater
  • OpenFL 3.6 or greater
  • lime 2.8.3 or greater

Probably works with NME as well but I'm unsure of the requirements there. Ask Hugh.

To include steamwrap.ndll in your OpenFL or NME project:

  1. Install the library:

    latest git version: haxelib git steamwrap https://github.com/larsiusprime/SteamWrap

  2. Add the following nodes to your project.xml (assumes OpenFL or NME for now):

   <!-- Replace the question marks with your Steam App ID -->
   <setenv name="STEAM_APP_ID" value="??????" />

   <!-- OS X only: Set this value to the same value as the file property of your <app> node, this is needed to embed things into the generated .app file -->
   <!-- Setting this for other platforms won't do any harm, so you can safely leave it enabled for everything -->
   <set name="APP_FILE" value="??????" />
   
   <haxelib name="steamwrap"/>
  1. If you are doing non-Steam builds as well, it is practical to wrap this in a conditional. Run your builds as: openfl test <platform> -Dsteam to enable it, for example: openfl test windows -Dsteam.
   <section if="steam">
   	<!-- Steam specifics go here -->
   </section>
**!!!!!!!!!!!!!!!!! IMPORTANT !!!!!!!!!!!!!!!!!!!**

**This extension will automatically create a steam_appid.txt in your binary folder.**
**Do not ship your game with this file. Make sure it's stripped during the publishing stage.**

**Compiling with the "-Dfinal" flag should suppress creation of the steam_appid.txt**

```openfl test windows -Dsteam -Dfinal``` (for instance)

**!!!!!!!!!!!!!!!!! IMPORTANT !!!!!!!!!!!!!!!!!!!**
  1. Platform specific notes:

Linux

  • Make sure libsteam_api.so is sitting next to steamwrap.ndll
  • You will need a launch script to ensure libraries are loaded from the righ location. An example (Test.sh) is provided in the example folder
    • When you release your game on Steam, set this launch script as your executable, NOT the raw linux binary itself

Usage:

See steamwrap/example/Test.hx for a basic example.

To build steamwrap.ndll from source:

Automatic steps

  1. Run setup.bat (windows) or setup.sh (mac/linux) and enter the values it asks you for

Or you can set it up manually:


Manual steps:

  1. Copy the hxcpp headers:

     HAXE_DIR/lib/hxcpp/VERSION/include/hx/*.h -> STEAMWRAP_DIR/native/include/hx/*.h
    
  2. Copy the Steam SDK headers and libs:

     STEAMSDK_DIR/public/steam/*.h -> native/include/steam/*.h
     STEAMSDK_DIR/redistributable_bin/steam_api.dll -> native/lib/win32/
     STEAMSDK_DIR/redistributable_bin/steam_api.lib -> native/lib/win32/
     STEAMSDK_DIR/redistributable_bin/win64/steam_api64.dll -> native/lib/win64/
     STEAMSDK_DIR/redistributable_bin/win64/steam_api64.lib -> native/lib/win64/
     STEAMSDK_DIR/redistributable_bin/osx32/libsteam_api.dylib -> native/lib/osx64/
     STEAMSDK_DIR/redistributable_bin/linux32/libsteam_api.so -> native/lib/linux32/
     STEAMSDK_DIR/redistributable_bin/linux64/libsteam_api.so -> native/lib/linux64/
    
  3. Put some files in the build dir:

    Windows:

    	ndll/Windows/steam_appid.txt
    	STEAMSDK_DIR/redistributable_bin/steam_api.dll -> ndll/Windows/
    
    	ndll/Windows64/steam_appid.txt
    	STEAMSDK_DIR/redistributable_bin/steam_api64.dll -> ndll/Windows64/
    

    Mac:

    	ndll/Mac64/steam_appid.txt
    	STEAMSDK_DIR/redistributable_bin/steam_api.lib -> ndll/Mac64/
    

    Linux:

    	ndll/Linux/steam_appid.txt
    	STEAMSDK_DIR/redistributable_bin/steam_api.so -> ndll/Linux/
    	
    	ndll/Linux64/steam_appid.txt
    	STEAMSDK_DIR/redistributable_bin/steam_api.so -> ndll/Linux64/
    

    WHAT THIS DOES:

    The steam_api dll/dylib/so file must be next to your platform's steamwrap.ndll file in order for the extension to work. The dll/dylib/so file has all of the actual Steam API functionality, and the ndll file allows your Haxe project to communicate with it.

    As for the steam_appid.txt file, it's only there to make the "Test" program work. That's because the "Test" program will appear in your platform's ndll/ folder when you use the "build.bat" or "build" script to compile it.

    In order for your test program to work it must be able to find:

    • steamwrap.ndll (so Haxe can talk to Steam)
    • steam_api.dll/dylib/so (to provide the Steam API)
    • steam_appid.txt (to make the Steam Client recognize your app as a particular Steam Game when testing)

Final Steps:

  1. Run the "build" script (it's a basic haxelib command shortcut). steamwrap.ndll will be output to ndll/[PLATFORM]

Note: For linux you should have g++-multilib installed.

That's great, but we want to make sure it works! Let's run something with it. If you run the Test program now, you'll notice it exits immediately, asking you to supply an app ID.

  1. Edit steamwrap/example/Test.hx to include your Steam App ID and achievement ID's, etc.

    Now you are ready to compile example/Test.hx. Run the build script again.

  2. Start the Steam client, leave it open in the background, and run the Test app to make sure it connects.

Note: If you're running on Linux, you should run the "Test.sh" launcher script, not the "Test" binary directory

More Repositories

1

bazaarBot

A simple free market simulator engine. Based on "Emergent Economies for Role Playing Games" by Doran and Parberry.
Haxe
373
star
2

polymod

Atomic modding framework for Haxe
Haxe
159
star
3

firetongue

A translation/localization framework written in Haxe
Haxe
143
star
4

crashdumper

A cross-platform automated crash report generator/sender for Haxe/OpenFL apps.
PHP
112
star
5

HxLightMask

A tiny 2D grid-based lighting engine for Haxe
Haxe
43
star
6

tdrpg-tools

A set of tools for the tdrpg-haxe project
Haxe
42
star
7

ThirdPartySteamSites

List of all the third party Steam sites that I know of
41
star
8

tdrpg-bugs

Public bug reporting repository for the tdrpg-haxe project (DQ1-haxe and DQ2-haxe)
38
star
9

divingbell

Source code for the Steam Diving Bell prototype (not to be confused with Steam Deep Dive)
Haxe
29
star
10

haxe-flx-ui

FlxUI - GUI library for Haxe+Flixel
Haxe
28
star
11

FlashEmulator

A proposal for a true "Flash Emulator"
26
star
12

CellGame--Open-Source-fork-of--CellCraft--

A real-time strategy game that incorporates real cellular Biology. Grow your cell and fight off viruses!
ActionScript
23
star
13

georgism

Little website about georgism
Pug
17
star
14

monologue-reader

A Haxe parser & controller library for Monologue trees
Haxe
10
star
15

safeparse

A collection of Haxe static extensions that safely read from XML and JSON, reducing boilerplate
Haxe
10
star
16

larsBounties

Open bounties for various tasks Lars needs to delegate to others
9
star
17

StealMyIdeas

Here's some ideas I have. Feel free to steal them.
7
star
18

boardgames

Some board games I designed once that are now open source
6
star
19

gogwrap

Haxe native extension for the GOG Galaxy API
C++
6
star
20

openfl-fla-plugin-tests

Tests of the OpenFL Custom FLA document
Haxe
5
star
21

fireglyph

A Haxe utility library for alphabets, glyphs, and other writing systems
Haxe
4
star
22

HaxePloverLearn

Drills for the Learn Plover! book, part of the Open Steno Project (Haxe port of Erika-n's AS3 version)
HTML
3
star
23

loc-sync

Synchronizes localization files between Google Sheets and a Git repository
PHP
3
star
24

gamejams

Game Jam Repository
Haxe
3
star
25

haxe-test-projects

Just a dumping ground for test projects I want to easily share.
Haxe
3
star
26

nme-benchmark-threshold

A simple test suite for benchmarking nme.display.BitmapData.threshold() function
Haxe
2
star
27

tdrpg-mod-docs

Mod documentation for the TDRPG engine (Defender's Quest)
1
star
28

songs

Original Songs
1
star
29

defendersquest-loc

Localization Repository for Defender's Quest series
1
star
30

timur_budgets

Video Game Budget records based on work by https://twitter.com/bogorad222
1
star
31

SuperSpaceDefenders

The Super Space Defenders Example Mod for tdrpg-haxe engine
1
star
32

hxcpp-examples

Haxe
1
star
33

SDLGrid

Just a little shared table of every platform that exists and whether it supports SDL, Vulkan, and OpenGL.
1
star
34

genre_evolution

Charting the evolution of genres over time
1
star
35

ActionPact

Fiddling around with a C API for universal input actions
C++
1
star