Godot Version
v4.3.stable.official
Question
Hi, all.
A friend and I are using Godot to build a simple-ish 2D point-and-click adventure game, and we would like some advice from people more experienced in the engine. We already have the concept in mind and even have written some placeholder code; we just would like to make sure we are on the right path to building foundations.
Some of our constraints are:
- The main view will be a first-person 2D scene, pannable with the cursor, with several UI icons (inventory, settings, etc.) overlayed.
- Currently we have instanced room scenes replacing a dummy blank
Node2D
on the main scene through code.
- The âroomsâ will each be different scenes.
- In some cases, the rooms will overlay other rooms. For example: when a button panel is clicked on in an elevator room, a zoomed-in version of the panel will appear against the room (with the buttons now disabled.)
- Each room may have clickable âobjectsâ in them, which will perform a preset function when activated (trigger a thought, set a flag, etc.) There will also be handling for when an inventory item is used on an object.
- So far, these are
Node2D
s with an Area2D
for basic click detection.
- The preset functions are currently in an autoload script, though should they be?
- Some functions would need to interact with the main scene from this, for example: room switching.
- There will also be a global âflagâ dictionary, for handling the inventory and âunlocksâ.
- Also an autoload currently, for example:
Flags.set_active("finished_m1_minigame")
.
- The room/object asset files should also be distanced from the main engine files.
Hereâs an example of what would be in a room scene.
# enter if the door's unlocked or after mission 1
func _clicked_secret_room_entrance():
if SystemValues.current_mission > 1 or Flags.get_active("unlocked_door"):
Events.trigger_room("secret_room")
So, how would you add to/improve this? I want to make sure we are doing good practice.
My advice would be to first build a prototype and donât worry too much about planning out all the âgood practiceâ and âbest way to do itâ stuff. Just start building it and see how it goes. (Obvious stuff like modularity etc does not take much planning). Get an albeit dirty but working prototype. Then you can start playing with the functionality. As you are building things will come up that you did not expect, what if we do this, what if we made this happen etc. This is all normal and good stuff, you are exploring your own game and seeing what works and what does not. What plays well, what bits are just frustrating and can be dropped etc.
Once you have a working prototype with all the elements you need (probably with 1st draft artwork), that is fun, that you are now going to build âproperlyâ, you can take all your components and functionality and plan out your production build for your target audience and target hardware. Everything you learned in your prototype build will help to inform you about pain points you need to rework, where more flexibility is needed and what needs to be more robust.
The production build is fun but for different reasons than the creative prototype and testing phase. If you try to build a release version from scratch, your game will be worse for it. It needs the exploration and testing phases where you are continuously changing and experimenting with different aspects of your core idea.
Good luck with your game, however it turns out you will learn tons and it will be a great journey!
PS During prototyping expect to write, rewrite and restructure your code constantly.
2 Likes
as @pauldrewett said there many things may change during developing your project. You mentioned Node2D
s with an Area2D
and there already a place for experiment - you may achieve same result with
if Rect2.has_point(Vector2(mouse_pos.x, mouse_pos.y))
or use Button class with Flat style enabled and signal pressed
connected to your _clicked_secret_room_entrance()
for inventory its better to check what Control
nodes can, especially containers.
2 Likes
You might want to have a class called interactive and then have exported variables for some of the most common things like if informational == true show reply. If inventory is fork and spoon: show animation, so you can reuse the same script. I did something like that but canât remember exactly how I did it. Or even for when the mouse hovers it, if collider is classname: change cursor to something, so you can have different cursors. You can just do a search on youtube for godot interactive mouseover or something.
1 Like