GodotSteam / GodotSteam-Server

The dedicated server builds for GodotSteam, an open-source and fully functional Steamworks SDK / API module and plug-in for the Godot Game Engine.
https://godotsteam.com
MIT License
29 stars 6 forks source link

[Windows 64 bits ─ Crash] Unable to initialize the server #3

Open J-Bustin opened 3 months ago

J-Bustin commented 3 months ago

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):

USER ERROR: Method/function failed.
   at: ClassDB::bind_integer_constant (core\object\class_db.cpp:717)

Next, when I add a script that runs on launch with line SteamServer.serverInitEx(params...), the executed project crashes.

Here is the full log:

Godot Engine v4.2.2.stable.custom_build.dd598c425 - https://godotengine.org
USER ERROR: Method/function failed.
   at: ClassDB::bind_integer_constant (core\object\class_db.cpp:717)
Vulkan API 1.3.277 - Forward+ - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce GTX 1080

================================================================
CrashHandlerException: Program crashed
Engine version: Godot Engine v4.2.2.stable.custom_build (dd598c4255648ae27d44cfcd2c5383b3bc2b49e2)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[0] <couldn't map PC to fn name>
[1] <couldn't map PC to fn name>
[2] <couldn't map PC to fn name>
[3] <couldn't map PC to fn name>
[4] <couldn't map PC to fn name>
[5] <couldn't map PC to fn name>
[6] <couldn't map PC to fn name>
[7] <couldn't map PC to fn name>
[8] <couldn't map PC to fn name>
[9] <couldn't map PC to fn name>
[10] <couldn't map PC to fn name>
[11] <couldn't map PC to fn name>
[12] <couldn't map PC to fn name>
[13] <couldn't map PC to fn name>
[14] <couldn't map PC to fn name>
[15] <couldn't map PC to fn name>
[16] <couldn't map PC to fn name>
-- END OF BACKTRACE --
================================================================

Many thanks in advance for your help. :)

Gramps commented 3 months ago

Hmm, definitely a bug in the code somewhere. Thanks for reporting it! I will get it fixed up.

VirtualBrightPlayz commented 2 months ago

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.

J-Bustin commented 2 months ago

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. :)

VirtualBrightPlayz commented 2 months ago

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 :)

J-Bustin commented 2 months ago

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. :)

Gramps commented 2 months ago

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.