Live data from Hacker News

Peredvizhnikov Engine: Lock-free game engine written in C++20

github.com

91–100 of 183 posts

Re: Peredvizhnikov Engine: Lock-free game engine written in C++20

#91
post #72
post #20

Earlier quoted context omitted.

From the grammar, I would not assume GP is a native english speaker, much less monolingual.

I would love to hear what exactly about the grammar doesn't sound native.

The only thing that seems strange is “such commands as” used to describe a single command. I think a more common way of writing it would be “a command like.” But, I don’t think it is at all definitive, it could just be a native English speaker who went with a slightly odd phrasing.

Re: Peredvizhnikov Engine: Lock-free game engine written in C++20

#92

I have an Actor framework which uses a vanilla std::deque for method pointers, and to add messages to the queue, the locking technique is a Benaphore (the original Futex, which uses an atomic and a locking primitive, with the twist that my locking primitive is a combo of spinlock/mutex based on retry count). Nothing special. Benchmarks show that very rarely does the message push function block, and the chance of an O…

My benchmarks show that the price is acceptable Well, except to people who have a hard requirement that there never be this unpredictable, infrequent longer delay you mention.

Well do we have a benchmark where the price of locking is unacceptable? I think the linked project is a fun theoretical exercise, but I personally don’t accept the assertion that locking is unacceptable without seeing evidence.

Re: Peredvizhnikov Engine: Lock-free game engine written in C++20

#93

Earlier quoted context omitted.

I have nothing against the SDL project. I have everything against the DirectMedia style api of 1997. I get that people are actively developing with it and that roadmap towards 3.0 is getting close but my experience is it’s designed for legacy games, legacy rendering styles, legacy ABI’s. No one is shipping games for Dreamcast or PS2. 2/3rds of the library is dead code when working with Vulkan.

What is a better alternative?

For what? Working with Vulkan? Or a windowing library? Personally I use a mix of glfw and native windowing on mobile, which is surprisingly simple for a gfx context window and this gets me to triangle.

SDL2 is about the same amount of boilerplate code only in SDL_Thing form.

Now, if I was writing a game that needed to be shipped on everything possible and I can’t afford Unity or Unreal, SDL is a viable choice. MonoGame, mine, and others have used it, it’s battle tested.

I just can’t look at SDL code anymore and say “this is the cleanest api” for anything outside of C99.

Re: Peredvizhnikov Engine: Lock-free game engine written in C++20

#94
post #64

It says that it's actor-based, and sending messages to an actor is equivalent to running the actor function under a mutex, and thus reduces parallelism (in other words, you have N threads sending messages, but only 1 thread running the actor code, so it's just as serialized as a mutex), so while it may technically be "fully lock-free", using actors means that there is no parallelization improvement.

Not quite; with mutex based actors an interruption of the actor thread would cause that mutex (and thus that actor code) to remain locked until the original thread resumes. No additional parallelism will allow that actor code to be "restarted" or "resumed" as the mutex owned by the interrupted thread is locked.

This implementation relies heavily on restartable functions in order to allow another parallel thread to pick up and continue the work of an already in progress but otherwise interrupted actor. See page three of the (excellent) design document: https://github.com/eduard-permyakov/peredvizhnikov-engine/bl...

Thus while it might not strictly be "more parallel" (same number of actors), it does seem to be able to make better use of more parallelism for completing the same set of work.

Re: Peredvizhnikov Engine: Lock-free game engine written in C++20

#95

> At the moment, the only supported platform is Linux. Regardless of your feelings on the status quo, there is one thing you must do when building a game engine if you want it to succeed: support Windows .

bullshit, consoles/mobile are bigger markets than PC/Windows PC is just less than 1/3 of the whole picture https://www.data.ai/en/insights/mobile-gaming/2022-gaming-sp...

He's probably referring to the Desktop/laptop market. In which case windows controls like 90%.

Re: Peredvizhnikov Engine: Lock-free game engine written in C++20

#96
post #62

Earlier quoted context omitted.

> Games are never hard realtime Depends how high your standards are! One of the things that makes playing old games on the original hardware really satisfying is how consistent they are.

Those old games could be so consistent because the software and hardware were both so incredibly simple compared to today. Today, a PC game has to work on a large range of hardware that has come out over the past 5+ years. And there are GPU features that are only available on certain cards, like hardware ray tracing and things like DLSS and FSR for upscaling. And the game engines are incredibly more complex today to…

I am sure I have memories of how hard it was to support a range of hardware when I had to write specifically for each piece. When I had to write separately for a Soundblaster card and an Adlib and a Disney SoundSource and a Roland and a Gravis.

And that was just the sound cards. Writing for different hardware became so much easier when OpenGl and DirectX came into being. Suddenly I just had to write to these APIs.

I think I'm disagreeing with you. Supporting multiple hardware configuration way back when was so much harder than doing it today.

Re: Peredvizhnikov Engine: Lock-free game engine written in C++20

#97

Earlier quoted context omitted.

What is a better alternative?

For what? Working with Vulkan? Or a windowing library? Personally I use a mix of glfw and native windowing on mobile, which is surprisingly simple for a gfx context window and this gets me to triangle. SDL2 is about the same amount of boilerplate code only in SDL_Thing form. Now, if I was writing a game that needed to be shipped on everything possible and I can’t afford Unity or Unreal, SDL is a viable choice. MonoGa…

As with most SDL usage, it merely provides a rendering context and an input abstraction.

That's almost nothing, its boilerplate you don't want to write. Which particular lib you grab that boilerplate from, SDL, GLFW, fucking GLEW, whatever, it doesn't matter. SDL is a widely accepted library for doing so and it's fine. If you want more complete input handling you'll be using the platform APIs directly.

Re: Peredvizhnikov Engine: Lock-free game engine written in C++20

#98
post #64

It says that it's actor-based, and sending messages to an actor is equivalent to running the actor function under a mutex, and thus reduces parallelism (in other words, you have N threads sending messages, but only 1 thread running the actor code, so it's just as serialized as a mutex), so while it may technically be "fully lock-free", using actors means that there is no parallelization improvement.

> sending messages to an actor is equivalent to running the actor function under a mutex

Where does it say that? In my understanding actor model means message-passing with asynchronous execution. So quite the contrary, actor model allows N threads executing in parallel given N actors.

Re: Peredvizhnikov Engine: Lock-free game engine written in C++20

#100
post #29

Earlier quoted context omitted.

how do you deal with msvc's `std::deque`? (or maybe you're not using literal std::dequeue)

What is special about msvc's `std::deque`?

It's block size is something stupid like 16 bytes, so it effectively becomes a slower linked list.
Post reply on HN