Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions GameDemo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
<!-- <PublishAot>true</PublishAot> -->
<ReportAnalyzer>true</ReportAnalyzer>
<CodeAnalysisRuleSet>CodeAnalyzers.ruleset</CodeAnalysisRuleSet>
<!-- The root of the Godot Project -->
<GodotProjectRoot>$(MSBuildProjectDirectory)</GodotProjectRoot>
</PropertyGroup>
<ItemGroup Condition="'$(Configuration)' == 'Debug'">
<!-- Test dependencies go here! -->
Expand Down Expand Up @@ -56,5 +58,38 @@
<PackageReference Include="Chickensoft.Serialization.Godot" Version="0.7.11" />
<PackageReference Include="Chickensoft.LogicBlocks" Version="5.16.0" />
<PackageReference Include="Chickensoft.LogicBlocks.DiagramGenerator" Version="5.16.0" PrivateAssets="all" OutputItemType="analyzer" />
<PackageReference Include="Steamworks.Net" Version="2024.8.0" />
</ItemGroup>
<ItemGroup>
<!-- Windows DLL -->
<Content Include="addons/Steamworks.NET/Windows-x64/steam_api64.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<CopyToPublishDirectory>Always</CopyToPublishDirectory>
<Link>steam_api64.dll</Link>
</Content>

<!-- macOS dylib -->
<Content Include="addons/Steamworks.NET/OSX-Linux-x64/steam_api.bundle/Contents/MacOS/libsteam_api.dylib" Condition=" '$(OS)' == 'Unix' ">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<Link>libsteam_api.dylib</Link>
</Content>

<!-- Linux so -->
<Content Include="addons/Steamworks.NET/OSX-Linux-x64/libsteam_api.so" Condition=" '$(OS)' == 'Unix' ">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<Link>libsteam_api.so</Link>
</Content>
</ItemGroup>

<Target Name="CopySteamAPILibrary" AfterTargets="Build">
<!-- Windows: copy steam_api64.dll -->
<Copy Condition=" '$(OS)' == 'Windows_NT' " SourceFiles="addons/Steamworks.NET/Windows-x64/steam_api64.dll" DestinationFolder="$(GodotProjectRoot)" />

<!-- macOS: copy libsteam_api.dylib; note that Steamworks on macOS uses the .bundle folder structure,
but the core binary is in the .dylib. -->
<Copy Condition=" '$(OS)' == 'Unix' " SourceFiles="addons/Steamworks.NET/OSX-Linux-x64/steam_api.bundle/Contents/MacOS/libsteam_api.dylib" DestinationFolder="$(GodotProjectRoot)" />

<!-- Linux: copy libsteam_api.so -->
<Copy Condition=" '$(OS)' == 'Unix' " SourceFiles="addons/Steamworks.NET/OSX-Linux-x64/libsteam_api.so" DestinationFolder="$(GodotProjectRoot)" />
</Target>
</Project>
60 changes: 0 additions & 60 deletions GameDemo.csproj.old

This file was deleted.

21 changes: 21 additions & 0 deletions addons/Steamworks.NET/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2013-2022 Riley Labrecque

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
3 changes: 3 additions & 0 deletions addons/Steamworks.NET/OSX-Linux-x64/Steamworks.NET.dll
Git LFS file not shown
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>11G63</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>libsteam_api.dylib</string>
<key>CFBundleIdentifier</key>
<string>com.rileylabrecque.steam_api</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.60</string>
<key>CSResourcesFileMapped</key>
<string>yes</string>
<key>DTCompiler</key>
<string></string>
<key>DTPlatformBuild</key>
<string>4H1503</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>11E52</string>
<key>DTSDKName</key>
<string>macosx10.7</string>
<key>DTXcode</key>
<string>0463</string>
<key>DTXcodeBuild</key>
<string>4H1503</string>
</dict>
</plist>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Git LFS file not shown

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions addons/Steamworks.NET/README-Standalone.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Steamworks.NET Standalone
==============

This is the project file for the standalone version of _Steamworks.NET_. This is designed to be used with non Unity applications.

