Code Monkey home page Code Monkey logo

facepunch.steamworks's Introduction

Facepunch.Steamworks

Another fucking c# Steamworks implementation

Why

The Steamworks C# implementations I found that were compatible with Unity have worked for a long time. But I hate them all. For a number of different reasons.

  • They're not C#, they're just a collection of functions.
  • They're not up to date.
  • They require a 3rd party native dll.
  • They can't be compiled into a standalone dll (in Unity).
  • They have a license.

C# is meant to make things easier. So lets try to wrap it up in a way that makes it all easier.

What

So say you want to print a list of your friends?

foreach ( var friend in client.Friends.All )
{
    Console.WriteLine( "{0}: {1}", friend.Id, friend.Name );
}

But what if you want to get a list of friends playing the same game that we're playing?

foreach ( var friend in client.Friends.All.Where( x => x.IsPlayingThisGame ) )
{
    Console.WriteLine( "{0}: {1}", friend.Id, friend.Name );
}

You can view examples of everything in the Facepunch.Steamworks.Test project.

Usage

Client

Compile and add the library to your project. To create a client you can do this.

var client = new Facepunch.Steamworks.Client( 252490 );

Replace 252490 with the appid of your game. This should be a singleton - you should only create one client, right at the start of your game.

The client is disposable, so when you're closing your game should probably call..

client.Dispose();

Or use it in a using block if you can.

Server

To create a server do this.

var server = new Facepunch.Steamworks.Server( 252490, 0, 28015, true, "MyGame453" );

This will register a secure server for game 252490, any ip, port 28015. Again, more usage in the Facepunch.Steamworks.Test project.

Unity

Yeah this works under Unity. That's half the point of it.

There's another repo with an example project with it working in Unity. You can find it here.

The TLDR is before you create the Client or the Server, call this to let Facepunch.Steamworks know which platform we're on - because it can't tell the difference between osx and linux by itself.

Facepunch.Steamworks.Config.ForUnity( Application.platform.ToString() );

You'll also want to put steam_api64.dll and steam_appid.txt (on windows 64) in your project root next to Assets.

Help

Wanna help? Go for it, pull requests, bug reports, yes, do it.

License

MIT - do whatever you want.

facepunch.steamworks's People

Contributors

garrynewman avatar mikecom32 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.