Open J-Bustin opened 3 months ago
Hmm, definitely a bug in the code somewhere. Thanks for reporting it! I will get it fixed up.
Make sure to have a steam_appid.txt
with the contents being the App Id number on Steamworks (i.e. Spacewar is 480
), this solved the issue for me.
EDIT: no it didn't, I forgot I was calling steam client init in addition to steam server init.
EDIT2: It seems that Steam requires the API initialized before using functions to convert an IP to an integer.
bool SteamServer::serverInit(uint32_t ip, int game_port, int query_port, ServerMode server_mode, const String& version_number) {
if (!SteamGameServer_Init(ip, game_port, query_port, (EServerMode)server_mode, version_number.utf8().get_data())) {
return false;
}
return true;
}
This code worked fine, so long as you convert the IP to an int and have the steam_appid.txt
file.
Hello @VirtualBrightPlayz ,
I try to use C# to program my Godot games. To use GodotSteam, I use GDScript.
Do you program in C++? The double colon reminds me of Unreal Engine.
Thanks for trying to help. :)
Do you program in C++? The double colon reminds me of Unreal Engine.
The code I posted previously is C++, and is a modified version of the code found in godotsteam_server.cpp.
An ip
number can be generated from an IPv4 using this not-fully-featured (but functional) GDScript code:
static func ipv4_to_int(ip: String) -> int:
var segments := ip.split(".")
var final: int = 0
for i in range(segments.size()):
final <<= 8
final |= segments[i].to_int()
return final
I try to use C# to program my Godot games. To use GodotSteam, I use GDScript.
As for what scripting language I use, I use C# in some projects and GDScript in others. It varies from project to project.
Thanks for trying to help. :)
You're welcome :)
Hello everyone,
I apologize for any confusion I may have caused.
Would it be possible for one of you, at a later date, to write a short tutorial on how to initialize "(Godot)SteamServer" and connect to it? I have the feeling that this differs somewhat from traditional "(Godot)Steam". Furthermore, I don't see any method of initialization from the “SteamServer” singleton, but only of creating (or joining) listening sockets.
My code:
extends Node
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() -> void:
SteamServer.createListenSocketIP("127.0.0.1", [])
The error (maybe I need to create another ticket?) :
E 0:00:00:0046 ClassDB::bind_integer_constant: Method/function failed.
<C++ Source> core\object\class_db.cpp:717 @ ClassDB::bind_integer_constant()
Otherwise, I think I'll have to read the framework documentation. I assume the methods available are related to those in C++?
Thank you in advance. :)
Yeah, we need a tutorial on it. I was working on an example server project but got sidetracked working on Skillet instead; it will have a dedicated server which will serve that purpose. All puns intended.
I will probably write a bit up before that though.
Hello,
I'm running Windows 11 64-bits. With a blank project, I encounter a first error when running it under this version of the editor (Godot 4.2.2 - Steamworks 1.59 - GodotSteam Server 4.3):
Next, when I add a script that runs on launch with line
SteamServer.serverInitEx(params...)
, the executed project crashes.Here is the full log:
Many thanks in advance for your help. :)