Skip to content

Commit

Permalink
Updated how-tos
Browse files Browse the repository at this point in the history
  • Loading branch information
Gramps committed Oct 9, 2023
1 parent e95d899 commit 5ad9448
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 27 deletions.
10 changes: 8 additions & 2 deletions docs/howto/gdextension.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,12 @@ That's it! Done!

Now you should be able to call functions from **Steam** like you would normally with the **GodotSteam module**:
````
func _init() -> void:
# Set your game's Steam app ID here
OS.set_environment("SteamAppId", str(480))
OS.set_environment("SteamGameId", str(480))
func _ready():
Steam.steamInit()
var isRunning = Steam.isSteamRunning()
Expand All @@ -174,7 +180,7 @@ func _ready():

Note that you **do not** have to enable this in the editor for the extension to work; it is just always present.

Make sure to create a file called **steam_appid.txt** and place it with your editor or at the root of your game's project folder. You'll need this to run the game from the editor.
Make sure add your game's app ID as the environment variables for SteamAppId and SteamGameId. If you do not have a game app ID yet, you can use 480 for testing. Alternatively, you can create a file called **steam_appid.txt** with your game's app ID as the text, or 480, and place it with your editor or at the root of your game's project folder. You'll need this to run the game from the editor. However, we do recommend the environment variable method.

The documentation for GodotSteam modules should apply to GodotSteam GDExtension as they are built from the same code and have all the same functions; generally speaking.

Expand All @@ -187,4 +193,4 @@ That being said, you should be able to export your game with the normal Godot te

When uploading your game to Steam, you _**must**_ upload your game's executable and **Steam API .dll/.so/.dylb** (steam_api.dll, steam_api64.dll, libsteam_api.dylib, and/or libsteam_api.so) as well as the **exported GodotSteam file .dll/.so/.dylib** (godotsteam.dll, libgodotsteam.so, and/or libgodotsteam.dylib).

