▲ 33 r/odinlang+1 crossposts

Direct3D 12 Renderer in Odin - Devlog #1

I'm making a 3D Renderer in Odin! I hope this is interesting to someone.

lucypero.com
u/lucypero — 22 hours ago

Can't install PS5 Disc

It gets stuck at 10.30GB when copying the data disc. then it says "Can't install". Error ce-100005-6

​

I already tried restarting it. And clearing the ps5's cache.

​

Please help.

reddit.com
u/lucypero — 24 days ago
▲ 3 r/Nioh

Why is the first Crucible boss SO HARD?

I had to play him for like 2 hours to beat him. It was intense. Why is the second boss in the game so hard? haha.

I'm an action game veteran btw. I beat nioh 1, sekiro, all the fromsoft games, lies of p. Maybe I'm just bad?

reddit.com
u/lucypero — 1 month ago
▲ 0 r/Nioh

Floaty controls in Nioh 3

Is it me or the controls in Nioh 3 are not very responsive? For movement mostly.

I think more snappy arcadey controls would fit the game more.

I beat Nioh 1 recently and the controls were much tighter.

Also I'm playing Nioh 3 on the PS5 so it might be that.

reddit.com
u/lucypero — 1 month ago

I got Shang Kun Hybrid ZC blade. It's too fast. How do I control it?

I feel like I made a mistake. Judging by what my coaches said and by my current experience with this blade.

They say this blade is to smash the ball forward. When you try to loop the ball upwards, it becomes a weak shot. When you slam the ball, it goes very fast. This might be too advanced a blade for me. I started playing seriously about a year ago.

I have Fastarc G1 on FH. Hammond Z2 on BH (too fast, i don't like it).

They recommended trying bluefire M2 to control this blade. What do you think?

reddit.com
u/lucypero — 2 months ago
▲ 0 r/Nioh

I'm playing the epic games version. It keeps crashing when I complete a mission, or when I start fighting certain bosses.

I tried running it at low resolution and true fullscreen. That didn't stop the crashes.

reddit.com
u/lucypero — 2 months ago
▲ 3 r/Nioh

​

This fight is impossible. though i just beat the base game so I'm undergeared.

it's 2 dudes with insane amount of ki and hp. as soon as you kill one, another dude shows up. It's made to tilt you. what are you supposed to do?

I gave up on it for now. I'll do more base game stuff to be ready for the DLC ...

reddit.com
u/lucypero — 2 months ago
▲ 7 r/Nioh

about the first dlc boss. snow level. he's a guy merged with some kind of worm.

what the hell? i get one shot by everything. he's so fast too. i have 5 piece warrior of the west green set. max familiarity.

does armor even matter in this game?

reddit.com
u/lucypero — 2 months ago

Link to source

Link to original article

I made a very minimalist Odin formatter for myself. I have tried odinfmt in the past. I have nothing against it, but I prefer something that leaves the code more as it is. I like it when the formatter lets me add newlines to anything, and doesn't ever introduce newlines. That's a big one for me.

So, lucyfmt's killer features are:

  • It leaves your code alone! Plus, it does the following:
  • Indents lines with 1 tab per scope level, except for when blocks.
  • Adds one indent level to parameters if they were broken up into multiple lines.
  • There's no way to configure this formatter. This is a great feature, actually. I'll tell you why:
    • Keeps it simple.
    • There's no way for you to screw it up.
    • Every file formatted with lucyfmt is formatted exactly the same.

Showcase

// Adds indentation, **only** if you break up a function call in multiple lines.
ct.window = sdl.CreateWindow(
	"lucydx12",
	sdl.WINDOWPOS_UNDEFINED,
	sdl.WINDOWPOS_UNDEFINED,
	WINDOW_WIDTH,
	WINDOW_HEIGHT,
	{.ALLOW_HIGHDPI, .SHOWN, .RESIZABLE},
)

// This will _not_ get broken up into multiple lines! lucyfmt respects the programmer.
ct.window = sdl.CreateWindow("lucydx12", sdl.WINDOWPOS_UNDEFINED, sdl.WINDOWPOS_UNDEFINED, WINDOW_WIDTH, WINDOW_HEIGHT, {.ALLOW_HIGHDPI, .SHOWN, .RESIZABLE})

// Same to struct initializers
to_render_target_barrier := dx.RESOURCE_BARRIER {
	Type = .TRANSITION,
	Flags = {},
	Transition = {
		pResource = g_dx_context.targets[g_dx_context.frame_index],
		StateBefore = dx.RESOURCE_STATE_PRESENT,
		StateAfter = {.RENDER_TARGET},
		Subresource = dx.RESOURCE_BARRIER_ALL_SUBRESOURCES,
	},
}

// `case` lines don't get indented.
for &s in g_scenes {
	st := scene_status_load(&s.status)
	#partial switch st {
	case .Ready:
		scene_status_store(&s.status, .QueuedForDeletion)
	case .Free:
		if !found_free {
			scene_schedule_load(&s, new_scene)
		}
		found_free = true
	}
}

// It doesn't over-indent if you open more than 1 bracket or paren in the same line.
scene_walk(scene, nil, proc(node: Node, scene: Scene, data: rawptr) {
	ct := &g_dx_context

	if node.mesh == -1 {
		return
	}

	mesh_to_render := scene.meshes[node.mesh]

	for prim in mesh_to_render.primitives {
		dc := DrawConstants {
			mesh_index = u32(g_mesh_drawn_count),
			material_index = u32(prim.material_index),
		}
		ct.cmdlist->SetGraphicsRoot32BitConstants(0, 2, &dc, 0)
		ct.cmdlist->DrawIndexedInstanced(prim.index_count, 1, prim.index_offset, 0, 0)
	}
})

LucyDX12 is formatted with lucyfmt. Why did you think the code looks so pretty?

Feedback

I want other people to use this. I'm sure it's not only me that I want something like this. So please, let me know if you are interested in using this, but it's not exactly to your liking. Maybe we can make it work.

u/lucypero — 2 months ago