Asking for advice on how to structure 3d puzzle project?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By norlesh

So I have come up with a puzzle concept and read most of the Godot getting started documentation (am now up to the Best Practices section). Currently suffering from severe analysis paralysis on how to structure the project.

The puzzle is a variation on the old Rubik’s magic cube concept and visually what I’m looking to do would best be described as having the colored stickers floating in a cube shape as if the cube itself were invisible and keeping there relative position as twists and turns are animated.

Mainly targeting touch devices, but will probably still hobble together some fashion of mouse interaction.

How do I :

  • Manage an aggregate object with complex motions like this in the scene/node hierarchy (pieces move relative to each other in different directions depending which sides are being twisted)?
  • Create and position the square meshes programmatically? - I have already modeled the individual pieces in Blender in order to do engraved markings but there are 54 of them so positioning at design time would be a pain considering I will probably want to tweak there spacing etc.
  • Should I be starting with a 3D scene or 2D scene and incorporating 3D using Viewport Sprite? - most likely just planning on a static solid background, and have no idea what I want for the user interface.
  • Stick with C# or learn GDScript - does either provide a performance advantage?

Any additional advice and road signs the already initiated could provide me with would be greatly appreciated.

:bust_in_silhouette: Reply From: davidoc

You could arrange a scene with six center nodes and 20 floating nodes, distribute your models into these nodes.
In the code before rotating a center node you need to check what nodes are aligned with it, assign them as children and then make the rotation.
To check if the cube is solved you can add your objects to six groups, and check for each group if every element is pointing to the same direction.

It can be done programmatically but if there is only one group of elements using the editor is easier.

2D/3D: use 3D scene.

C#/GDScript: There are some gains in performance with C#, but in the end use the language you are more comfortable with.

Thanks for your feedback davidoc, could you expand a bit further please on what you mean by ‘floating nodes’ - where does the number 20 come from?

norlesh | 2020-03-22 06:58

If you see a Rubik’s cube it has 26 pieces, six in the centers and other 20 that move (I should have called it moving instead of floating)

davidoc | 2020-03-22 14:31

thanks, that cleared it up.

norlesh | 2020-03-24 08:05