• 15
• 15
• 11
• 9
• 10

# SteamWorks .NET integration

This topic is 2491 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello,

I'm not sure I'm posting in the right place, but there wasn't really anything better suited.

So this is the thing,
I'm currently working on an application that I would really like to apply to SteamWorks when I get the beta build done in about a couple of weeks.
However, looking at their FAQ just now brought me to a statement that SteamWorks doesn't offer a built in wrapper for .NET languages to the SDK.

My project is heavily dependant on the .NET functionality in it, which brings me to ask the following few:
- Having no wrapper means that it wouldn't have support to be published through Steam at all, or would it only mean that I would have no support for the SteamWorks' functionality the SDK has to offer?
- My project is actually composed of 2 executables, one is for designing, the one done in .NET, and has no actual need of the SteamWorks' functions (except for it being the main executable that I would need to be the one opened by Steam when it's clicked to play), and the other is a native application that should be able to incorporate SteamWorks' API in it, and in which they are needed.
The question being, will it be possible to support running of the .NET application from the Steam menu using this? And will it be possible to boot the other executable that utilizes the API through this .NET application, and still maintain support from SteamWorks?

Again, I don't know if this is the right place, but I'm just hoping there might be some people around here that actually have access to SteamWorks, that can help and answer my question? SteamWorks' site has no support page, so there's no where I can ask this there =\

Thank you very much for your time to reading and acknowledging my problem.

##### Share on other sites
As with any C++ library you want to access from a .Net language a wrapper can always be written.

There are existing games on Steam which are written in a .Net language (C# mostly) which have Steamwork integrated into them.

However, you would have to write this wrapper yourself if Valve don't have one they can supply you with; due to the restrictions on the Steamworks SDK licensing you also couldn't just ask someone else to do it for you I'm afraid.

Also, it should be noted that people using Steamworks are likely under various agreements which means they can't discuss the details of the SDK with you and certainly not on a public forum.

##### Share on other sites
Yes you can. I'm currently beta testing Galactic Arms Race which is an XNA game with full Steam Integration. There are two other XNA games already available on Steam, Terraria and Sol Survivor. Here's links to all 3 games:

http://gar.eecs.ucf.edu/

http://store.steampo....com/app/45000/

http://store.steampo...com/app/105600/

Basically you just make a bunch of C# wrapper functions for the Steamworks DLL. It can be a bit tricky and time consuming depending on what functionality you need. Also, you cannot try/catch recover from exceptions thrown by a DLL, so debugging can be a hassle.

If you (or anyone else) get accepted on Steam and get a game ID, I will gladly share my C# wrapper code. It will save you a lot of time/hassle. Just PM me here or post on the Galactic Arms Race web site. You would have to get accepted by Valve first of course, and anyway, the code would be useless if you don't have access to the Steamworks SDK.

##### Share on other sites
Thank you both for the answers, that helped me alot.

And sure EJH, I'll keep that in mind and contact you when the time comes, thank you very much =)

##### Share on other sites
I haven't worked in a .NET language in some time, but I thought using C API DLLs in C# was a trivial task.

Wouldn't you just use pinvoke?

 [DllImport("steamworks.dll")] public static void SomeSteamAPI(); 

I don't see where the challenge lies.

##### Share on other sites

I haven't worked in a .NET language in some time, but I thought using C API DLLs in C# was a trivial task.

Wouldn't you just use pinvoke?

 [DllImport("steamworks.dll")] public static void SomeSteamAPI(); 

I don't see where the challenge lies.

The challenge lies in the fact that SteamWorks is a rather large class based library, not just a collection of functions that can be willy-nilly P/Invoked with success. It's not impossible, but it's not trivial either.

##### Share on other sites
I don't see where the challenge lies.

Uhh many places:

- how do you call C++ DLL from C# in the first place?
- how do you marshal every C# type to every C++ type?
- what do you do when the C++ DLL function your are calling requires C++ structs/classes as parameters?
- string encoding is not straightforward at all. UTF, Ascii, C++ strings, C# strings, C char[] arrays, etc... you may need to convert any of those to any other.
- how do you convert stuff like delegates, function pointers, callbacks, etc. from C# to C and vice-versa?
- what if either DLL or .exe is threaded and the other is not?
- handling/debugging exceptions in a DLL?

It is not trivial at all, unless you have done it all before.

##### Share on other sites
Most of these are problems relating to C# to C++ wrapping though, what if the program already works with C++?

And I just need to ask this again, since you worked with it, and I forgot I didn't get the answer in the last post, my .NET program doesn't actually need the Steam support, just needs to be put for download and use the statistics features, no matchmaking/leaderboards/achievments or anything like that, will that require a wrapper too?

##### Share on other sites

Most of these are problems relating to C# to C++ wrapping though, what if the program already works with C++?

And I just need to ask this again, since you worked with it, and I forgot I didn't get the answer in the last post, my .NET program doesn't actually need the Steam support, just needs to be put for download and use the statistics features, no matchmaking/leaderboards/achievments or anything like that, will that require a wrapper too?

In that case you don't need to make any wrapper code at all. You can write it in Cobol if you want and the Steam installer will just install the game.