• 2 Posts
  • 7 Comments
Joined 3 years ago
cake
Cake day: July 5th, 2023

help-circle
  • I understand where you’re coming from. AI can be a learning tool to help fill in some gaps in knowledge, however the moment you don’t understand what it’s doing and just copy and paste the code, it no longer become a tool but instead a crutch. Instead of copying and pasting code you can take the time to look into why it’s doing what it’s doing. For Godot in particular they have really good documentation and there’s plenty of resources to learn. GD script is a pretty easy language to learn on a surface level. You should do some research into game design patterns and basic programming concepts.

    I did take a look at your code and while you do have your main.gd organized, having a large monolith like that with 1100+ lines of code that has multiple responsibilities is certainly a choice. Typically you want your scripts to handle specific responsibilities, that way each script and each object that contains that script has a single responsibility. This helps with efficiency and debugging since you have smaller scripts running and if something breaks you know what broke without everything else falling apart. You employed that partly with your save manager and notification manager etc. But you could certainly pare down your main script. Also considering how much it’s handling I’m curious as to what the structure of your game looks like. Godot likes to have nested objects but based off your code yours doesn’t seem to be conducive to that. Also there appears to be some needless abstractions with your variable storage.

    Anyways I think taking the time to research and learn some basic programming principles and game design patterns would go a long way to help you. Coding can be difficult and seem like a black box when you first get started, and AI can seem like a way to pierce through that, but if you don’t learn why it’s recommending the code it is then you’ll never really understand what your own game is doing and that’s not helpful to you or your players.



  • Interesting!! Yeah that’s exactly what my node structure is. So basically instead of using signals and sending from one Map child to the other, use spawn_object as a child from hexgrid and then just call the spawn object function as needed since the hexgrid script already has a reference to the index and location of each tile. Thanks so much for the advice I’ll give it a shot! I ended up working out the signals issue I was having anyways but it seems like your suggestion is a cleaner solution!


  • I see okay so I understand that the intent is to decouple scenes from each other, however from the tutorials I’ve seen they typically say that to establish the connection you need to run get_node() from the script you are establishing the connection to. So for example if you have:

    *Parent
        **Child 1
        **Child 2
    

    You would emit from Child1, then establish the connection from Child2 using:

    var script = get_node("root/Parent/Child1")
    script.some_signal.connect(some_function)
    

    Is that the correct interpretation? Or am I misunderstanding? Thanks in advance btw I appreciate all the help in understanding this!



  • Thank you! Okay so the tiles are part of a map, and I have a parent node called map with two separate children: hexgrid (where I’m instantiating the scenes) and spawn_objects( where I’m trying to gain access to the index and transform from hexgrid) my intent is to have hexgrid generate the grid and tiles and have spawn_objects instantiate an object within the tile at a certain position within it. Is this perhaps something I should combine into the same script? I typically like to have things modular and keep each component so a single specific task.