0 votes

Does godot allow any way of updating the game directly from file or server? Or maybe adding/replacing code, assets or other files of the project with code? It will allow to not rely on game stores and allow to not download whole game, but only parts that player wants to play.

Godot version 3.x
in Engine by (97 points)

3 Answers

0 votes
Best answer

I found the answer by myself. You can use .pck files to import additional contents to the game. This docs page has all the information. Also I found another Q&A posted in 2016 which had very similar question as this. Here is the link. Using this method should be pretty simple and should work better than TimiT had shown, because I think it should have code compiled to bytecode and have no limitation to what content can be added (except limit of max size of .pck file, it’s 2gb, but it may be solvable with a couple of .pck files instead of only one).

by (97 points)
+1 vote

Yes, it can, but not all code. You should write loader manually :)

Load file to user:// dir:

var file = File.new()
file.open("user://_path/to/file_", File.WRITE)

Load scene dynamicully:

var scene = load("user://_path_to_scene_).instance()

Add script to node:

node.script.source_code="extends Reference\nfunc hw():\n\tprint(\"Hello World\")\n"
node.hw() # prints Hello World

Get files in directory:

var dir = Directory.new()
if dir.open(path) == OK:
    var file_name = dir.get_next()
    while file_name != "":
        print("Found file: " + file_name)
        file_name = dir.get_next()

For example, you can load level10 scene file with imported script and save it in user://levels. Then check all files here and load required

Also you can use ResourceServer for this manipulations (but I'm not sshure)

Read more here:

by (102 points)
+1 vote

Implementing support for game updates is a much more complicated task than it sounds like at first. You have to use a secondary process since the main executable can't be replaced while the project is running on Windows. Security is also important to keep in mind; you're expected to sign releases so that malicious releases can't be installed on clients if your server is compromised.

In short, it's not really worth the effort compared to using a game store platform.

by (11,357 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.