Live data from Hacker News

I learned Vulkan and wrote a small game engine with it

edw.is

241–250 of 268 posts

Re: I learned Vulkan and wrote a small game engine with it

#241
post #208

Earlier quoted context omitted.

>This really doesn't mean much. The second cube (or another shape) isn't going to double the line count. It's like the difference between "Hello World" in Python and "Hello World" in Java. Doesn't matter in the context of a serious software engineering project, but it's a significant barrier for beginners.

I agree with your analogy. It just so happens that Java is commonly taught as a first programming language and most people manage just fine with the class boilerplate even if they don't really understand it yet.

Yet the burden in C# and Java was consider enough of an issue versus languages like Python, JavaScript, Go, that both platforms are reducing the hello world boilerplate.

Re: I learned Vulkan and wrote a small game engine with it

#242
post #97

Earlier quoted context omitted.

I agree with this. In a large organization, if you have risen to a level where you are being relied upon at a regular intervals, it is imperative that you have a well architected solution that you can readily change and this is where you separate your program from spaghetti code to something useful. Sure, its nice to write unmaintainable junk when toying around, but I to have seen too many codebases where people were…

The contrast to this is to put in tickets specifically for refactoring and reorganization, but I've rarely seen that work since they often don't have any sweetener included to encourage e.g. product organization to sign off on the work.

Yeah, it's a shame, I often have to do this type of crap in my off time. However, having a well architected app significantly reduces these types of massive undertakings. Doing it right the first time has its advantages. Then again, weighing it against delivering early and other important aspects has its merit too. It's just a double edged sword unfortunately that you often have to walk in this industry.

Re: I learned Vulkan and wrote a small game engine with it

#243
post #131

Earlier quoted context omitted.

I don't think it's a mistake, I think it's targeted and leveraged poorly. Vulkan is a great idea for a general game engine or backing something like OpenGL. It's a low-level abstraction that should allow you to do something like use OpenGL 8.0 on a GPU that has long lost support for from its manufacturer.

Exactly this. Vulkan, especially Vulkan 1.0, was never really meant directly for graphics developers. It was meant specifically for engine developers that didn't want to have to deal with buggy and inconsistent drivers, e.g. Nvidia vs AMD vs crappy Android phones. The solution Vulkan came up with was "make everything as explicit and user-controlled as possible", and leave "implementing a more user friendly driver" up…

What happened was wgpu, which runs on top of Vulkan and can also run on the web as web gpu

Many Rust programs are written against wgpu rather than Vulkan

Re: I learned Vulkan and wrote a small game engine with it

#244

Earlier quoted context omitted.

there's a common gamedev practice of allocating a big chunk of memory up front, and then using a bump allocator inside of it in most games, there are about 3 "lifetimes": - permanent/startup - per-level - per-frame and they're nested. so, you can use a single stack allocator for all of them. at the end of the frame/level, pop back to where it started there are more complicated patterns, but this one will get you pret…

where to read more? any books? articles?

game engine architecture, by jason gregory

there's a section on memory allocation patterns

i believe casey muratori talks about allocation patterns in the handmade hero video series, too

edit: ryan fleury has a talk: https://www.rfleury.com/p/enter-the-arena-talk

Re: I learned Vulkan and wrote a small game engine with it

#245

Earlier quoted context omitted.

WGPU is an implementation of WebGPU. This is more accurate than saying it uses WebGPU; WebGPU is not software, you can't use it. WGPU goes beyond WebGPU in many ways already, and could also support threads.

> WGPU is an implementation of WebGPU No. wgpu is a safe and portable graphics library for Rust based on the WebGPU API. ... and browsers via WebAssembly on WebGPU and WebGL2. https://wgpu.rs/ > WebGPU is not software, you can't use it It's an API that you can use, like OpenGL, Vulkan, Metal, .... Here you can see the current Browser support: https://caniuse.com/webgpu

And what do you call when you call that API? wgpu in Firefox and Dawn in Chrome.