* A: The recommended route is to build the standalone assemblies with the project file located in `Standalone/` or download the prebuilt binaries which are available on the [Releases](https://github.com/rlabrecque/Steamworks.NET/releases) page.
* Open the Visual Studio solution (.sln) file, build both targets one for Windows and one for OSX & Linux. (Optional if you downloaded a prebuilt version)
* Reference the built assembly (Steamworks.NET.dll) in your project.
* Start coding! Call SteamAPI.Init() before initializing your renderer.
* B: Otherwise, copy `Plugins/Steamworks.NET` directly into your C# project. In Visual Studio open your project properties, change to the Build tab and define `STEAMWORKS_WIN` or `STEAMWORKS_LIN_OSX` globally via `Conditional compilation symbols`.
* This is only recommended if your binary is not portable across platforms already. If you ship on multiple platforms you must have multiple build targets for each platforms. Please prefer the first route.

* When you build your application the following files must be copied into the output dir:
* All Platforms:
* **steam_appid.txt** - Required for testing your application outside of steam. *Do not ship this to customers!*
* **Steamworks.NET.dll** - Make sure it's the correct version for the platform that you plan on shipping for! - When building for OSX or Linux the wrong Steamworks.NET.dll will be copied over by default, it is recommended that you create a post build script to copy the correct version.
* Windows:
* **steam_api.dll**
* OSX:
* **steam_api.bundle**
* **Steamworks.NET.dll.config** - This lets Mono know where to find CSteamworks.
* Linux:
* **libsteam_api.so**

Have a look at this [example project](https://github.com/rlabrecque/Steamworks.NET-StandaloneTest) to get started.
30 changes: 30 additions & 0 deletions addons/Steamworks.NET/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Steamworks.NET

_Steamworks.NET_ is a C# Wrapper for Valve's Steamworks API, it can be used either with Unity or your C# based Application.

_Steamworks.NET_ was designed to be as close as possible to the original C++ API, as such the documentation provided from Valve largely covers usage of _Steamworks.NET_.
Niceties and C# Idioms can be easily implemented on top of _Steamworks.NET_.

_Steamworks.NET_ fully supports Windows (32 and 64 bit), OSX, and Linux. Currently building against Steamworks SDK 1.60.

* Author: [Riley Labrecque](https://github.com/rlabrecque)
* License: [MIT](https://www.opensource.org/licenses/mit-license.php)
* [Documentation](https://steamworks.github.io/)
* [Discussion Thread](https://steamcommunity.com/groups/steamworks/discussions/0/666827974770212954/)
* [Reporting Issues](https://github.com/rlabrecque/Steamworks.NET/issues)
Note that only Steamworks.NET specific issues should be reported, general API questions/issues should be asked on the [Steamworks discussion board](http://steamcommunity.com/groups/steamworks/discussions).

[![Support via Paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YFZZER8VNXKRC)

## Installation

You can find the installation instructions [here](https://steamworks.github.io/installation/).

## Samples

Check out these sample projects to get started:

* [Steamworks.NET Example](https://github.com/rlabrecque/Steamworks.NET-Example)
* [Steamworks.NET Test](https://github.com/rlabrecque/Steamworks.NET-Test)
* [Steamworks.NET ChatClient](https://github.com/rlabrecque/Steamworks.NET-ChatClient)
* [Steamworks.NET GameServerTest](https://github.com/rlabrecque/Steamworks.NET-GameServerTest)
3 changes: 3 additions & 0 deletions addons/Steamworks.NET/Windows-x64/Steamworks.NET.dll
Git LFS file not shown
3 changes: 3 additions & 0 deletions addons/Steamworks.NET/Windows-x64/steam_api64.dll
Git LFS file not shown
3 changes: 3 additions & 0 deletions addons/Steamworks.NET/Windows-x86/Steamworks.NET.dll
Git LFS file not shown
3 changes: 3 additions & 0 deletions addons/Steamworks.NET/Windows-x86/steam_api.dll
Git LFS file not shown
14 changes: 13 additions & 1 deletion src/app/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace GameDemo;
using Godot;
using Chickensoft.Introspection;

public interface IApp : ICanvasLayer, IProvide<IAppRepo>;
public interface IApp : ICanvasLayer, IProvide<IAppRepo>, IProvide<INetworkingRepo>;

[Meta(typeof(IAutoNode))]
public partial class App : CanvasLayer, IApp {
Expand All @@ -28,13 +28,19 @@ public partial class App : CanvasLayer, IApp {

IAppRepo IProvide<IAppRepo>.Value() => AppRepo;

INetworkingRepo IProvide<INetworkingRepo>.Value() => NetworkingRepo;

#endregion Provisions

#region State

public IAppRepo AppRepo { get; set; } = default!;
public IAppLogic AppLogic { get; set; } = default!;

// Networking State
public SteamRunner SteamRunner { get; private set; } = default!;
public INetworkingRepo NetworkingRepo { get; private set; } = default!;

public AppLogic.IBinding AppBinding { get; set; } = default!;

#endregion State
Expand All @@ -56,6 +62,12 @@ public void Initialize() {
AppLogic.Set(AppRepo);
AppLogic.Set(new AppLogic.Data());

// Setup Networking
var platformService = new SteamPlatformService();
NetworkingRepo = new NetworkingRepo(platformService);
SteamRunner = new SteamRunner(platformService, NetworkingRepo);
AddChild(SteamRunner);

// Listen for various menu signals. Each of these just translate to an input
// for the overall app's state machine.
Menu.NewGame += OnNewGame;
Expand Down
8 changes: 4 additions & 4 deletions src/app/state/AppLogic.g.puml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
@startuml AppLogic
state "AppLogic State" as GameDemo_AppLogic_State {
state "InGame" as GameDemo_AppLogic_State_InGame
state "LeavingGame" as GameDemo_AppLogic_State_LeavingGame
state "LeavingMenu" as GameDemo_AppLogic_State_LeavingMenu
state "LoadingSaveFile" as GameDemo_AppLogic_State_LoadingSaveFile
state "MainMenu" as GameDemo_AppLogic_State_MainMenu
state "SplashScreen" as GameDemo_AppLogic_State_SplashScreen
state "MainMenu" as GameDemo_AppLogic_State_MainMenu
state "LeavingGame" as GameDemo_AppLogic_State_LeavingGame
state "InGame" as GameDemo_AppLogic_State_InGame
state "LeavingMenu" as GameDemo_AppLogic_State_LeavingMenu
}

GameDemo_AppLogic_State_InGame --> GameDemo_AppLogic_State_LeavingGame : EndGame
Expand Down
2 changes: 1 addition & 1 deletion src/coin/state/CoinLogic.g.puml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@startuml CoinLogic
state "CoinLogic State" as GameDemo_CoinLogic_State {
state "Collecting" as GameDemo_CoinLogic_State_Collecting
state "Idle" as GameDemo_CoinLogic_State_Idle
state "Collecting" as GameDemo_CoinLogic_State_Collecting
}

GameDemo_CoinLogic_State_Collecting --> GameDemo_CoinLogic_State_Collecting : PhysicsProcess
Expand Down
10 changes: 5 additions & 5 deletions src/game/state/GameLogic.g.puml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
@startuml GameLogic
state "GameLogic State" as GameDemo_GameLogic_State {
state "Lost" as GameDemo_GameLogic_State_Lost
state "MenuBackdrop" as GameDemo_GameLogic_State_MenuBackdrop
state "RestartingGame" as GameDemo_GameLogic_State_RestartingGame
state "Paused" as GameDemo_GameLogic_State_Paused {
state "Saving" as GameDemo_GameLogic_State_Saving
}
state "Won" as GameDemo_GameLogic_State_Won
state "Lost" as GameDemo_GameLogic_State_Lost
state "Resuming" as GameDemo_GameLogic_State_Resuming
state "MenuBackdrop" as GameDemo_GameLogic_State_MenuBackdrop
state "Playing" as GameDemo_GameLogic_State_Playing
state "Quit" as GameDemo_GameLogic_State_Quit
state "RestartingGame" as GameDemo_GameLogic_State_RestartingGame
state "Resuming" as GameDemo_GameLogic_State_Resuming
state "Won" as GameDemo_GameLogic_State_Won
}

GameDemo_GameLogic_State_Lost --> GameDemo_GameLogic_State_Quit : GoToMainMenu
Expand Down
2 changes: 1 addition & 1 deletion src/jumpshroom/state/JumpshroomLogic.g.puml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
@startuml JumpshroomLogic
state "JumpshroomLogic State" as GameDemo_JumpshroomLogic_State {
state "Cooldown" as GameDemo_JumpshroomLogic_State_Cooldown
state "Idle" as GameDemo_JumpshroomLogic_State_Idle
state "Launching" as GameDemo_JumpshroomLogic_State_Launching
state "Loading" as GameDemo_JumpshroomLogic_State_Loading
state "Idle" as GameDemo_JumpshroomLogic_State_Idle
}

GameDemo_JumpshroomLogic_State_Cooldown --> GameDemo_JumpshroomLogic_State_Idle : CooldownCompleted
Expand Down
Loading