Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

[Day 6 10/07/2019]

Whew, these last updates were really separated. Well, that happens when you just decide to enter a game jam in 5 minutes :P. Anyways, the Battle system proved to be a pretty BIG problem. Why? Because of Godot's node structure: I managed to do a Turn order queue using the order of the nodes in the scene tree and a basic battle system with only an "attack" action... and then everything went downhill. 

As it turns out, Godot's implementation of nodes wasn't as I initially thought: I thought that the nodes acted as Objects in Python, in that they were blueprints that could be kept outside of the scene tree and could be instanced on the scene with possible variations within 2 similar instances... Instead, the nodes are more like Hard-coded objects that need to be in the scene tree in order to be recognized as anything (For example, I wanted to make 2 arrays: One for buildings on the outside and one for buildings on the inside. The 2 are mutually exclusive and, because of that, the nodes that make up the 2 arrays can't exist at the same time. If I want to make the 2 arrays, I need them all to be in the scene, but because they're exclusive and Godot doesn't recognize them outside of the scene, then I can't make them).

Because the system was giving me such trouble, I decided to go for something I'm comfortable with: Python. I tinkered around and, in 20 minutes, I had a battle system that worked far better than the one I had in Godot. So, with a familiar reference at hand, I went to translate it into Godot... And the problems started again:

1) Godot wants you to make your scripts as independent as possible, and that's good and I support it!... What I don't support is that it doesn't let you run a scene just because you called a method on a function argument. I mean, I know "target" doesn't support that method yet because it's a theorethical argument! Obviously, when I call that function, "target" will have that method, so why do you mark it as an error?

2) Godot and Python have a difference when it comes to running scripts and input: In Python, calling an Input () will pause all the script until the input is passed. In Godot, the script will continue while waiting for the input. Ok, that's fine! That's why you use Yield (), right? Wrong! Because if you use Yield (player.attack (target), "completed"), then it will throw an error because the first argument must be an Object, even though it is an object with a method call. Seeing that, I made a wrapper that called the method and returned thr object without the call, and guess what? Another error! Because it returned an object with no instruction, there was nothing to "complete" and the "completed" signal couldn't be sent. Great. Now, I was getting angry, so I decided to do some li'l old Hardcoding and, inside the wrapper, manually emitted the signal just before returning the object. To nobody's surprise, there was an error. You know why? Because Yield () couldn't understand how a "completed" signal could be sent before finishing the function...*sigh*

All in all, I still think there's a solution somewhere in google or in the docs that will make everything way easier, and my opinion of Godot being a great game engine hasn't changed, it's just that it shows that I need to investigate my tools in more depth and that coding can be a little challenging, specially if you're moving from one language to another.

PD: If anyone knows a solution to my problem, how to instance scenes from .tscn files, how to get nodes outside of scene or how to make functions and Yield () not hate me everytime I use a method, please help me!

PD2: I would post some of the sprites right now, but I just shut off the PC so it'll have to wait until tomorrow :/