Skip to content

Import a Godot Packed Scene into ECS #49

Closed

Description

@fire

Context and Problem Statement

Not able to use the standard Godot import tooling to import entities. We want to import the packed scene into entity and entity3d format.

Decision Drivers

  • We lack content in the ECS ecosystem
  • It's mindless to convert
  • Converting should be not noticeably slow
  • Blocks ECS skeletons
  • Blocks ECS physics engine

Considered Options

  • Convert manually
  • Write a plugin in C++
  • Write a plugin in gdscript

Decision Outcome

Chosen option "Write a plugin in C++" because it was the fastest and does not require a separate addon.

Positive Consequences

  • Fastest
  • Can be in the single Godot executable

Negative Consequences

  • Hard to bug fix

Pros and Cons of the Options

Option convert manually

We go over the packed scene and convert them to a packed scene using Godex components. Godex components are added based on the type and the properties.

  • Node3D (base class and only the base class)
    • Hierarchy of nodes, and the transform.
  • MeshInstance3D (without skeleton)
    • Hierarchy of nodes, the mesh and the transform.
  • MeshInstance3D (with skeleton)
    • passthrough
  • BoneAttachment3D
    • passthrough
  • Skeleton3D
    • passthrough
  • MultiMeshInstance3D
    • passthrough
  • CSGShape3D
    • passthrough
  • GridMap
    • passthrough
  • Camera3D
    • passthrough
  • Light3D
    • passthrough
  • AnimationPlayer
    • passthrough

For Node2D we passthrough.

Everything else stays the same until we have a conversion for it.

  • Good, Know exactly what we want
  • Bad, because there are ways to do the conversion wrong by human error

Option GDScript

Automate manual option in GDscript.

  • Good, it's easy to iterate
  • Bad, because it's not embedded

Option C++

Automate manual option in C++.

In scene importer add a checkbox for conversion and it is enabled by default.

  • Good, it's embedded
  • Good, it's fast
  • Bad, because of C++ programming friction

Links

Activity

  1. AndreaCatania commented on Feb 12, 2021

    @AndreaCatania
    Member

    The Entities that need to stay in the hierarchy, need a Child component. So don't forget to add it, when you have nested Entities.

  2. AndreaCatania commented on Jun 8, 2021

    @AndreaCatania
    Member

    I made a scene converter here https://gist.github.com/AndreaCatania/afd01671e35e9d004d1d7a498fc0e2a3, I will improve it overtime. I've also a wiki here: https://github.com/GodotECS/godex/wiki/Godex-importer

  3. AndreaCatania commented on Jul 21, 2021

    @AndreaCatania
    Member

    Moving the proposal to discussions to keep the issue just of technical stuff to fix.

  4. locked and limited conversation to collaborators on Jul 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions