Godot 3.0 Power Ups

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Icarus
:warning: Old Version Published before Godot 3 was released.

I am currently creating my dream game. It includes a number of randomly discovered power ups or abilities (think The Binding of Isaac). My question is what is the best method for creating all these abilities? Would it be best to create a different scene for each one, or would incorporating them all into the Player scene and script be best?

Thanks.

:bust_in_silhouette: Reply From: rustyStriker

Its really up to you and what you prefer, if you think placing everything on the player right away is simpler than making a new scene for it than do that, if not that do the other thing… you are developing your game and you should use ways most comfortable to you.

Thanks for the reply. I prefer the concept of including all the power ups in the Player.gd.

Icarus | 2017-12-05 19:37

then do so, whatever works best for you and for your understandings and manipulations(aka if you want to add/change something) because eventually you are working on that game and not anyone else

rustyStriker | 2017-12-05 20:43

:bust_in_silhouette: Reply From: MrMonk

I prefer to keep things separated. In the beginning they would be simple enough to not care if it’s a separate scene or is in the player scene… After you add and add feature, it will get messy, difficult to change or know where is what… So create different scenes for everything. If at some point you want them part of the player, you can merge them by discarding the instance …

So, for example a 'Shield boost you’d create it as a separate scene with its accompanying sprite etc?

Icarus | 2017-12-06 08:46

I would and I did :slight_smile: Also I write at the top at the script, what are the important functions and what they do, something like : set_score() - changes the score in menu xxx.
Sure, there must be tons of ways to keep things simple and organized, but this is what works for me… I guess if the game I’m working on will get even more complex I would need to find better ways of keeping organized.

MrMonk | 2017-12-06 09:11

Thanks for your feedback. I still have a lot of fundamental elements to understand before I can worry about this tbh. I’m currently working out how the hell to complete a melee attack collision.

Icarus | 2017-12-06 09:22

:bust_in_silhouette: Reply From: Michael Paul

When deciding on whether or not a concept is a new scene or not, decide if it NEEDS to be by asking yourself the following questions…

Will there be multiple occurrences of this entity?
Will the item vary in fundamental ways?
Will it exist on its own, or is it depend on a specific support item?
Will/can it operate independently?

For example, if you have a car scene and it has individual components…

Steering wheel: Probably won’t vary from car to car, needs car to exist, and the car only needs one of them. This can and probably should be part of the car scene.

Wheels: Have multiple occurrences, may vary in size and composition, and may exist on their own in a pit to be replaced when worn, or fly off a car in accident. These should be a separate scene(s) and instantiated as needed.

The analogy may not be the best, but answering those questions and similar ones will help you determine a logical structure to your game (or any program), and you will thank yourself later because it has structure with purpose.

Great feedback. Very much appreciated. From that I would summise that my power ups, as they will be unique to the Player and static once ‘discovered’ would be best contained as a child of the Player node.

Maybe as a separate script and extending from the Player.gd for readability?

Icarus | 2017-12-06 14:49

Ultimately up to you to decide. The example questions that I posed above aren’t perfect guidelines. There will always be grey areas and overlap. If your power-ups are an entity that have specific characteristics and might be acquired by multiple players in an MMO for example, definitely use a separate instance. If it is simply a state change to an individual player scene that may change his stats temporarily and have maybe a little animation glow, you don’t really need a separate scene. Another thing to think about that I inadvertently omitted is overhead. If something will require a lot of memory just to sit in a scene hidden most of the time, and only be needed occasionally, your performance might benefit from a loadable/releasable scene.

BTW, readability looks like it’s getting some love in the beta of 3.0 with collapsible function blocks :slight_smile:

Edit: I misread your last comment slightly and after re-reading, I agree. It sounds more like a state change of the player and would be best suited as a child node of the player scene imo.

Michael Paul | 2017-12-06 15:06