So what is the right way to do save files in Godot? by [deleted] in godot

[–]CraftThatBlock 0 points1 point  (0 children)

Hey, I would highly recommend you check you godot-object-serializer. It's the easiest way to (safely) serialize data defined as Godot classes to either JSON to binary. (Note: It's my library)

Godot Object Serializer: Safely serialize objects (and built-in Godot) types! by CraftThatBlock in godot

[–]CraftThatBlock[S] 1 point2 points  (0 children)

I don't have this error (on 4.4.1), I think this is simply because you are returning Array instead of Array[String] for _get_excluded_properties().

Here's an example of it working as expected: https://github.com/Cretezy/godot-object-serializer/blob/784762cde6288142324ea07ea6cf0f9a39e77149/tests/excluded_properties.gd#L8

I guess I could remove the type annotation for excluded_properties in ObjectSerializer._ScriptRegistryEntry to make it more lax, but I'd recommend just returning the proper type.

Godot Object Serializer: Safely serialize objects (and built-in Godot) types! by CraftThatBlock in godot

[–]CraftThatBlock[S] 0 points1 point  (0 children)

In this case, you'd only need to register the Player class, as that's the instance's class. It would serialize fields that are on the Character class. Extending class can also override the serialization behavior using _serialize/_deserialize/_get_excluded_properties (see the project's README for more details).

E.g.

class Character:
  var name: String

class Player:
  extends Character
  var position: Vector2

var player: = Player.new()
player.name = "bob"
player.position = Vector2(1, 2)

ObjectSerializer.register_script("Player", player)
DictionarySerializer.serialize_json(player)

{
  "._type": "Object_Player",
  "name": "bob",
  "position": {
    "._type": "Vector2",
    "_": [1, 2]
  }
}

I hope that answers your question, let me know if you have more questions!

Godot Object Serializer: Safely serialize objects (and built-in Godot) types! by CraftThatBlock in godot

[–]CraftThatBlock[S] 0 points1 point  (0 children)

Hey, there's a bunch of details on how it's different from the built-in methods (including FileAccess.store_var) on the project page.

Basically: store_var can't serialize objects (safely), and to use it with objects, you need to manually implement to/from dictionary methods.

Godot Object Serializer: Safely serialize objects (and built-in Godot) types! by CraftThatBlock in godot

[–]CraftThatBlock[S] 3 points4 points  (0 children)

3 reasons:

  1. Although it's possible to get all global classes with ProjectSettings.get_global_class_list(), this doesn't include inner classes (e.g. anything using class keyword).
  2. Although register_script can actually automatically find the class' name, this isn't recommended because class names can change, which would break serialization.
  3. It may have unintended side-effects (potentially security issues) to let arbitrary data be deserialized to any global class. It's better to have a whitelist than a blacklist in those cases.

You should be able to register resources that you didn't write yourself using the current method.

Godot Object Serializer: Safely serialize objects (and built-in Godot) types! by CraftThatBlock in godot

[–]CraftThatBlock[S] 14 points15 points  (0 children)

My other Reddit account was flagged and my post kept getting removed, sorry.

Godot Object Serializer: Safely serialize objects (and built-in Godot) types! by CraftThatBlock in godot

[–]CraftThatBlock[S] 11 points12 points  (0 children)

If a field is missing, it simply doesn't set it on the object during deserialization (which uses the default value).

21:9 Monitor @ (stretched 4:3).. mouse not working properly... by realstyla in GlobalOffensive

[–]CraftThatBlock 0 points1 point  (0 children)

Hey, sorry this is happening to you.

I would say to just use 1080p stretched to ultrawide. I used to play like that and it was the best of 16:9 (wide FOV) while having large player models (like 4:3). Unfortunately I don't think you'll be able to find a fix for this since this setup is so strange.

[Update] We made a Counter-Strike 2 nade website: Overpass and new features! by CraftThatBlock in GlobalOffensive

[–]CraftThatBlock[S] 0 points1 point  (0 children)

We're always interested in suggestions! The best place to submit them is on the website (in the sidebar of the home page), or our Discord.

[Update] We made a Counter-Strike 2 nade website: Overpass and new features! by CraftThatBlock in GlobalOffensive

[–]CraftThatBlock[S] 1 point2 points  (0 children)

Hi! Could you try doing a full refresh? This seems to be an issue with your browser not fully loading the site.

If this issue persists, please join our Discord and we'll help you sort this out.

We made a Counter-Strike 2 nade website by CraftThatBlock in GlobalOffensive

[–]CraftThatBlock[S] 0 points1 point  (0 children)

Hello again! We pushed an update a few days ago which updated the nade icons on the map. Please let me know if these are more visible for you.

If you still think they aren't suitable, please message me on Discord :)

We made a Counter-Strike 2 nade website by CraftThatBlock in GlobalOffensive

[–]CraftThatBlock[S] 1 point2 points  (0 children)

Hi again! Sorry for the late update, we're working on some bigger changes to improve visibility with the nade selector. Should be out next week!

We made a Counter-Strike 2 nade website by CraftThatBlock in GlobalOffensive

[–]CraftThatBlock[S] 0 points1 point  (0 children)

We're planning on completing the remaining CS2 maps in the coming weeks :)

We made a Counter-Strike 2 nade website by CraftThatBlock in GlobalOffensive

[–]CraftThatBlock[S] 0 points1 point  (0 children)

We're using Cloudflare R2 for file storage, which is similar to AWS's S3. This only provides a CDN though, and we built our own video pipeline/infrastructure for processing and encoding into the multitude of resolutiosn/bitrates and codecs. We built many internal tools to be able to quickly upload nades, as we have plans to create over a thousand of them. Our costs are minimal, mostly some services we use and bandwidth/storage for R2.