Need help getting started

Coming over from Unity and finding myself within a YouTube nightmare. I want to start something from the foundation, but many tutorials seem to start in the middle of a project with player movement. This seems odd and backwards.

Looking for certain information in an intuitive order.

  1. How to create and manage a static database. Creating an Array with Load Data, Save Data, Update Data, Copy Data and Reset Data functions. So I can manage characters, inventory, quests, puzzles, chests, etc.

This data would be used for saving the game, loading the game, loading scene data, saving scene data, managing characters, inventory and quests. This can be expanded later when additional things are added.

  1. How to create and manage an input state machine. Using a controller to switch between Start Menu, Main Menu, Player Movement, Pause Menu, Store Menu, Dialog Menu, Open Chest Menu, etc.

In Unity this was basically =+ and -= to subscribe and unsubscribe. A basic controller class where you subscribe/unsubscribe functions to specific buttons on your gamepad_manager while you enter/exit states.

  1. How to load scene and use the Database for certain things. Like what chests are open/closed, what doors are locked/unlocked, what puzzles are complete/incomplete, what quests are finished/unfinished, etc.

Your basic data that stays persistent throughout the entire game. A must for any newbie to make sense of how things can interact with each-other.

  1. Then player movement and scene interaction can be worked on after the basic foundation is setup. So moving around, opening doors, opening chests, changing scenes, npc dialog, cutscenes, etc. Many tutorials start with this.

Basically, I want to make a basic demo most games should have. You start with the splash screen, change to the start menu and start a new game. Then move your player around, open/close menus and move between scenes. With a few interactable things like npcs, chests and doors. And then your basic save/load save files to bring things together.

These should be basic concepts for most games. Anyone have any guidance on where to get some information? I don’t know the Godot terminology to understand what specifics needed to be searched for.

2 Likes

I think it is actually best to try and start with just a platform and a moving character as this is a great basis for the next things to learn. Afterward I would start looking for specific tutorial to this stuff . I can recommend GDquest as they make great tutorials.
The way I learned Godot was:

  1. Just tested the engine blindly a bit
  2. Watched the mario like platformer video series by GDquest
  3. Made a 2d project
  4. started trying some more complex stuff
1 Like

Otherwise you could also install a C# add-on. However I wouldn’t recommend it as having a language made for the engine is very usefull

1 Like

Refer to the docs instead of youtube tutorials, the docs are there to give information and are searchable, youtube videos are made for views and ad space.

  1. Autoload/Singletons
  2. InputMap
  3. Sounds like complex save file maybe FileAccess and/or Autoload/Singleton
  4. CharacterBody2D/3D for character controller, Area2D/3D for trigger collisions

Here’s a good start, covers many systems.

4 Likes

I had similar problems with Unity when starting out. Many tutorials have you make a character/menu without a foundation. It’s easy to follow, but then becomes a huge problem immediately after.

Great for learning a specific function like movement, but not great when you need to implement them into an actual game. The hard-coded input is counter intuitive for a newbie who needs a foundation first.

I can find many of videos on movement, that’s not the issue…

For a beginner the docs are a bit confusing so I would suggest some yt tutorial.

1 Like

Then I would say you should watch the newest GDquest first 2d game series it’s great for getting started so if you want to learn all together basics that works as it guides you through making an entire game (remember to differ from the tutorials slightly)

2 Likes

FYI making a player movement controller with a platform is mostly good to learn the engines specific layout

1 Like

These videos are 4 years old and about 6 hours in total. Looks like a mario clone without the use of data within scene loading. Looks more like the levels reset when you start them. The score may persist, but that isn’t the same.

BornCG videos are very similar.

There is a new series/video and it is a mario clone but it gives you basic understanding of gdscript and the engine

1 Like

I don’t see any new series.

I see a vampire survival clone from 6 months ago, but the video seems to focus on very specific gameplay. Not interested in FPS or Shooters, more interested in menu based stuff with gamepad, not mouse.

The declutter your project with singletons/autoloads seems relevant. The static variables are definitely what I’m looking for. Just need to find a video that actually uses them to load open/closed chests when loading a scene or something with a similar function.

1 Like

I may be misunderstanding something here but a static database doesn’t have to be stored in a static variable. A static class is a solution that generally solves the same problem as a singleton (which is a design pattern). In Godot singletons are the go-to, I’ve used the engine for years and only used static vars/classes a few times. GDScript didn’t support either until recently.

For your database, just create a singleton e.g. Database. You can implement it however you want, a key-value store is easy. Then, when a level opens it calls a load function in every node that has a certain group (e.g. “persistent”) . The load functions get state with something like var state: Dictionary = Database.get("level3.chest4") and use that (if get returns null just use default values). When exiting you call save on the “persistent” group, which puts the state to Database

Saving the database to disk is handled by the singleton.

I doubt there’s a tutorial which introduces everything in the order you want. If you strictly want to learn in that order you can try asking an LLM to teach it/make examples for you. Claude 3.5 is good with godot.