wgpu is an implementation of webgpu with the raw rust bindings rather than the C-API it also provides called by Firefox.

Unless you want to dig into the implementation details of the various subcrates.

Re: I learned Vulkan and wrote a small game engine with it

#246
post #239

Earlier quoted context omitted.

gameplay matters, but graphics sell. Look no further at the modern state of hardcore reviewers and hyper nitpickers on social media. See how every switch game is criticized for not being 1080p60 on 2017 mobile hardware. People demand that kind of quality. That's a loud minority, but it's not like the biggest games aren't selling more and more every year en large. So non-vocal gamers do seem to be drawn to it.

There’s a very big difference between ultra realistic PBR graphics and running games at 60 FPS at 1080p.

You think the people trashing the switch know any difference? That's my point.

Re: I learned Vulkan and wrote a small game engine with it

#247

Earlier quoted context omitted.

> WGPU is an implementation of WebGPU No. wgpu is a safe and portable graphics library for Rust based on the WebGPU API. ... and browsers via WebAssembly on WebGPU and WebGL2. https://wgpu.rs/ > WebGPU is not software, you can't use it It's an API that you can use, like OpenGL, Vulkan, Metal, .... Here you can see the current Browser support: https://caniuse.com/webgpu

And what do you call when you call that API? wgpu in Firefox and Dawn in Chrome. wgpu is an implementation of webgpu with the raw rust bindings rather than the C-API it also provides called by Firefox. Unless you want to dig into the implementation details of the various subcrates.

> wgpu in Firefox

Ah, sorry, I didn't know that, thanks. On Chrome it uses either WebGL2 or WebGPU.

    When running in a web browser (by compilation to WebAssembly) without the "webgl" feature enabled, wgpu relies on the browser's own WebGPU implementation. 
https://github.com/gfx-rs/wgpu?tab=readme-ov-file#tracking-t...

Re: I learned Vulkan and wrote a small game engine with it

#248
post #178

Earlier quoted context omitted.

If you want OpenGL use ANGLE https://github.com/google/angle several phones now ship ANGLE as their only OpenGL support on top of their Vulkan drivers. If you want a modern-ish API that's relatively easy and portable use WebGPU via wgpu (rust) or dawn (c++).

ANGLE is such a pain to build, I've never managed to do it.

I usually copy the built library from a Chrome/Chromium installation, saves me from building the library myself.

Re: I learned Vulkan and wrote a small game engine with it

#249
post #93

This minimalism is very effective. I took the opposite approach, and it has cause great pain. I've been writing a metaverse client in Rust. Right now, it's running on another screen, showing an avatar riding a tram through a large steampunk city. I let that run for 12 hours before shipping a new pre-release. This uses Vulkan, but it has WGPU and Rend3 on top. Rend3 offers a very clean API - you create meshes, 2d text…

> Both Vulkan and Metal support that. But, of course, Apple does it differently. Metal is older than Vulkan. So really, Vulkan does it differently.

Vulkan is a continuation of AMD's Mantle which is then older than Metal.

Re: I learned Vulkan and wrote a small game engine with it

#250
post #67

Earlier quoted context omitted.

Yes, over engineering solutions is a constant thorn in my side. The end result is you get a lot of additional complexity for basically no benefit. In my experience, if new requirements do come down the pipeline at some later time, the generic solution you previously built will be completely inadequate and will need to be redone anyway. Solve the problem in front of you, not some unknown future problem.

On the other hand, often a "quick and dirty" solution unexpectedly becomes the foundation of a lot of other stuff, which can be a persistent pain in the future, while the cost of rewriting the whole thing increases the more other stuff depends on it. There are two poles: On the one side is making everything an unmaintainable pile of quick hacks, on the other side is over engineering everything. You want to be somewhe…

> There are two poles

I'm not sure I agree. I think you can write a simple-but-not-hacky implementation that does only what is necessary, and is also easy to maintain and extend later.

Of course, you never really achieve that ideal, but you can keep getting closer to it as you gain more experience.

Post reply on HN