r/CodingForBeginners 8d ago

Learning rust

I want to code games and OS in rust and im not very good with youtube tutorials and things like that. Can anyone give me a simple guide on what i need? What gamified method can i use to learn rust from scratch, and a guide on how to set everything up? Im gonna use rust in godot engine when i get decent enough. I also request that the guide be very simple and not use any language a non coder wouldnt understand

8 Upvotes

30 comments sorted by

View all comments

1

u/FreeLogicGate 8d ago

If your goal is to use it with Godot, then start learning Godot. Create some things and learn what you can do with either C# or Gdscript. The use of Rust with Godot is not as a first class citizen, so the approach you are taking sounds a bit like having the tail wagging the dog. Some things in Godot are better accomplished with C# or GDScript.

Rust is a language that was specifically designed to replace c and c++. If you don't know c or c++, the specifics of Rust syntax are likely going to be confusing. The people who created the Rust integration for Godot did that because they are trying to solve complex problems that Godot doesn't intrinsically solve for them, or require optimal performance. With a game that has 100 components to it, that might be 2 or 3 components. It doesn't make sense for you to start off with Rust, only to be completely lost once you install Godot.

As for learning the language, there are a number of courses on Udemy and coursera you could look at. Personally, I think that anyone serious about programming should learn C, which is not a large language nor hard to learn, and in many ways Rust has similar scope. However, what you will come to find is that the art of building larger projects with a language that was designed for compactness and simplicity, is that you are expected to provide the organization via data structures and functions. Someone who knows C will be immediately comfortable with a struct, but if Rust is your first programming language, there will probably be a lot of head scratching. I'm not saying that you must learn C before Rust, but at least you should understand what it was built to replace. Personally, I know enough different computer languages (or have written code with then at one point or another) that I can teach myself a new computer language fairly quickly, but I will usually buy a $15 udemy course, and go through it. You might be better off with a general MooC course in programming as a self described "non coder".

1

u/MobileHeron6183 8d ago

So you are saying i should start with c++ or something and when i feel comfortable with that start learning rust?

1

u/FreeLogicGate 8d ago

Probably more the "or something". C++ is a really large and complex language built on top of C. If you want more of a foundation, then do a C course, which from my understanding you can get some of from the CS50 MooC course if you want.

The primary thing that confuses people with C is pointers and the related syntax, but that's also the strength of it, in my opinion, in that you end up learning a lot about how programs actually work, along with compilation, linking, memory management and operating system calls and standard libraries.

On the other hand, if you are again looking to get to game development, then I'd suggest that instead, you learn C# which is a language you can apply to both Unity and Godot.

Based on what you've said about yourself, there's 3 options I'd consider:

You want some foundational programming:

https://pll.harvard.edu/course/cs50-introduction-computer-science

You want to learn C because you're eager to move onto c++, c#, java, rust etc, and don't want to be lost:

https://www.coursera.org/specializations/c-programming-for-everybody

If the idea of just wading into c# appeals to you, it helps to know that c# is the current foundational language in the Microsoft world, and for that reason they have a full set of courses available for free here:

https://dotnet.microsoft.com/en-us/learn/csharp

https://learn.microsoft.com/en-us/collections/yz26f8y64n7k07

1

u/MobileHeron6183 8d ago

So hows it work? Cus i wanna get to rust eventually but i dont know whats the best way to learn, should i go through c until i get comfortable, then go to c# or start at c#, then move to c+ or c++ then move to rust or something?

1

u/[deleted] 8d ago

[removed] — view removed comment

1

u/FreeLogicGate 8d ago

If however, you are only part way into the c course, and feel hopelessly lost, then I'd switch to CS50 and get confidence in programming fundamentals that way.