1 Like

Do you know anyone who knows godot

1 Like

The best way to learn is to make something with someone who knows Godot. Otherwise if you are laser focused on these things just look for tutorials and documentation about them.

1 Like

Static classes were easier in Unity, as singletons seemed like overkill. But here the singletons are simply built into the autoloads? As long as they’re simple, easy to use and organize the code well, they should work fine.

Used them in Unity to keep things simple and organized as possible. As there should only be one controller and database in the game, so static seemed appropriate. The controller basically called functions for the gamepad.

Example : Game Manager

private static BaseState CurrentState = new TestState();

private void Start()
{
	CurrentState.Enter();
}

public static void ChangeState(BaseState NewState)
{
	CurrentState.Exit();
	CurrentState = NewState;
	CurrentState.Enter();	
}

Example : Test State

private static PlayerActionInput PlayerInput = new PlayerActionInput();

public void Enter()
{
    PlayerInput.Gamepad.SouthButton.performed += PressSouthButton;
    PlayerInput.Gamepad.StartButton.performed += PressStartButton;

    PlayerInput.Enable();
}

public void Exit()
{
    PlayerInput.Disable();

    PlayerInput.Gamepad.SouthButton.performed -= PressSouthButton;
    PlayerInput.Gamepad.StartButton.performed -= PressStartButton;
}

private static void PressSouthButton(InputAction.CallbackContext Context)
{
    Debug.Log("You Pressed The South Button!");
}

private static void PressStartButton(InputAction.CallbackContext Context)
{
    StateManager.ChangeState(GameState.StartGame);
    Debug.Log("New Game!");
}

Many videos kept me confused on how to do things because static seemed like something taboo and everything should be object orientated. But eventually decided static use was best for me. They don’t overcomplicate things and do exactly what my controller and database needed.

Obviously, coming over here things will be slightly different, but the same logic should transfer over somewhat. I want to stay organized and keep things in logical places for me to remember and understand. Especially, since I’m primarily an artist.

Never used an AI or Claude 3.5 before. Might give them a try.

Personally, I don’t know anyone who uses Godot. I’ve never been really good with terminology or abbreviations, so searching can be hard sometimes. Once I get a handle on how the scenes can use the database, that should push me in the right direction. It’s mostly static variable management, gamepads and menus.

Yeah, just use autoloads (autoloads and singletons are pretty much synonyms in a Godot context). They’re meant for solving the exact same problem as static classes; when you want to have one of something that’s available for everything.

As for the input state machine, it’s not a popular pattern in Godot. The idiomatic solution is to create separate input actions for every action, even if they have the same trigger events. E.g. a move_south action that’s triggered by gamepad button 2. Then, in your Map scene you would listen for the action: Input.is_action_just_pressed("move_south"). These are not tied to events/signals in godot but booleans accessible everywhere.

If you have another scene where you want to use the same button in a conceptually different way create a new action and add the same input event (gamepad button 2).

And yeah, I avoided AI for Godot for a while too. Still can’t be relied upon perfectly, of course, but it can be very helpful in many situations. Last week it one-shotted a hydraulic erosion compute shader and the CPU setup from my pure CPU C# version. That was a revelation for me :sweat_smile:

1 Like

I haven’t really looked into custom player controls yet. So not sure how Godot allows players to customize gamepads in-game. But Subscribing/Unsubscribing to an input manager might be used here.

The game manager was mainly an example of the game states. The functions would be consistent and only one active during gameplay. The enter/exit would call start/close animations while also enable/disable controls.

I’m mostly scared of separating everything so much, that things becomes a confusing mess to figure out where stuff are linked together. What’s active and inactive? I’m guessing listeners and subscribing are similar things?

It’s very hard to find information on how to manage persistent data.

I want chests/doors inside the scene to save/load to the database to see whether they’re open or closed and persist between scenes. I’m talking about when a scene loads, the objects that spawn check themselves.

How do doors/chests check unique ID exclusive to themselves? So when the level loads, every door/chest looks through the database themselves. How do the doors/chests define themselves as unique?

I’m talking about something simple. Where you have simple database.

class_name Database

var Chest = [["Level1","Chest1",false],["Level1","Chest2",false]]

And then when different scenes loads, there are chests in the scene. This would be attached to every chest inside the scene. How are these chests able to tell they’re unique?

extends Node

var Is_Chest_Open:bool

func _ready():
	# What chest is this?
	# Check chest in database.
	# Set ChestOpen to false/true based on that.
	pass
1 Like

There is a good book called Godot 4 Game Development Projects by Chris Bradfield. He takes you through several projects from beginning to end. Each project illustrates best practices for a particular type of game. I haven’t seen any databases involved in the projects, but he does demonstrate finite state machines. I recommend going through each of the projects to get a feel for best practices with Godot. Also, consider going through the 2D game tutorial in Godot docs and the Brackeys platform YouTube tutorial. I have also asked Chat GPT to explain a few things.

1 Like