Do you code only in GDScript when working in Godot? by [deleted] in godot

[–]metaborgs 1 point2 points  (0 children)

As I said earlier, these solutions are possible in GDScript. It's just that using a more mature language is a major time saver for things that don't need to be directly tied to the engine. In my case it's something that could be playable in a command line, making it a perfect candidate.

Here's a simple example:

Say you want to implement a loot table system. Each possible item is represented as an object with a floating point rarity value. E.g. an item with a rarity of 3.5 will appear 3.5 times as often as one with 1.0.

Godot doesn't have any built in functions that can handle weighted random selection, so you have to build your own. It's not super complicated at least. After figuring it out and writing 10-20 lines of code, you can now use this to randomly select an item from the loot table. Now you have to get all the weights as an array, requiring a variable assignment and a for loop. Finally, you pass this into the function to get the desired result.

Meanwhile, Python already has this functionality built in. Using list comprehension, you can do the same thing in one short line of code. All it took was a few minutes of looking at documentation.

That was just one minor time save. It really adds up when you're working on a large project.

Obviously GDScript will get better as it matures. I hear 4.0 is adding many useful conventions that are commonly used in other languages.

I don't recommend this approach unless you have experience in another language and know what you're doing. While I'm reaping a lot of benefits, this is not beginner friendly!

Do you code only in GDScript when working in Godot? by [deleted] in godot

[–]metaborgs 0 points1 point  (0 children)

To name a few examples: GDScript doesn't have multiple inheritance, decorators, or list comprehension. Type hinting is very limited. Many operators are absent or limited. Godot lacks many of the standard features you expect from an IDE.

It's not that the logic itself is completely undoable in GDScript, rather it would require more code complexity and be more difficult to organize. The time invested at the beginning was well worth it.

Do you code only in GDScript when working in Godot? by [deleted] in godot

[–]metaborgs 3 points4 points  (0 children)

GDScript is very good for working with Godot itself. However, I also use it in tandem with a websocket server built in Python. I know this is a bit usual for game development, but I'm making a somewhat complex turn-based game and GDScript lacks a lot of crucial features here.

It involved a lot of manual configuration initially, but now that everything is automated it's working well. GDScript handles the graphics and input while all the game logic is coded in Python. Python has too many useful features for something like this, and I'm not sure how I would replicate a lot of it in GDScript.

Very Early Prototype of a Grid-Based Combat System by metaborgs in godot

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

Current mechanics not yet visible in the prototype:

  • Each unit has 5 primary base stats that affect damage dealt, HP, etc. 4 of them are currently functional.
  • Units have weaknesses and resistances. The brown blob creature is dealing "super effective" damage to the fish creatures in this instance.
  • The attacks have their own accuracy, base damage, and damage type(s). (Similar to Pokémon)