- 9
- 38 225
TheSandwichCoder
Приєднався 21 жов 2023
I’m a sandwich that does programming and game dev 🥪🖥️
Python Developer learns Rust (and remaking my chess engine)
Wait what... I dont actually hate rust?!? I guess I just clickbaited yall then...
The Chess Video will be coming soon! After probably another 2 months... maybe 3 months.
Wow I am getting lazy at writing descriptions... probably no one will read this anyway.
Githubs:
Space Invader (why?): github.com/TheSandwichCoder/Bevy-Space-Invaders
Ball Simulation: github.com/TheSandwichCoder/Bevy-Ball-Simulation
Rust Chess Engine: github.com/TheSandwichCoder/ChessEngine-Rust
Whhhhaaatt... you are still here? here have a dinosaur 🦕
The Chess Video will be coming soon! After probably another 2 months... maybe 3 months.
Wow I am getting lazy at writing descriptions... probably no one will read this anyway.
Githubs:
Space Invader (why?): github.com/TheSandwichCoder/Bevy-Space-Invaders
Ball Simulation: github.com/TheSandwichCoder/Bevy-Ball-Simulation
Rust Chess Engine: github.com/TheSandwichCoder/ChessEngine-Rust
Whhhhaaatt... you are still here? here have a dinosaur 🦕
Переглядів: 33 261
Відео
Making a Ray Tracer in Python #rtx #programming #gamedev
Переглядів 7333 місяці тому
I made a ray tracer(path tracer) from scratch in python. This video is much more laid back in terms of editing and animations than the other ones, so tell me if you like it more! although I forgot to mention it in the video, this would not be possible without: Ray Tracing in One Weekend raytracing.github.io/books/RayTracingInOneWeekend.html I also mentioned: Sebastian Lagues RTX : ua-cam.com/vi...
Making a Chess Bot from Scratch (part 1) #chess #chessbot
Переглядів 1 тис.5 місяців тому
In this video I made a chess bot from scratch in c (first c project). Im hoping to improve on it and hopefully make a follow-up video where it might beat me. If I'm not lazy, a link to the Github to play the chess bot will be in a comment below. DISCLAIMER: this is still a massive work in progress, so there are many bugs and crashes still Pls subscribe since this video and bot took like 4 month...
Making a Checkers Bot in 60 Seconds #pygame #gamedev #programming #shorts
Переглядів 1817 місяців тому
what I meant to say was that you can check the description for the game. Also I really did the bare minimum for this bot to play properly so if you're interested in a more detailed video on chess bot programming, come check on me in a month If you wanna beat the bot, you can download and try it here: github.com/TheSandwichCoder/CheckersBot Rules for my version of checkers: 1. All captures are f...
I made a Physics Simulator from scratch in Pygame #pygame #gamedev #physics
Переглядів 4968 місяців тому
In this video I made a physics simulator in pygame. I actually made this quite a long time ago but hey making a video takes time. I also made the Suika Game. Take note: the Suika game has a lot of bugs the main one being you just cant do anything. Im too lazy to fix it. also how many people would actually read this anyway right? If you are interested in playing with the physics simulation or Su...
Making a Game for Christmas in Pygame #pygame #programming #gamedev
Переглядів 39510 місяців тому
Merry Christmas! So I made a game for Christmas cus why not right. This was a really big challenge and I faced alot of bugs on the way, but I think it turned out well and was worth it in the end. Of course, I could not have done it without Perlin Noise code made by: Supreme Sector(1d terrain noise): Video: ua-cam.com/video/QHdU1XRB9uw/v-deo.html Github: github.com/Supreme-Sector/Python-Perlin-N...
I made a game for NNN in 7 days
Переглядів 13411 місяців тому
Hey so I made a game for No Nut November in 7...8 days well you will know when you get to that part. Its a shame that I lost the first half of the recording but I think the video still turned out find right? This is the first full actual video on my channel, so let me know whether you enjoy it. I got the .exe file working, so download it and try to run it. I promise you its not a virus... I thi...
Rust has such a steep learning curve, but once you stop boxing with the compiler and borrow checker and end up dancing with it, it's such a wonderful experience. Once I got to that point (like 1 month of playing after a 5 month hiatus) I was the most productive I've ever been with code
gooning to this :)
please make more videos! you're amazing
Hey dude, awesome video!! I'm your thousandth subscriber, very well deserved. Please keep going 💪🏼
Ah okay, so you are only just starting to learn how to program. That makes more sense. I would suggest you start with C and avoid all of the pitfalls of C++ or Rust. If you use Windows, then I'd suggest LCC-Win64 which provides an IDE and compiler and its compiler has extensions for operator and function overloading. That addition alone makes it worth the effort to use as a compiler even on Linux, because it runs perfectly with WINE. The easiest way to remember lifetimes with C is malloc() before you need it and only free() it when you're done with it. A simple way to handle that is if you are in a new scope and know you'll need something, go ahead and write two lines and insert new code between them: obj = malloc( ... ); free( obj ); and fill in the ... when you get to it.
Bro your video editing is peak. 100/100. Claiming my OG ticket rn rn
Nice video. Now redo it in haskell.
10:08, I have my questions with this problem, this can be avoided by doing direct indexing, something like my_vector[I].collides(my_vector[j]), but I don't really know if this is the most optimal thing to do, this is how I always do it
10:17 nooo, please dont copy everything to avoid the borrow checker 😭 you want itertools `.combinations()` or `.tuple_combinations()`
been watching a lot of your videos and this is all really nice content! hope you enjoy the exposure from the rust video and can't wait to see what's next
I really recommend Lobster, it's a language that is statically typed, can compile and link with C++ and looks like python/C#
subbed! good vid. Also ye i subbed gefore 1k :)
rust snytax looks awful to me
Nice stuff! Glad to see your subs 10xed at the time of this comment
quick, become friends with me before you become famous so I could brag to everyone else in the comments
It was all fun and games until 6:34 bro what the actual fook. You SHOULD rely on GH Issues/Discussions and official documentation, and NOT on hallucinating autocorrect.. ChatGPT programmers smh. Funny video, but jesus please stop being bs programmers
I just got a new follower, please keep making new videos
OMG yes zaddy, I woukdl love to see you work on this project and tickle my ferret
Getting pipebombed by bad ChatGPT rust code is I think the main thing slowing me down. Only when writing new code and forcing ChatGPT to comply can I get something useable. Remaking my main game in rust, 6k lines deep and I’m loving it now that I have a strong handle on rust concepts
6:14 it's compiling the engine too so it takes so long, after first compile it should just compile what you change.
I just did this like 2 months ago like the exact same transition
!!!
3:06 in python you can also use f strings instead of concatenation, so in this case it would have been f"the first part of the text {var1} the other part of the text" just like rust, and yes the f before the brackets is needed
0:32 bro update your pc
Difference between String and &str(string slice) is its lifetime, effectively '&' in rust denotes we r using reference of the var, so in case of &str its lifetime depends upon original scope i.e. passing and returning gets difficult and sometimes not possible to use. There are further complications like not being able to use it later and so on as it is just reference to a string. Meanwhile 'String' type is a heap allocated variable that can be understood as normal working variable you would expect off of vars like int and so on. It is closer to String type from C++, also heap allocated memory need not be deallocated manually as it uses RAII. This is what i understand as a beginner, there definitely are some mistake but it is what i have understood
Shit python is better. This takes forever to do anything😂
Just a point, the fact that its now a struct type and not a class, in the end (even though C++ is touted to be more OOP hence the keyword class) they're literally the same kind of data structure, it doesn't really make a difference. Btw, no one using OOP languages is actually doing proper OOP arch, the concept of taking "real world concepts" and distilling them into a collection of classes is not what OOP is.
I was going to make fun of you for using python, then I saw you using Windows, so i'd rather make fun of you for that instead.
15:24 I'm surprised you didn't learn all of these concepts (except maybe memory safety but even that you learn by segfaults) when you went from Python to C++.
well, my way was: js + ts -> c++ (for really short period of time) -> rust i think the reason for this is mixed, it could be that c++ has very poor documentation? or its not really user friendly? c++ learning resources are not well structured? (see rust book, rust by example, rustlings, rust playground)
Stop using ChatGPT king
YEAH BUDDY LESS FOOKIN GOOO, I made as well engine on Rust, it was much easier for me than on C++ since I'm bad
The thumbnail says you hate rust as much as I hate wayland.
note to self: raytracing in python is slow (that's crazy)
mutaball
This video is SO well made it’s actually crazy. It’s great that it blew up, because it deserves it
You put so much work into this video. 😭🙏 This guy deserves more subs.
I was reading the comments when I read about your sub count, and checked it. I was sure you would at least have 120k subs
10:18… is that O(n^2)? lmao. Can you make a grid where you check each square and see if balls collide that way? Splitting it up will I think make it O(nlogn) until you check for collisions at the edge of the grid, still better than checking every ball n times where n is the number of balls.
sorry to take you away from 666 subs
6:34 "ChatGPT gave me a lot of wrong information" you don't say 😄
10:30 you couldve avoided copying by indexing rather than using iterators
For me, the part I hate (and it's a deal breaker) from rust is only one mutable borrow at a time.
A usize is an unsigned integer whose size is defined to be the minimum size needed to store the highest possible addressable memory location for your machine. The thing about Rust is that at first a lot of things seem cumbersome, but when you stop to seriously ponder the question "what's the alternative?" you quickly realize that Rust is the best by far in most, if not all, categories.
I’d be interested to know why you put unreal engine as the most difficult engine on your graph? I guess your view is very programmer oriented as I think most people would associate unreal with being far more friendly than straight code like bevy or sfml.
amazing now try zig :D
Never intro again
Perhaps you should read the manual instead of asking a chat bot.
10:05 This is why I think it is better to learn C++ before Rust -> There is nothing inherently wrong about multiple mutable references, and your code would work just fine with them. Just use unsafe and assign mutable references anyway. So long as they don't alias (reference the same thing) it's perfectly fine in Rust. The reason they are avoided is for a couple of very rare edge cases. If you append to a vector, then the vector might move it's content elsewhere (to find somewhere with more room). If you set an enum, then the old value will be invalid. Both of these operations invalidate the old value, so this is the case where multiple mutable references can be unsafe. You could write to a region of memory that no longer exists. If you are not working with Enums or Vectors, then this problem is unlikely to occur. Your elements probably don't contain enums or vectors, so this problem can't happen. Rust is being over-protective. That said, you should be aware that the compiler can rewrite your code (to make it faster), so you should follow the borrow-checkers rules as much as possible, and ensure that mutable references do not alias.
"Just use unsafe and assign mutable references anyway" 🤣
jokes aside, you should think 10 times before using unsafe in Rust, its not C and not C++ where unsafe is everywhere and where you don't care that much about memory safety as we care in Rust
you better take a look at @HumanityAsCode comment
or comment by @seanp5524
@@xshady2967 Being aware of when you can use unsafe is a good skill to have. Cloning the entire vector is a very bad idea- it involves a whole new heap allocation plus copying all the content. The only reason to use Rust over a garbage collected language is for performance. Safety matters to an extent, but if the end result is slower than a garbage collected language, you might as well use the garbage collected language and avoid the headache of the borrow checker. If you can stick to safe and still be reasonably efficient, then it's worthwhile doing so. I just don't see a good way to do that here. Maybe I am inexperienced though.
7:42 ECS is fast because you can split things up into smaller pieces. This allows you to only request the values you need for the operation that you are doing. Normally, if you were to put everything together (like a single massive enemy struct), this would work just fine put potentially you will have unnecessary values that don't get used often, filling your CPU cache, slowing it down. The key thing is that the CPU transfers in chunks (roughly 64 bytes at a time) and the time that it spends transferring values can be a significant bottleneck. So when you are working with large amounts of entities (like 1000+) you need to separate out the entities into smaller pieces to speed up the transfer time. If you are rendering to the screen, for example, you only need sprites and positions, you don't need the whole entity to do that. With ECS, you can split up entities into smaller parts to do these kind of heavy throughput while still relating the parts (components) to each other. If you are making a physics engine, you can have the physics engine only fetch colliders, and ignore all the other stuff that the entities might have.
Blud is a cheeseburger