4chan-datasets / g /92815579.txt
lesserfield's picture
Sun Apr 16 16:54:23 UTC 2023
8837177
raw
history blame
25.8 kB
-----
--- 92815579
Does he make some good points on Rust? Rust Sisters, how do we respond to this chud?
https://www.youtube.com/watch?v=4t1K66dMhWk [Embed]
--- 92815729
>>92815579 (OP)
I've been trying Rust (coming from over a decade of Go) and I get both the left wing love and the right wing hate for it.
Rust tries to copy Go in being minimalist but miserably fails in that regard. While working with Rust could be a lot of fun the problem for me the .and .andthen .asderef .asmut .then .unwrapor .unwrap is just annoying. I get why it's there and it does make sense. But sometimes less is just more see Go.
Apart the overblown throwing in your face Rust is a wonderful and fun language though. I'll be honest though if Go was faster I'd be using Go any day over Rust. But Rust is no contenders the second best language (and the best if you need something fast/bare metal).
--- 92816887
>>92815729
Oh and I am in fact trans btw, if that matters to anyone
--- 92817027
>>92816887
we know
--- 92817291
>>92815579 (OP)
He is right. If you want to write code that performs well then rust ends up looking like c/c++. Unfortunately no language has been able to properly abstract modern hardware. All languages are designed for how hardware worked more than 20 years ago.
--- 92817417
>>92817027
Great, thanks! I just ordered a new dilator because my previous glass dilator broke while inside my vagina. A little glass cut should help me get on the bleeding edge with Rust teehee ;)
--- 92817456
>>92815579 (OP)
Im not going to watch an hour long video on this you fucking NIGGER FAG
--- 92818052
>>92817291
>He is right. If you want to write code that performs well then rust ends up looking like c/c++
another brutal example of this: https://zackoverflow.dev/writing/unsafe-rust-vs-zig/
--- 92818626
>>92815729
>Rust tries to copy Go
You might be the first person to say this, ever
--- 92819866
>>92818052
Unsafe Rust has more friction than most unsafe languages (arguably at least partially by design) but this guy just doesn't know what he's doing. There is a vast design space between 100% safe Rust and turning everything into a raw pointer.
--- 92821576
>>92817291
It's also kind of a catch-22: hardware is heavily designed and optimized so as to maximize the speed of C programs, which means new languages have to be C-like correctly use the hardware. While the internals are all kinds of different, that's just hacks upon hacks to speed things up while maintaining the C abstract machine compat, and most is not actually accessible (for example you can help branch prediction with likelihood annotations, but you can't tell the CPU which ALU to schedule the instruction on, or how to schedule ILP, etc.
--- 92821640
Honestly it fucking doesn't matter. People have written games in every fucking language in the world. Most people use C# these days in Unity.
Rust or C++ would probably be decent choices for a game engine - probably Rust would be better just because of the quality of life improvements it does to the ecosystem (immutable first, proper dependency management system, trait system, etc).
--- 92821836
>>92821640
>Most people use C# these days in Unity.
Disingenuous, the engine is written in C++ for all heavy lifting so C# is more like the scripting language.
>People have written games in every fucking language in the world.
However, that's true. But that wouldn't mean anything in a vacuum. First you have to rightfully mention that they're games people actually played, on real consoles, that were actually good, for example jak & daxter in a custom lisp or worms? in forth or akalabeth in BASIC. Second, you have to admit this is not entirely true, because those games often dropped down to assembly or even machine code to achieve this (in BASIC especially it was common to write some machine code and goto it for tight loops).
Also, nobody's written a game in idris, which is a better comparison to rust than C or Lisp could be.
--- 92823704
>>92819866
Even if he doesnt' know what he's doing, why shoudl the language get in his way?
--- 92824146
>>92817291
>He is right. If you want to write code that performs well then rust ends up looking like c/c++.
Most code is game code and you can write it in C# just fine. You really should too.
--- 92825923
>>92815729
Try Nim
--- 92826060
>>92815579 (OP)
TLDW version of his video is that the implementing ECS in Rust means bypassing Rust's ownership/lifetime system with the implication that people who recommend this inadvertently acknowledge Rust's ownership system sucks, which is the main point of Rust haters.
He also says ECS isn't the holy grail of game architecture like second year CS students claim it to be. Incidentally these people have never made a game more complex than pong, if they made one at all.
In my experience Rust+ECS is a prime way of farming Medium likes/Orange site updoots/Github stars, with the writers of these systems having no interest or ability to create functioning games or software, and just are farming internet clout presumably for career reasons.
--- 92826112
>>92826060
>with the implication that people who recommend this inadvertently acknowledge Rust's ownership system sucks
wrong
--- 92826131
>>92815579 (OP)
>>92826060
I also forgot to mention, that Rust's design of borrow checking means that it's borderline impossible to get regular game code to compile because it touches everything from audio, networking, physics and a billion other things.
This inflexibility limits Rust's adoption as a games language which is a major issue considering the large pool of motivated smart C++ programmers still working in games.
--- 92826142
>>92826112
Do you have an actual argument, or are you just having finger Tourettes?
--- 92826188
>>92826142
I don't have an actual argument, because I didn't watch the video.
But I know that Blow has a huge ego and has never actually used Rust.
So whatever he has to say about Rust is most likely wrong.
--- 92826194
>>92826060
wait someone is portraying ECS as a solution to memory management and reference consistency? I thought it was a solution to polymorphism
--- 92826244
>>92826188
>Blow has a huge ego and has never actually used Rust.
that doesn't mean the point he made is wrong, because it's correct, and you'd know that if you watched the video you idiot
--- 92826270
>>92826244
>the point he made is wrong
correct
>because it's correct
wrong
>you'd know that if you watched the video
no thanks
>you idiot
maybe
--- 92826374
>>92826188
he doesn't talk much about Rust
the speaker presents how they used Rust for ECS, praising borrow checker in process
Blow points out that what she presented is actually a bypass of the borrow checker by using custom references without llfetime analysis. And proceeds to explain how it is not a solution to lifetime management in games. Also presents few other solutions and illustrates their equality (introducing indirection to have a point where you can check presence when accessing reference).
Quite agnostic to Rust. Most programming issues are agnostic to any language anyway.
--- 92826375
>>92826194
ECS can solve a lot of things, but fundamentally why it's NECESSARY in Rust is because you can't do caveman-style
update ()
{
this.rigidbody.setVelocity(speed)
}
in Rust since that would imply having a persistent mutable reference to the physics system, which is a big no in Rust, you'd have to re-borrow a reference every frame, while somehow STATICALLY proving to the compiler that nobody else is accessing the rigidbody (like the physics system is not running etc.).
This is extremely hard to express in normal code, so you can do some weird contortions like wrapping the code in unsafe, putting unwrap()s everywhere, or using the ECS pattern which supposedly handles this for you.
--- 92826393
When it comes to games I would just go for the bloatest stack that allowed me to get shit done without hampering performance for the final user... too much. Otherwise I'm not aiming at a game, just intellectual wankery. The combination of both is never a good thing for a small team or a lone dev. It's stuff for big boys like Mike Acton and company.
--- 92826397
>>92826375
ECS doesn't make anything in Rust easier, a physics system will never be properly expressable to the borrow checker
--- 92826425
>>92826375
isn't RefCell or something like that used for such purpose?
--- 92826542
>>92826397
I was just using the physics system as an example to make a point. Every game has a bunch of systems like audio, graphics, physics etc.
A simple main loop can look like this:
gameloop()
{
doPhysics()
doAudio()
...
updateObjects()
}
where updateObjects() touches all the physics, audio etc system. To make this work in Rust properly you have to PROVE to the compiler that when updateObjects() is running, the doPhysics method is no longer using the physics objects etc.
>>92826425
RefCell can work, but it's essentially a workaround that bypasses rust static lifetimes, and does the borrow checking at runtime.
--- 92826551
>>92826425
Spamming RefCell is an antipattern, makes you remind that you're probably writing C style code and should fix your pattern.
--- 92826608
>>92826060
I don't agree with this.
Rust's ownership is a way of dealing with the mess you make when you have a lot of heap-allocated objects whose lifetimes can end at unpredictable times, so that you end up referencing freed memory. If you DON'T lay out everything as a heap allocated object with its own lifetime, then you don't need any help from the borrow checker, and you don't use it. No big deal, and it doesn't mean that the borrow checker stops being useful everywhere else.
ECS is one of the ways that you can lay out things without having to think about heap lifetimes explicitly, but it's not the only one. If you just use fixed size arrays or arenas, you're in the same situation.
>>92826375
>in Rust since that would imply having a persistent mutable reference to the physics system, which is a big no in Rust
You can just have all physics data in a State struct that you instantiate before starting the frame loop, and it just works.
--- 92826609
>>92826542
>o make this work in Rust properly you have to PROVE to the compiler that when updateObjects() is running, the doPhysics method is no longer using the physics objects etc.
Yeah and ECS doesnt help you with that, you're still iterating over shit and updating it
--- 92826812
>>92826608
>Rust's ownership is a way of dealing with .. objects whose lifetimes can end at unpredictable times
No, Rust ownership system is for dealing with objects with PREDICTABLE lifetimes. For unpredictable lifetimes, you have to do hacky stuff like RefCell or Rc, which has all the problems of legacy languages like C/C++, but you get a bit nicer crash messages at runtime.
And with ECS you still have to think about lifetimes. If you have an gameobject A, that is referencing gameObject B, in C++ if you use a pointer, if B is deleted, then the game crashes. In Rust, you have to do stuff like weak references, or you cannot delete them at all.
In an ECS, the reference to B can be an int index to the entities array. In this case if B is deleted, then the index will refer to an invalid entity. The problem is still not solved in either paradigm, you have to do something extra on top of it.
>You can just have all physics data in a State struct that you instantiate before starting the frame loop, and it just works
Do you mean this?:
gameloop()
{
let mut state:State = ...
doPhysics(&mut state)
...
updateObjects(&mut state)
}
I think this is extremely ugly, and basically only justified for working around the borrow checker. Or do you have some other suggestion? If so, please write some pseudocode.
--- 92826822
>>92826609
Correct. But the ECS can have some internal mechanism for lifetime handling, which might solve it, but even then, the solution is not Rust lifetimes, its something else.
--- 92826962
is there a research paper telling us that pointer is a threat to security issues?
--- 92827267
>>92826142
not him, but ecs is just a way to store data. what in ecs requires systems to share ownership? in fact, rust ownership model seems perfect for ecs, system paralelism comes for free
--- 92827515
>>92815729
>.and .andthen .asderef .asmut .then .unwrapor .unwrap
Rust has fmap-likes? Does it have typeclasses and a functor hierarchy?
--- 92827652
>>92826812
>then the index will refer to an invalid entity.
Yeah, Rust-ECS still seems to pay the price of index lookup on the hashmap etc. which is pretty ugly and costly.
--- 92828521
>>92823704
because he's a human who makes mistakes, algorithms don't, they can only be correct or wrong; and fixing mistakes is more difficult, time-consuming and annoying than not making mistakes
--- 92828563
>>92828521
>fixing mistakes is more difficult, time-consuming and annoying than not making mistakes
Having to constantly pay a price for a mistake you rarely make and is easy to fix isn't worth the tradeoff
--- 92828573
>>92826822
>the ECS can have some internal mechanism for lifetime handling
So can any other system, ECS says absolutely nothing about lifetimes
--- 92828609
>>92826060
>implementing ECS in Rust means bypassing Rust's ownership/lifetime system
No it doesn't. In fact, ECS systems lend itself beautifully to being parallelized in rust since a system's signature represents what data in needs exclusive access for
>>92826375
>would imply having a persistent mutable reference to the physics system
No it wouldn't, it would imply having ownership/mutable borrow of physics data of a said object inside of an object, or inside just a physcics update function. Which is fine because object-specific physics can't run concurrently with the physics solver, which has to borrow all physics body data anyway
--- 92828779
>>92828563
>mistake you rarely make and is easy to fix
contradicts
>he doesnt' know what he's doing
>He's too stupid to know that he's wrong, why he's wrong, and how to fix it, but why are you stopping him from fucking himself over? Muh freedumz!
>Uh yea buddy, I only make minor mistakes, and rarely, and they're trivial to fix and actually I'm a superstar I don't even make mistakes at all. There's too much friction!
The duality of bitching about rust. Funny thing is, it's the exact same case
--- 92829153
>>92828609
You have 0 clue what an ECS is or does lmao
--- 92829172
>>92827515
Traits are like crippled typeclasses, yes.
--- 92829242
>>92826060
Trannies are fucking vile. This dude just sits there for an while called some dude a "she". This world is fucking insane.
--- 92829258
>>92826812
i don't think it needs to be like that, i'd approach it in a nested way
i find it cleaner and it doesn't conflict with borrowck since it only borrows the parts it needs at each point
--- 92829285
>>92829153
sure buddy, and yet I somehow used multiple implementations of it, including bevy which is in rust and uses this exact mechanic of distinguishing between & and &mut to schedule systems
argument doko
--- 92829300
>>92829285
Oof, great self-own right here, once again demonstrating total ignorance about anything related to rust, programming, or ECS.
--- 92829312
>>92826812
>Or do you have some other suggestion? If so, please write some pseudocode.
fn main() {
let mut state = State{
entities: [5., 5., 5., 5. ],
box_entity: Box::new(9.0),
};
loop {
do_physics(&mut state);
do_something_else(&mut state);
println!("{:?}", state);
}
}
#[derive(Debug)]
struct State {
entities: [f32; 4],
box_entity: Box<f32>,
}
fn do_physics(state: &mut State) {
state.entities[3] += 10.0;
}
fn do_something_else(state: &mut State) {
state.entities[2] += 17.0;
*state.box_entity += 9.0;
}
You just allocate the memory you need before the loop, and then you can access it mutably every time you want, because it will always be valid memory.
You can also implement the two functions as methods of State if you like it better, and you can split State into as many different structs as you want.
Now if you need to spawn/destroy entities dynamically, all you need is some logic to make them fit inside the array you already allocated. This can be as complex as building an ECS system that uses the array as its contiguous storage, or as simple as keeping track of which array i's are empty or full.
Of course, if you fuck up when keeping track of that, you can have bugs where you try to read the data an entity that got deleted. But that won't crash the game.
--- 92829325
>>92829258
That's unusable in real games, only good for toys. In real games you need to be able to operate these systems with more flexibility.
--- 92829330
>>92829300
great a lack of argument right here
--- 92829343
>>92829312
You must pass the state around to some other functions (which may in turn have to do the same). Show how that's done.
--- 92829380
>>92829312
Oh man how did they come up with a syntax that is somehow worse than C++? How do you even manage to do that? I thought nothing could be worse than C++ syntax.
--- 92829400
>>92829343
What do you mean? Just nesting the functions like this?
fn main() {
let mut state = State{
entities: [5., 5., 5., 5. ],
};
loop {
do_physics(&mut state);
do_something_else(&mut state);
println!("{:?}", state);
}
}
#[derive(Debug)]
struct State {
entities: [f32; 4],
}
fn do_physics(state: &mut State) {
state.entities[3] += 10.0;
do_something_else(state);
}
fn do_something_else(state: &mut State) {
state.entities[2] += 17.0;
do_something_else2(state);
}
fn do_something_else2(state: &mut State) {
state.entities[2] += 17.0;
}
--- 92829410
>>92829380
>oh wow how do they come up with syntax worse than of the languages I know?
>reading this language I don't know is so much harder than reading this other one I do know
--- 92829421
>>92829410
Were you upset just because I called you "oh man"?
--- 92829432
>>92829400
Yes. Next, you must express shared control over e.g. physics objects: the animation system must modify the bounding box and the physics objects must operate on the bounding box to "do_something",
--- 92829440
>>92829421
no? what is this non-sequitur, retard? I replied to you because you were acting like a retard, retard
--- 92829445
>>92828779
>>Uh yea buddy, I only make minor mistakes, and rarely, and they're trivial to fix
this is true for me
--- 92829450
>>92829445
future you disagrees
--- 92829465
>>92829432
anon... do you, uh, not understand the difference between using a reference and storing a reference?
--- 92829477
>>92829432
The bounding box are just some floats in that array. do_physics is changing it, and do_something_else can read or change them just fine when it gets called in the main loop right after do_physics.
--- 92829478
>>92829450
I've been programming for nearly 30 years, I wonder when these bugs are going to catch up with me
--- 92829487
>>92829325
bad faith argument
you can just move the goalpost of what a 'real game' is
--- 92829532
>>92829487
no anon, write him a game to prove your point, bet you can't even do it before the thread 404's, ha gottem, rust btfo
--- 92829555
>>92829465
I accept your surrender.
--- 92829557
>>92829478
--- 92829574
>>92829532
That would be a good exercise for him. After all, it only takes 30 minutes to make pong from scratch with no primitives available to start with.
--- 92829603
>>92829557
I have finished several projects and delivered them to users
Can you actually say you've had a problem with memory bugs or are you just assuming that from what others have told you?
--- 92829639
>>92829532
started working on an engine 2 weeks ago actually
--- 92829657
>>92829603
>I have finished several projects and delivered them to users
>it was real in my mind
kek
Protip: nobody from carmack to terry, or from torvalds to kernighan agree with you.
--- 92829679
>>92829639
No wonder you're lost and confused from the afterglow. Give it a few more weeks, you'll be ranting about how shit rust is for games and how ecs doesn't work with it, too.
--- 92829682
>>92829657
>>it was real in my mind
What does that mean? If you ship a product to users, and they experience bugs, they'll tell you about it
So if you've actually shipped products you cant get away with pretending you don't write bugs, unless you ignore your customers aswell
the people you quoted use C not Rust
--- 92829695
Google deserves another bomb.
--- 92829707
>>92829682
t. never programmed anything more complicated than fizzbuzz
>the people you quoted use C not Rust
That's precisely the point, cletus. Take your meds.
--- 92829711
>>92829679
>2 more weeks
not an argument either
--- 92829722
>>92829574
what would that prove? this is a discussion about handling and passing shared state, all of pong's logic can fit inside a body of a loop
--- 92829730
>>92829707
If the people you quoted didn't agree with me, they would use Rust, because they would be afraid of bugs
But they weren't afraid of bugs, so they used C
Tell me if you've ever had problems with memory unsafety
--- 92829741
>>92829682
>If you ship a product to users, and they experience bugs, they'll tell you about it
lol
--- 92829771
>>92829741
If they don't request support themselves your telemetry will report it
--- 92829841
>>92815579 (OP)
https://youtu.be/gWqnz-7iQbY [Embed]
--- 92829872
>>92829730
Oof, so this is the IQ of the average cnile. Impressive in a morbid kind of way.
--- 92829912
>>92829841
can't wait for soulja's review of jai
--- 92829914
>>92829841
>trannyfox
>windows
kill yourself
--- 92829919
>>92829872
Can you actually write a legible response or just howl llike a crazy person?
--- 92830046
>>92829432
This post is actually a perfect summary of the C++ mindset
>simple code that does what it's supposed to do with no issues? but what about the shared control and the other abstractions and buzzwords?
People like this are the real problem. C programmers have their opinions but they don't have this kind of principled opposition to code that works.
--- 92830086
>>92830046
you have no idea what you're talking about
--- 92830113
>>92830046
That's a mighty stupid post. Very in line with what I expect from a C advocate.
--- 92830115
>>92830046
he's not wrong though.
--- 92830152
>>92829841
chinlets, when will they learn
--- 92830173
>>92830046
You interpreted the post precisely backward. The reason for the progression in task submissions is precisely this: rust does NOT allow just "caveman programming" as you would in C where the goal is to just make things work. The borrow checker gets in the way and makes you program yourself into a deadend that requires unsafe or rewriting from scratch to escape. So the goal of the exercise was to guide toward a point where, by increasing the size from a toy high-level representation of what a game might do toward a more detailed 'simulation', you will see that rust, which forces you to stack abstractions and scope notations and lifetimes and structure to get anything to work, "breaks", specifically because it doesn't allow for simple "code that works", although you have to use "breaks" lightly because you can also say "fuck rust and the borrow checker, let's just use Box everywhere", but if you're going to do that you might as well use C with boehm GC and pretend that's memory bug-free, too.
--- 92830470
>>92829258
This is defragmented as fuck. Classic example of why we need headers.
--- 92830611
>>92830173
I "completed" your "tasks" without running into borrow checker problems, using any unsafe blocks, stacking any abstractions, or using any lifetime annotations, and you just went on to cope about how you needed shared access somehow different than just having safe mutable access to all the variables at any point you want, and now about how it would magically stop working in bigger games.
--- 92830809
>>92830611
I'm the queen of England, by the way, back from the dead sure as jesus rose.
--- 92830874
>>92815579 (OP)
>Jai lang owner trashes other language
No he doesn't make any good point. The guy is total narcissist that thinks his language is the best all because he made a puzzle game.
--- 92830909
>>92830809
Nice argument again.
>>92829400
>>92829477
If "shared control" actually means something more than having a mutable reference to the data in any place of the code you want, then explain it.
--- 92830980
>>92830874
Worse, he didn't even make a puzzle game, he got others to do it for him and he """participated""". Not to mention it ran like garbage on overpowered hardware showing the depth of his abilities, but the few examples of people who were allowed to use his language and showed the internals demonstrate he doesn't know shit about even the most basic CS concepts to a level that greatly impacts his language.
--- 92830995
>>92830980
You haven't played the game.
--- 92831021
>>92830980
why are you seething so hard? lmao
--- 92831113
>>92821836
>Disingenuous, the engine is written in C++ for all heavy lifting so C# is more like the scripting language.
lmao you have no idea how it works rust tranny. c++ is used because it (was) easier to port to all the platforms unity is supported on
--- 92831254
>>92830995
>>92831021
Found the blow j(obber)
--- 92831272
>>92830874
Try addressing his argument. Making a puzzle game doesn't mean he's wrong about basic principles of economics that any libertarian would already know. His claims about Rust follow directly from economics. Or are you saying libertarians are wrong?
--- 92831290
>>92831254
no, thats me
--- 92831323
>>92831113
Illiterate, wronger than a troon, and a csharter all at once. Three for free!