*Do not* include the steam_appid.txt or any .lib files as they are unnecessary; however, they won't hurt anything.
*Do not* include any .lib files as they are unnecessary; however, they won't hurt anything.
20 changes: 13 additions & 7 deletions docs/howto/gdnative.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,17 +204,25 @@ In a text editor, create a file called **godotsteam.gdns** (this may need to be
script_class_name = "Steam"
````

Create a new scene in your game project and add a Node node with a GDScript as the script. Add the following code:
Create a new script in your game project and add the following code:
````
extends Node
onready var Steam = preload("res://addons/godotsteam/godotsteam.gdns").new()
func _init() -> void:
# Set your game's Steam app ID here
OS.set_environment("SteamAppId", str(480))
OS.set_environment("SteamGameId", str(480))
func _ready():
Steam.steamInit()
Steam.steamInitEx()
````
Save the scene as **steam.tscn** and place it where ever you want. Now navigate to **Project > Project Settings** in the editor and click on **Autoload**. Add your **steam.tscn** as a singleton, with the node name of **Steam**.

You will want to set those environment variables with your game's app ID or, if you don't have one yet, as 480 like in the example above. This tells Steam what game you are running. Alternatively, you can create a `steam_appid.txt` file with your game's app ID as the only text then place that next to your editor or with the exported game. However, we recommend you use the environment variables instead.

Save this as **steam.gd** and place it where ever you want. Now navigate to **Project > Project Settings** in the editor and click on **Autoload**. Add your **steam.gd** as a singleton, with the node name of **Steam**.

Done!

Expand All @@ -230,7 +238,7 @@ Now you should be able to call functions from **Steam** like you would normally
func setAchievement(achieve):
Steam.setAchievement(achieve)
````
These can then be called in any other script (since **steam.tscn** is a singleton) like this:
These can then be called in any other script (since **steam.gd** is a singleton) like this:
````
print(steam.name)
print(steam.country)
Expand All @@ -241,8 +249,6 @@ These can then be called in any other script (since **steam.tscn** is a singleto
steam.setAchievement(achieve)
````

Make sure to create a file called **steam_appid.txt** and place it with your editor or at the root of your game's project folder. You'll need this to run the game from the editor.

The documentation for GodotSteam should apply to GodotSteam GDNative as they are built from the same code and have all the same functions; generally speaking.

**Note:** GDNative on Windows has some odd glitch with setRichPresence where sometimes the key is sent as the value; this bug does not exist in the Linux or OSX versions of GodotSteam GDNative nor in any versions of the GodotSteam module nor any versions of the GodotSteam GDExtension. In this case it is deemed unfixable.
Expand All @@ -256,4 +262,4 @@ That being said, you should be able to export your game with the normal Godot te

When uploading your game to Steam, you _**must**_ upload your game's executable and **Steam API .dll/.so/.dylb** (steam_api.dll, steam_api64.dll, libsteam_api.dylib, and/or libsteam_api.so).

*Do not* include the steam_appid.txt or any .lib files as they are unnecessary; however, they won't hurt anything.
*Do not* include any .lib files as they are unnecessary; however, they won't hurt anything.
21 changes: 11 additions & 10 deletions docs/howto/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Here we provide a hopefully thorough explanation of how to set-up, build, and use GodotSteam. You can, of course, skip all this and just download our pre-compiles or plug-in.

---

## 1a. Downloading

By far the easiest way to use GodotSteam is to download our pre-compiled editors and templates; especially good for folks who don't want to set up the tools for compiling and just want to get going.
Expand All @@ -14,9 +15,8 @@ By far the easiest way to use GodotSteam is to download our pre-compiled editors

At this point you can skip all the following steps and check out our tutorials to learn more about integrating Steamworks or just explore the SDK!

Do note that OSX users will need to open the downloaded **GodotEditor.app** and navigate to **/Contents/MacOS** then open the **steam_appid.txt** and add your app ID here; or keep it as 480 if you don't have an app ID yet.

---

## 1b. Compile Yourself

For those of you who are comfortable compiling or want to give it a shot, here are some steps to follow.
Expand All @@ -33,6 +33,7 @@ For those of you who are comfortable compiling or want to give it a shot, here a
* This requires a Steam developer account.

---

## 2. Setting Up the SDK

Move the following from the unzipped Steamworks SDK to the **/modules/godotsteam/sdk/** folder:
Expand All @@ -42,6 +43,7 @@ Move the following from the unzipped Steamworks SDK to the **/modules/godotsteam
````

---

## 3. Double-Checking Folder / File Structure

The compiling directory contents should now look like this:
Expand All @@ -59,6 +61,7 @@ The compiling directory contents should now look like this:
You can also just put the godotsteam directory where ever you like and just apply the ````custom_modules=.../path/to/dir/godotsteam```` flag in SCONS when compiling. Make sure the ````custom_modules=```` flag points to where the godotsteam folder is located.

---

## 4. Compiling Time

Recompile for your platform:
Expand Down Expand Up @@ -87,48 +90,44 @@ Some things to be aware of:
- When creating templates for OSX, [please refer to this post for assistance as the documentation is a bit lacking.](http://steamcommunity.com/app/404790/discussions/0/364042703865087202/){ target="_blank" }

---

## 5. All Together Now

When recompiling the engine is finished, do the following before running it the first time:

- [x] Copy the shared library (steam_api), for your OS, from `sdk/redistributable_bin/` folders to the Godot binary location (by default in the godot source `/bin/` file but you can move them to a new folder).
- These files are called **steam_api.dll, steam_api64.dll, libsteam_api.so, or libsteam_api.dylib**; no other files are needed.
- [x] Create a **steam_appid.txt** file with your game's app ID or 480 in this folder. This is necessary if the editor or game is run _outside_ of Steam.

The finished hierarchy should look like this (if you downloaded the pre-compiles, the editor files go in place of these tools files, which are the same thing):

!!! godotsteam "Linux 32/64-bit"
```
libsteam_api.so
steam_appid.txt
./godot.linux.tools.32 or ./godot.linux.tools.64
```

!!! godotsteam "MacOS"
```
libsteam_api.dylib
steam_appid.txt
./godot.osx.tools.32 or ./godot.osx.tools.64
```

!!! godotsteam "Windows"
=== "Windows 32-bit"
```
steam_api.dll
steam_appid.txt
./godot.windows.tools.32.exe
```
=== "Windows 64-bit"
```
steam_api64.dll
steam_appid.txt
./godot.windows.tools.64.exe
```

A lack of the **Steam API .dll/.so/.dylib** for your respective OS or the **steam_appid.txt** will cause the editor or game to fail and crash when testing or running the game _outside_ of the Steam client.
A lack of the **Steam API .dll/.so/.dylib** for your respective OS will cause the editor or game to fail and crash when testing or running the game _outside_ of the Steam client.

- **NOTE:** Some people report putting the Steam API file inside their project folder fixes some issues.
- **NOTE:** For MacOS, the `libsteam_api.dylib` and `steam_appid.txt` must be in the `Content/MacOS/` folder in your application zip or the game will crash.
- **NOTE:** For MacOS, the `libsteam_api.dylib` must be in the `Content/MacOS/` folder in your application zip or the game will crash.
- **NOTE:** For Linux, you may have to load the overlay library for Steam overlay to work:
```
export LD_PRELOAD=~/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so;~/.local/share/Steam/ubuntu12_64/gameoverlayrenderer.so
Expand All @@ -141,13 +140,15 @@ A lack of the **Steam API .dll/.so/.dylib** for your respective OS or the **stea
This can be done in an .sh file that runs these before running your executable. This issue may not arise for all users and can also just be done by the user in a terminal separately. You can [read more about it in our Linux Caveats doc](../tutorials/linux_caveats.md).

---

## 6. Good to Go

From here you should be able to call various functions of Steamworks. You should be able to look up the functions in Godot itself under the search section. In addition, you should be able to [read the Steamworks API documentation](https://partner.steamgames.com/doc/){ target="_blank" } to see what all is available and cross-reference with GodotSteam's documentation.

---

## 7. Exporting / Shipping Your Game

For a full explanation of exporting and shipping your game with GodotSteam, [please refer to our Export and Shipping tutorial.](../tutorials/exporting_shipping.md)

That being said, here is a quick run-down of things to remember. When uploading your game to Steam, you _**must**_ upload your game's executable and **Steam API .dll/.so/.dylb** (steam_api.dll, steam_api64.dll, libsteam_api.dylib, and/or libsteam_api.so). *Do not* include the steam_appid.txt or any .lib files as they are unnecessary; however, they won't hurt anything.
That being said, when uploading your game to Steam, you _**must**_ upload your game's executable and **Steam API .dll/.so/.dylb** (steam_api.dll, steam_api64.dll, libsteam_api.dylib, and/or libsteam_api.so).
11 changes: 3 additions & 8 deletions docs/howto/server.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,41 +93,36 @@ When recompiling the engine is finished, do the following before running it the

- [x] Copy the shared library (steam_api), for your OS, from sdk/redistributable_bin/ folders to the Godot binary location (by default in the godot source /bin/ file but you can move them to a new folder).
- These files are called **steam_api.dll, steam_api64.dll, libsteam_api.so, or libsteam_api.dylib**; no other files are needed.
- [x] Create a **steam_appid.txt** file with your game's app ID or 480 in this folder. Necessary if the editor or game is run _outside_ of Steam.

The finished hierarchy should look like this (if you downloaded the pre-compiles, the editor files go in place of these tools files, which are the same thing):

!!! godotsteam "Linux 32/64-bit"
```
libsteam_api.so
steam_appid.txt
./godot.linux.tools.32 or ./godot.linux.tools.64
```

!!! godotsteam "MacOS"
```
libsteam_api.dylib
steam_appid.txt
./godot.osx.tools.32 or ./godot.osx.tools.64
```

!!! godotsteam "Windows 32-bit"
```
steam_api.dll
steam_appid.txt
./godot.windows.tools.32.exe
```
!!! godotsteam "Windows 64-bit"
```
steam_api64.dll
steam_appid.txt
./godot.windows.tools.64.exe
```

Lack of the **Steam API .dll/.so/.dylib**, for your respective OS, or the **steam_appid.txt** will cause the editor or game fail and crash when testing or running the game _outside_ of the Steam client.
Lack of the **Steam API .dll/.so/.dylib**, for your respective OS will cause the editor or game fail and crash when testing or running the game _outside_ of the Steam client.

- **NOTE:** Some people report putting the Steam API file inside their project folder fixes some issues.
- **NOTE:** For MacOS, the libsteam_api.dylib and steam_appid.txt must be in the Content/MacOS/ folder in your application zip or the game will crash.
- **NOTE:** For MacOS, the libsteam_api.dylib must be in the Content/MacOS/ folder in your application zip or the game will crash.
- **NOTE:** For Linux, you may have to load the overlay library for Steam overlay to work:
```
export LD_PRELOAD=~/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so;~/.local/share/Steam/ubuntu12_64/gameoverlayrenderer.so
Expand All @@ -149,4 +144,4 @@ From here you should be able to call various functions of Steamworks. You should

For a full explanation of exporting and shipping your game with GodotSteam, [please refer to our Export and Shipping tutorial.](../tutorials/exporting_shipping.md)

That being said, here is a quick run-down of things to remember. When uploading your game to Steam, you _**must**_ upload your game's executable and **Steam API .dll/.so/.dylb** (steam_api.dll, steam_api64.dll, libsteam_api.dylib, and/or libsteam_api.so). *Do not* include the steam_appid.txt or any .lib files as they are unnecessary; however, they won't hurt anything.
That being said, when uploading your game to Steam, you _**must**_ upload your game's executable and **Steam API .dll/.so/.dylb** (steam_api.dll, steam_api64.dll, libsteam_api.dylib, and/or libsteam_api.so). *Do not* include any .lib files as they are unnecessary; however, they won't hurt anything.

0 comments on commit 5ad9448

Please sign in to comment.