This is the testing Godot forums! All forum posts unique to this forum will be deleted! Please use the main forums here for any posts you want to keep. All forum rules still apply.

How to implement a BattleManager?

niokasgaminiokasgami Posts: 3Member

Hi people,
My name is Nio Kasgami and I recently after searching for a game engine who still simple but offers enough powerful programming I found godot and said : why not trying?

Anyways, I do have experience with game dev and my approach was to make a sideScroller rpg game.
and in the battle this a classic sideview system.

as I can seem to figure out some stuff I was unsure how to aproach for create a BattleManager.
For people who unsure what's a battle manager, it's a static class where it's only manage the battle processing (can be Turn based or Active time based etc.)
In simple it's process the flow of the battle.

as I know that in rpg maker the way was really easy you was simply creating a static class and process the static class in the update function. ( I don't use Rpg Maker since my friends I work with doesn't own it and I wanted to try an another engine)

In Godot I am unsure how to approach. Since I am unsure if a Node can affect other Nodes in the same scene?

Would you mind to explain me the aproach I could go?

Thanks for your further answer and if anything is unclear just ask and I will gladly try to explain what I meant better

Nio Kasgami

Answers

  • NeoDNeoD Posts: 179Member
    edited April 2017

    Hi,
    With my poor english I will try to give my ideas.
    A possible organization is to create a base scene for battles who contains the interface and all the things who are shared by every battle. And for each battle event, this scene will be instanced first by a global script, then, the enemies, the background, everything who are specific to some battle (but not all battles) are instanced by your battle manager script and added as childs of your base battle scene.
    You can attach your manager script to every node you want in the base scene battle, the root node of this scene is a good choice. A script can call every node in the scene. The datas of the enemies will be stored into enemies scripts and your root script can access them easily.

  • niokasgaminiokasgami Posts: 3Member

    @NeoD said:
    Hi,
    With my poor english I will try to give my ideas.
    A possible organization is to create a base scene for battles who contains the interface and all the things who are shared by every battle. And for each battle event, this scene will be instanced first by a global script, then, the enemies, the background, everything who are specific to some battle (but not all battles) are instanced by your battle manager script and added as childs of your base battle scene.
    You can attach your manager script to every node you want in the base scene battle, the root node of this scene is a good choice. A script can call every node in the scene. The datas of the enemies will be stored into enemies scripts and your root script can access them easily.

    I see and thanks for your answer!
    so if I understand I have to take the root node to a scene_base for the battle.
    I am still unsure though how you attach a Scene to a another scene yet.

    When you mean global script do you mean a singleton?

    thanks for your further answer

  • NeoDNeoD Posts: 179Member
    edited April 2017

    Indeed the global script is a singleton. In Godot it is called "autoload scripts" because they aren't attached to a scene, it runs continuously whatever the tree state. It can be useful to store variables for the whole game.
    Your base scene will be the root node but you can have several nodes in this scene, it depends of your needs.
    The "scene" naming is a bit confusing for beginners. A scene is simply a set of nodes arranged like a tree, who can be loaded separately, and adding other scenes is like adding a new branch to extends the tree. All the scenes are merged into one scene.
    It is simple and powerful but not easy to explain in few words.
    The tutorial from the official docs explains this better than I do. Maybe you didn't read it yet.

    http://docs.godotengine.org/en/stable/learning/step_by_step/scenes_and_nodes.html

  • niokasgaminiokasgami Posts: 3Member
    edited April 2017

    @NeoD said:
    Indeed the global script is a singleton. In Godot it is called "autoload scripts" because they aren't attached to a scene, they can run everytime.
    Your base scene will be the root node but you can have several nodes in this scene, it depends of your needs.
    The "scene" naming is a bit confusing for beginners. A scene is simply a tree of nodes, and adding other scenes is like adding a new branch to extends the tree. All the scenes are merged into one scene.
    The tutorial from the official docs explains this better than I do. Maybe you have not read it yet.

    http://docs.godotengine.org/en/stable/learning/step_by_step/scenes_and_nodes.html

    yes I was reading it now lol.

    Well the logics of a Scene doesn't change much from the Rpg Maker background!
    It's took me a little time to understand it but I realised that pretty much that a scene for godot wich is a Node and is the same than the scene in RM who is a Container.
    if I explain When you use PIXI.js (the library used for run rpg maker MV games)
    wich the global elements are pretty much Container who runs containers wich you can add it to the root tree. So pretty much Containers are the same than a Node.

    In Rpg maker they seem to use the same context than Godot but in a more simplified format. Godot take it further.
    I guess now that I understood the link between them!

    for the singleton this pretty much a static class or a Module (they are called Manager in RM)

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.