Live data from Hacker News

Porting 58k lines of D and C++ to Jai

yet-another-blog.com

251–260 of 264 posts

Re: Porting 58k lines of D and C++ to Jai

#251

Earlier quoted context omitted.

I think I’ve never heard someone romanticize a profession as hard as what you’ve done here. This comment paints a truly distorted and unrealistic picture of game developers. Game developers are not radically different from other developers. You see game developers leave the game industry and become programmers somewhere else, or you see programmers in another industry become programmers in the game industry. It is no…

never in my 30-year career have I witnessed a single non-game developer give a damn about the latency or responsiveness of any application they've written. never in my 30-year career have I witnessed a single game or emulator developer STOP caring about these things. > I think I’ve never heard someone romanticize a profession as hard as what you’ve done here. Go fuck yourself. it isn't me romanticizing, it's you thin…

I work in telecoms, we do care a lot about latency, HFT guys are the same. Some parts use FPGAs instead of normal hardware due to the low latency requirements!

OTOH I remember when one man doubled the framerate of a Nintendo game: apparently not all game developers care so much if they leave so much performance unused..

It isn't a contest you know..

Re: Porting 58k lines of D and C++ to Jai

#252

Earlier quoted context omitted.

I highly doubt so. Rust is extremely complex and restrictive. For actually critical software, there is Ada/SPARK.

Rust is much easier and less complex than C++, which is very widely used.

Maybe, but they are both very complex. Perhaps Rust will eat C++, but not C.

Re: Porting 58k lines of D and C++ to Jai

#253
post #62

Earlier quoted context omitted.

Could you give an examples of a game that used a custom game engines that couldn’t achieve what they wanted in Unreal or Unity? Edit: The only style I would think would be infinite/strange geometry, like Manifold garden (great game!). But, it’s Unity.

> Could you give an examples of a game that used a custom game engines that couldn’t achieve what they wanted in Unreal or Unity? A game that doesn't require a multi-gigabyte download and a top-tier GPU and CPU to render stuff in 2D? ;) There are many reasons people might want to opt out of existing game engines: full control over rendering pipelines, assets and dev. experience might be some of them.

Sure, but what does that mean, to the actual end product? Do you have any examples? I’m not a game dev, so to me, I would naively assume that these wouldn’t be limiting, or laughable, as the original comment suggested.

Re: Porting 58k lines of D and C++ to Jai

#254
post #177

Earlier quoted context omitted.

I've worked on several. You haven't heard of them because none of them shipped due to issues with commercial engines (in particular Unreal Engine 4). They are very difficult to use if the game play semantics are complicated and require lots of interaction with world state or world geometry. If you're making a common FPS, they are great.

> They are very difficult to use if the game play semantics are complicated and require lots of interaction with world state or world geometry. Could you give an example? I’m trying to understand what the limits look like. It appears to be trivial to you, but for someone outside of game design, I can’t imagine what those might be.

We almost never hit technical limits in the renderer, streaming systems, etc. Instead, we found that pushing gameplay systems beyond the prototype stage would require more and more effort, as we'd encounter deep engine bugs, or the tooling simply did not cater to our use case.

We ended up implementing more and more tooling outside the engine, and there comes a point where UE4 became a IO/Rendering system. We'd've been happier if the engine were modular in design from the get-go.

Re: Porting 58k lines of D and C++ to Jai

#255

Earlier quoted context omitted.

D structs are value types, D classes are reference types. This was done to avoid mistakes like having a type that is sometimes used as a value type and sometimes as a reference type.

Would have been much better in my opinion, if D had maintained a C like struct (not a C++ like struct), and a C++ like class. That would have solved the problem you identified, while still allowing for the class to be what it was designed to be. The mistake C++ made was the mistake you identified. But the solution you provided in D is its own mistake.

The C++ class would require the user to constantly remember it has to be passed by reference, not by value. D making the class a reference type means the user cannot mix them up.

It has worked well from the beginning, it is not a mistake.

Re: Porting 58k lines of D and C++ to Jai

#256
post #253

Earlier quoted context omitted.

> Could you give an examples of a game that used a custom game engines that couldn’t achieve what they wanted in Unreal or Unity? A game that doesn't require a multi-gigabyte download and a top-tier GPU and CPU to render stuff in 2D? ;) There are many reasons people might want to opt out of existing game engines: full control over rendering pipelines, assets and dev. experience might be some of them.

Sure, but what does that mean, to the actual end product? Do you have any examples? I’m not a game dev, so to me, I would naively assume that these wouldn’t be limiting, or laughable, as the original comment suggested.

jai's author, Jonathan Blow, always creates a game from scratch. His games: Braid (highest rated XBox Live title when released, "Xbox Live Arcade Game of the Year", https://www.youtube.com/watch?v=YgGeBOC0PX4) and Witness (while not winning significant awards, regularly appears in Best of Decade games lists, https://www.youtube.com/watch?v=URjb3RBIe7c).

Besides that there are multiple games where people use their own engines:

