![]() ![]() For my current project, that's fine, as the game doesn't work without connecting to the server anyway. ![]() The other downside to the current implementation is it requires an always-on internet connection. That said, I don't think this project will require much maintenance, as most development will be in the main game project. I already had two projects (client and server), so this is now a third project in the same game. The biggest downside of this approach is that it adds a whole new Godot project to the mix. Run_game() - Load the PCK file, replace the temporary global singleton with the loaded singleton, then go to the main project's initial scene. _on_file_request_completed(.) - When the file is done downloading, start the game. It can be useful if your project is bigger. This is optional, and my PCK file is currently so small that I don't even see these most of the time. _process(delta) - Show the download progress and speed as debug messages. _ready() - Define the download settings and file destination, hook up the signal for when the download is complete, then start the download of the given URL. ![]() The short version of what's happening in each function is: ![]() Get_tree().change_scene("res://src/mainmenu.tscn") G.set_script(load("res://src/globals.gd")) # res:// now includes the original game project ProjectSettings.load_resource_pack("user://cosmic-trading-crew-client.pck") Var speed_in_mega_bytes = speed_in_bytes / 1000000.0įunc _on_file_request_completed(result, response_code, headers, body): Var speed_in_bytes = http.get_downloaded_bytes() - last_bytes nnect("request_completed", self, "_on_file_request_completed") Http.download_file = "user://cosmic-trading-crew-client.pck" In the script below, I'll replace this dummy file with the version from the PCK.Īttached to the root Control node is a script. This is pointing to a dummy file that does nothing, but the variable needed to be defined for the original game project to work. Since my original project had a script that was an autoload singleton, I had to make the same autoload variable name. I added some child nodes of a panel and label that just says "Loading.", but these children are optional. The launcher project is a single scene with a Control node as the root. Once complete, I can build this launcher for all OS types and upload those to itch.io one time, and anyone who gets it will be able to play the latest version without re-downloading. This sounds complicated, but the new project is basically doing nothing except downloading and launching something. Instead of trying to modify my existing Godot project to load a different PCK file for itself, I decided to create a whole separate Godot project just to load my current project. # Invalidate the Cloudfront distribution so users aren't getting a cached versionĪws cloudfront create-invalidation -distribution-id E99Z9A9AAA99A9 -paths '/*' builds/cosmic-trading-crew-client.pckĪws s3 cp client/builds/cosmic-trading-crew-client.pck s3:// Applications/Godot.app/Contents/MacOS/Godot -path. Here's my bash script that does all of these steps for me: This way, I don't need to use the S3 URL, I can instead use something like "". I use the AWS CLI to do all of this, since I had the bucket and Cloudfront distribution already set up. I'm doing all development in Mac OSX, so I figured out the CLI command to build a PCK.įor hosting, I'm using an AWS S3 bucket with a Cloudfront distribution so I can use my domain in Route 53 to point right to the file. Instead, I will build this PCK file whenever I have changes and host it in a public S3 bucket. I decided to make no modifications to my existing game client. When you export, there is an option to just export the PCK. Sometimes this is a part of the executable, and sometimes it is a separate file. When you build or export a Godot game, it creates a PCK file that has all of the game code and assets inside. Additionally, I will be able to streamline my server code so it doesn't have to handle older client versions in addition to the latest versions. This way, anyone who installs the game will rarely have to re-download the game from the website. I decided to make the client automatically download the latest game code whenever it started. On top of that, any changes I make between client versions may cause clients to break. I've been deploying new versions of the server code as I go along, but I realized that anyone using an older client may not be able to play without fully downloading the latest version. This is the first time I've had a game server and game client, as the players are all connecting to a central server to join a crew and play together. I've been working on making a Godot game called Cosmic Trading Crew recently. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |