Hello dear MonoGame community,
you know what sucks? Yeah, exactly: when simple things are ridiculous complicated to realize or at least when they are too stressful or too much work to handle right.
You know whats great? The:
☛ Facepunch.Steamworks MonoGame-Integration
Because it will make your life much easier when you want to integrate the SteamAPI into your app.
Why? Well, unlike many other SteamAPI wrappers, the Facepunch.Steamworks library allows to code in native C#! Say bye bye to manual function calling and finally code like this again:
foreach ( var friend in SteamFriends.GetFriends() )
{
Console.WriteLine( "{friend.Id}: {friend.Name}" );
Console.WriteLine( "{friend.IsOnline} / {friend.SteamLevel}" );
friend.SendMessage( "Hello Friend" );
}
public static async Task<Texture2D> GetUserImage(SteamId id, GraphicsDevice device)
{
var image = await SteamFriends.GetMediumAvatarAsync(id);
if (image.HasValue)
{
Texture2D avatarTexture = new Texture2D(device, (int)image.Value.Width, (int)image.Value.Height, false, SurfaceFormat.Color);
avatarTexture.SetData(image.Value.Data, 0, image.Value.Data.Length);
return avatarTexture;
}
else return null;
}
UserAvatar = GetUserImage(UserID, GraphicsDevice).Result;
And with this specific MonoGame implementation I wanted to share my experience with that library and also to push out some small tutorials in form of sample projects (included in the repo).
So far they are the same as in my previous Steamworks.Net repo [mgc]:
- Hello Facepunch.Steamworks: Simple sample which sets up bare basics of the SteamAPI and displaying a welcome message which includes your steam user name.
- AchievementHunter: Simple sample which shows you the correct way of implementing achievements and stats as well as storing them on the steam server. It’s based upon the Steamworks Example ‘SpaceWar’ included with the Steamworks SDK.
- Facepunch.Steamworks MonoGame Integration: Extendend sample which shows some features of the SteamAPI like UserStats, PersonaState, LeaderboardData, NumberOfCurrentPlayers, Steam User Avatar and so on.
My future plan is to create other sample projects ontop of this base to show how to create a steam workshop or how to use the SteamInput functionallity, which makes all gamepads available in your MonoGame project, which are compatible with the SteamAPI.
For now I wish you much fun with this repo and happy coding!
Cheers,
Marcel | Sandbox Blizz
PS: The MonoGame logo is a Fist, so the Facepunch integration was nothing else then… DESTINY!