- Possibly among some of the most technically complex ones are Factorio (e.g. https://www.youtube.com/watch?v=zRYQcVb_5W0) and Noita (where every single pixel in the humongous world is simulated https://www.youtube.com/watch?v=prXuyMCgbTc)

- Among the AAA-level crowd there's Decima (Death Stranding https://www.youtube.com/watch?v=tCI396HyhbQ and Horizon Zero Dawn https://www.youtube.com/watch?v=u4-FCsiF5x4) and REDEngine (Witcher 3 https://www.youtube.com/watch?v=YdHc3JZixRY, Cyberpunk 2077 https://www.youtube.com/watch?v=BO8lX3hDU30)

- There are smaller ones like Monkey X (Crypt of the Necrodancer, https://www.youtube.com/watch?v=u_avgU1u6yM)

- There are bigger ones like Clausewitz (basically all of Paradox Interactive's games like Crusader Kings https://www.youtube.com/watch?v=0M9qKVCl6HQ and Stellaris https://www.youtube.com/watch?v=eoAkomMEFQo)

In general, once you know what you're doing it sometimes pays to develop your own engine that is specific to what you're doing. Unity and Unreal are generalist enines that you still to bend to your will to do what you need to do and may have opinionated setups of things that are hard to work around, or maybe are omitted from the engine, or just plain don't allow you to do.

Re: Porting 58k lines of D and C++ to Jai

#257
post #253

Earlier quoted context omitted.

Sure, but what does that mean, to the actual end product? Do you have any examples? I’m not a game dev, so to me, I would naively assume that these wouldn’t be limiting, or laughable, as the original comment suggested.

jai's author, Jonathan Blow, always creates a game from scratch. His games: Braid (highest rated XBox Live title when released, "Xbox Live Arcade Game of the Year", https://www.youtube.com/watch?v=YgGeBOC0PX4 ) and Witness (while not winning significant awards, regularly appears in Best of Decade games lists, https://www.youtube.com/watch?v=URjb3RBIe7c ). Besides that there are multiple games where people use their o…

> just plain don't allow you to do.

This I was my question, and its context in this thread.

From this list, I suspect Noita is the only one that couldn’t be achieved with Unity or Unreal. That’s a good example!

Re: Porting 58k lines of D and C++ to Jai

#258

Earlier quoted context omitted.

.. you forgot to mention also, that (in the context of a D module) D stops treating a user-defined class-type as real type. Additionally, a D class is a reference type. Whereas in C++, a class type is a real type (treated as any built-in type), and is a value type (by default). Nor does D have a concept of C++ friend. So even when it comes to classes, C++ and D are miles apart.

D structs are value types, D classes are reference types. This was done to avoid mistakes like having a type that is sometimes used as a value type and sometimes as a reference type.

..and in the context of a module.. not even used as a type at all.

Re: Porting 58k lines of D and C++ to Jai

#259
post #241

Earlier quoted context omitted.

Very good point, which partially alludes to the hype. It is amazing how much publicity that Jai is getting, despite being in a closed beta. It brings up the argument that if it were open to the public, with more eyes and critics on it, would the "hype train" crash? Odin ( https://odin-lang.org/ ), a near category language, that is influenced by Jai and is open to the public, does not appear to be getting anywhere nea…

One of the things people get excited about is meta-programming, which Jai has much more of than Odin. Jai has a lot more weird stuff than Odin. Idiosyncratic features like if we're iterating through a sequence we can delete items as we go with a dedicated keyword, via a swap and shrink mechanism. Perhaps some of that weird stuff will be smoothed off during beta, or perhaps Jon will double down on it. But it does make…

Pop and swap while iterating is definitely a useful feature. You can also queue removals up and do the pop and swap all together on a cleanup pass (snippet below). That said, most people don't code this way, so yeah, useful for sure.

https://github.com/matias-eduardo/conway/blob/2496472b0018bb...

Re: Porting 58k lines of D and C++ to Jai

#260

Earlier quoted context omitted.

Yes and no. No because Rusts bigger calling card is the borrow checker, which adds a lot of complexity besides other things in Rust, and even leads to justifying unsafe (because some optimized correct data structures are just not possible with it). Second no, because if Rust calling card is that, you can have this alone even in the most hated unsafe C++ if you limit yourself and admit to doing it right. If you quote…

> not even being able to get fully rid of unsafe.. It makes no sense to "get fully rid of unsafe" and this suggests you've gravely misunderstood the problem. Which puts you in good company, Herb Sutter doesn't seem to understand this on his "CppFront" wiki and Bjarne doesn't seem to grasp it in his recent paper about safety either. Rust's unsafe keyword marks code which programmers intend to be safe but the machine c…

No, the point about unsafe is not just only those fancy few low level implementations thst Rust language has no concept for, but proper high level data structures you cannot realize safe?

But even then, what's different limiting to the safe subset of C++ (haha yeah I have to chuckle a bit) and declare the dame for the necessary unsafe parts there? I really dont get it it seems ;)

Post reply on HN