3
3dgoosee
14h

Hi y'all! I got question, for my engine map format (the map editor will be blender/blockbench) should I just use a GLTF that contains every node and extras for light and custom properties or code a blender plugin that exports a TOML like:
# === MAP ===
name = "E1M1"
description = "At Doom's gate"

# --- Objets ---
[[objects]]
path = "assets/models/tree01.obj"
position = [10.5, 0.0, -3.2]
rotation = [0.0, 90.0, 0.0] # pitch, yaw, roll in degrees
scale = [1.0, 1.0, 1.0]

[[objects]]
path = "assets/models/coin_gold.obj"
position = [5.0, 1.0, 2.5]
rotation = [0.0, 0.0, 0.0]
scale = [1.0, 1.0, 1.0]

[[objects]]
path = "assets/models/rock_large.obj"
position = [-2.3, 0.0, 4.8]
rotation = [0.0, 0.0, 0.0]
scale = [1.0, 1.0, 1.0]

# --- Static lights ---
[[lights]]
type = "point" # "point", "directional", "spot"
position = [0.0, 5.0, 0.0] # spot or point
direction = [0.0, -1.0, 0.0] # spot or directional
color = [1.0, 0.9, 0.7] # RGB, 0.0 to 1.0
intensity = 1.0
radius = 10.0 # influence radius
angle = 45.0 # angle for spot

[[lights]]
type = "directional"
direction = [1.0, -1.0, 0.0]
color = [0.8, 0.8, 1.0]
intensity = 0.6

# --- Spawn points (user-added triggers) ---
[[spawn_points]]
name = "PlayerStart"
position = [0.0, 0.0, 5.0]
rotation = [0.0, 0.0, 0.0]

[[spawn_points]]
name = "EnemySpawn01"
position = [15.0, 0.0, -3.0]
rotation = [0.0, 180.0, 0.0]

Comments
  • 3
    ima rant a lot ok

    in C, i'd want a binary format so i can parse it with structs and minimal logic, rather than parsing text which is way more annoying. inspecting/editing files in a more human-readable form would then be done in some utility program maybe

    also no spatial partition means floating point precision is gonna fuck you in the ass. i'd say break the scene into cells and plot them in a graph or whatever, then arrange the nodes within each cell hierarchically

    yes, you *could* use doubles for coordinates instead to push the problem into the heat death of the universe. but your future self will thank you if you do some form of partition anyway to make annoying-to-code bits like pathfinding and culling less stupid. algorithms that rely on "spatial awareness" so to speak can become a big fucking problem if the data isn't sorted for it

    also 3dgoodes Y U NO QUATERNIONS

    forgot question but still giving answer uuh mystery of universe
  • 1
    Only worked with GLTF because it's supported by ThreeJS :). All other types sucked.
  • 1
  • 4
    @3dgoosee

    You can not reliably store rotations with just three values (I'm assuming you are using Euler angles) because they suffer from gimbal lock, essentially losing one degree of freedom.

    Rotations should be represented by unit quaternions, which don't suffer gimbal locks, and are just as easy to compose.
  • 1
    @CoreFusionX my head kinda hurts lol
  • 2
    @3dgoosee dude its *literally* in the bible

    {And when he had apprehended him, he put him in prison, and delivered him to four QUATERNIONS of soldiers to keep him; intending after Easter to bring him forth to the people.}
  • 2
    @CoreFusionX I think as long as you don't compose multiple euler angle rotations you shouldn't have a problem with gimbal lock. I.e. you can always decompose any rotation into a sane set of euler angles in a given coordinate system

    But you're right, just use quaternions :P They're faster anyways because of less trigonometric operations
  • 1
    Quaternions is freaking black magic! No one has an idea how it works but it works wonders.
Add Comment