5 reasons why Odinlang is great for gamedev ✨

  Рет қаралды 13,983

Karl Zylinski

Karl Zylinski

7 ай бұрын

Why I think Odin Programming Language is a good fit for game development! Follow me on Twitter: / karl_zylinski or join my Discord server: / discord
Timestamps:
00:11 -- 1. Built-in bindings for gamedev libs that just work
02:12 -- 2. Like C, but less annoying and easier to learn
03:43 -- 3. Support for custom allocators and tracking allocators
05:35 -- 4. Low level with "high level feeling"
07:36 -- 5. A non-precompiled and readable standard library
Software I use:
Odin Programming Language: odin-lang.org/
Raylib: www.raylib.com/ (Odin comes with bindings)
Sublime Text: www.sublimetext.com
OBS studio (for recording this video): obsproject.com/

Пікірлер: 101
@frodo_alaska
@frodo_alaska 7 ай бұрын
Holy shit this is amazing. I had Odinlang recommended to me before, but I didn't thing it was THAT good. I'll definitely use it on my next project.
@karl_zylinski
@karl_zylinski 7 ай бұрын
It really is C with everything I dislike about C fixed ♥
@littlecurrybread
@littlecurrybread 3 ай бұрын
@@karl_zylinskithis should be the quote on the odin home page lol, cheers, love the vid, subbing now
@karl_zylinski
@karl_zylinski 7 ай бұрын
NOTES: 00:50 -- When I say "compile and link raylib" I mean that when your code compiles it will compile the raylib bindings along with it. The stuff in raylib.odin dictates how it will link raylib. I do not mean that it actually compiles the raylib source, that stuff is precompiled inside the .lib and .dll files you find in vendor/raylib.
@karl_zylinski
@karl_zylinski 7 ай бұрын
Outline with timestamps: 00:11 -- 1. Built-in bindings for gamedev libs that just work 02:12 -- 2. Like C, but less annoying and easier to learn 03:43 -- 3. Support for custom allocators and tracking allocators 05:35 -- 4. Low level with "high level feeling" 07:36 -- 5. A non-precompiled and readable standard library
@connor43057
@connor43057 4 ай бұрын
I’m glad raylib is getting traction. Really good library
@paperdeck
@paperdeck 7 ай бұрын
The reason why I use Odin is definitely the fast compile times (even compiling the source code of the compiler is very fast)
@karl_zylinski
@karl_zylinski 7 ай бұрын
Although, the compiler is still written in C++. But I guess it's written in a way that makes the compilation very fast (it uses "unity builds" and no modern C++)
@ar_xiv
@ar_xiv 4 ай бұрын
Planning to try this out with raylib to port some demos I’ve made. Hearing normal devs tak about it is a bit less intimidating than hearing gb talk about it lol
@enkiimuto1041
@enkiimuto1041 5 ай бұрын
That was very instructive, thank you
@karl_zylinski
@karl_zylinski 5 ай бұрын
Thanks for watching!
@MaximSchoemaker
@MaximSchoemaker 7 ай бұрын
Good to know ✨ cheers!
@icemojo
@icemojo 7 ай бұрын
I've been so busy with work for the past few months. I miss tinkering little stuffs with Odin.
@karl_zylinski
@karl_zylinski 7 ай бұрын
Hope you find some time!
@JustGAST
@JustGAST 6 ай бұрын
Thanks for review! I wonder if Jonathan Blow saw this language before inventing his own.
@karl_zylinski
@karl_zylinski 6 ай бұрын
I think this language got started in 2016, Blows language got started in 2014-2015 I think. A few things in Odin have been inspired from Jai, and the syntax has similarities, but they are also quite different in other ways.
@SabeDoesThingsChannel
@SabeDoesThingsChannel 7 ай бұрын
Hey, a gamedev question. So how did you do your animations because when I was trying to get it on my game with raylib and Odin I couldn't get it.
@karl_zylinski
@karl_zylinski 7 ай бұрын
Hi, My animation files are sprite sheets, i.e. a horizontal image containing all the frames. In my code the animations work like 'flip books', i.e. it uses a rectangle to look into one of the frames of the sprite sheet a time. It uses a timer to know when to switch frame, when it switches frame it moves the rectangle to the next frame in the sprite sheet. In Raylib I would use rl.DrawTexturePro to do this, since it lets me specify both a source rectangle (where in the sprite sheet to look) and a dest rectangle (where in the world to put my sprite).
@UlrichTonmoy
@UlrichTonmoy 7 ай бұрын
does odin have interop with C or C++ or compiler built in for C++ as long as you dont have either of these then no other lang can really be great for gamedev
@karl_zylinski
@karl_zylinski 7 ай бұрын
It has interop with C. You can call C functions using C calling convention and easily bind to C libraries. The Raylib bindings show how to interop with C quite nicely: github.com/odin-lang/Odin/blob/master/vendor/raylib/raylib.odin (there are also a bunch of other C library bindings in the vendor folder) It does not interop with C++, but many C++ libs have a C wrapper / expose functions with C linkage for the purpose of interoping with other languages.
@vexedev
@vexedev 6 ай бұрын
Hi there, thanks for the video! What's the debugging situation like with Odin? I see you use Sublime, are you able to attach to debugger, put breakpoints etc?
@karl_zylinski
@karl_zylinski 6 ай бұрын
Hi! Thanks for watching I use Windows, but this is what works for me: If you compile with -debug option, then it generates .pdb files. With that you can debug from within Visual Studio, VS Code or RemedyBG. Breakpoints also work. VS Code seems most popular for doing the debugging.
@Narblo
@Narblo 6 ай бұрын
A year back I wanted to make use of xorg instead of SDL abstraction layer and Odin made it painful to work with
@karl_zylinski
@karl_zylinski 6 ай бұрын
That's unfortunate. What was the issue?
@Ilumar589
@Ilumar589 6 ай бұрын
Have you also tried zig ? What's your opinion on the differences ?
@karl_zylinski
@karl_zylinski 6 ай бұрын
Only tried it a tiny bit. It seems like a good language and the differences are not that big. Odin is a bit more minimalistic.
@geeksuperstar8564
@geeksuperstar8564 2 ай бұрын
Could you please create more tutorials on Odin programming?. I wish you could make a simple game engine without using third party libraries.
@karl_zylinski
@karl_zylinski 2 ай бұрын
Hi. I have these tutorials studio.kzbin.infoPLxE7SoPYTef1jYHJ6NxNgocVjQKkq7eEa/videos However, they use Raylib, which is a third party library. I don't think I will be doing any tutorials on general engine development. I think its better to just make a game and only write the code the game needs, rather than write general engine code and then write a game on top of it.
@tanura5830
@tanura5830 6 ай бұрын
Wow this is cool
@malcolmx86
@malcolmx86 Ай бұрын
Odin is god tier
@stoomkracht
@stoomkracht 4 ай бұрын
Care to make a video about your Sublime Text setup for Odin? How to set things up to actually start deving?
@karl_zylinski
@karl_zylinski 4 ай бұрын
I have actually planned to exactly that! Stay tuned
@karl_zylinski
@karl_zylinski 4 ай бұрын
Hello again. I have made a video about this here: kzbin.info/www/bejne/bXykhJ1oq5mciM0 I will also soon make more basic beginner videos that will show the whole process of downloading the compiler.
@stoomkracht
@stoomkracht 4 ай бұрын
​@@karl_zylinski Fast as light. Thanks. Going to check it out right away/
@DeathSugar
@DeathSugar 4 ай бұрын
is there file-level visibility scopes or if you import file it will leak every function inside of it?
@karl_zylinski
@karl_zylinski 4 ай бұрын
There are only package-level visibility scopes. If you write import "renderer" then all those things in renderer will live under renderer.blabla if you write import ren "renderer" then all those things in renderer will live under ren.blabla (i.e. you can give local aliases to imported packages) This is also how you import standard library things: import "core:strings" -> you can use all the strings stuff by typing strings.blabla Packages are essentially folders, all files within a folder/package will see all code in that folder. The main reason to split things into separate files within a package is for keeping things organized, but it does not introduce any named scopes. You never have to write code to import code from separate files within the same package, so organization within a package tends to be quite painless.
@karl_zylinski
@karl_zylinski 4 ай бұрын
It is similar to how one writes code in a C project, with the very important difference that imported libraries (packages) won't litter your program's global namespace.
@DeathSugar
@DeathSugar 4 ай бұрын
@@karl_zylinski in C if it's not defined in headers its accesible only within C file. How does it work in Odin? What if I want some functions to stay hidden? Should I build some private library then to make them out of export scope?
@karl_zylinski
@karl_zylinski 4 ай бұрын
Yes, sorry, I thought of how I used to code C with "unity builds" , I got so used to doing that. You can put @(private="file") in front of things if you want to hide them inside the file. But in my experience there is little need to explicitly hide things from oneself.
@daikenkaiMusic
@daikenkaiMusic 7 ай бұрын
Is there an SFML binding yet?
@karl_zylinski
@karl_zylinski 7 ай бұрын
Doesn't seem like it. If you want something similar I recommend trying Raylib or SDL2. Raylib is a nice fit together with Odin
@daikenkaiMusic
@daikenkaiMusic 7 ай бұрын
@@karl_zylinski cool! I love your videos btw. Odin seems like a cool language. But you should go back to your old nickname "slim shadegren" i think ;)
@karl_zylinski
@karl_zylinski 7 ай бұрын
@@daikenkaiMusic ahhh, haha, its you!! it only showed the channel name lol Thanks a lot :D
@_iao_
@_iao_ 7 ай бұрын
🧙‍♂👍
@scottwilliams1902
@scottwilliams1902 4 ай бұрын
Odin is a great language for games. I use c++ in my day job and have been looking for a language with the power of c but with less of a setup time for quickly prototyping or making tools. I tried zig - too verbose. I also couldn't be bothered to learn the build system. Go is a great language but lacks the speed and is a little too high level for my purposes. Rust is just not practical for my purposes as it required way too much thinking and being careful with the way you code. So far Odin seems to be the perfect fit for my needs. Easy to pick up and get work done quickly, but with everything you need. The only problem for me would be if I wanted to release a game for consoles. I'm not sure of how difficult it would be. If at all possible. I suppose if we were to output the game as a library it could be linked to the console libraries. Something worth looking into at some point. Congratulations on the release of Cat & Onion. I will check it out properly soon.
@karl_zylinski
@karl_zylinski 4 ай бұрын
Thank you! I agree with you completely on why it's so good for games. As for consoles, there tends to be problems on playstation or xbox (I can't remember which) with that they want you to use their own compilers... I think Odin in theory needs to be translated to C and then compiled. Which might happen in the future if Odin gets a new backend that has been in the works. That backend might support outputting C. We'll see!
@scottwilliams1902
@scottwilliams1902 4 ай бұрын
Yeah. Technically a library output for the correct target should work. But as you say there are restrictions on what you are allowed to do. Also Sony used to have proprietary graphics libraries which would be a hurdle. It's been a few years since I wrote a game for consoles so I have no idea of the state of play now. I miss the old days when we wrote games in pure assembler. That was fun. Nim style C output would be very cool. Though if someone really wanted to publish on console then converting a game from Odin to C by hand wouldn't be too difficult.
@jean-philippegrenier120
@jean-philippegrenier120 7 ай бұрын
but I love fighting the linker!
@karl_zylinski
@karl_zylinski 7 ай бұрын
friday night crack open a beer time to fight the linker
@ThislsYusuf
@ThislsYusuf 7 ай бұрын
Is a tracking allocator the same as an arena allocation?
@karl_zylinski
@karl_zylinski 7 ай бұрын
Hello! No, the tracking allocator can wrap any other allocator. It tracks when the allocation happened, so it can tell you that you forgot to release that memory. An arena allocator is an allocator that has a set arena or area in memory within which the allocator can take memory from, and you can also deallocate the whole arena in one go.
@ThislsYusuf
@ThislsYusuf 7 ай бұрын
@@karl_zylinski Got it it. Thanks!
@ViaConDias
@ViaConDias 6 ай бұрын
I don't know how I feel about the "batteries included" in a language. It's like C is beautiful, C++ is a "monstrosity". I kinda fear Odin might end up in the C++ camp at some point. What are your thoughts on that?
@karl_zylinski
@karl_zylinski 6 ай бұрын
The 'batteries included' are bindings to popular libs. Those bindings live in the 'vendor' folder, which is totally separate from the 'core' folder. The 'core' folder contains the standard library. The standard library does not have any dependencies on anything inside the vendor folder. You can remove the whole vendor folder (removing all those included batteries), and the language works fine anyways. So therefore, I say that it does not matter. The reason C++ is such a monster is because they add lots of weird things to the core language and also add too complicated things to the standard library. Odin does none of those two, and the creator is very conservative on extending the core language. Having these batteries included is great for making the first impression for new users very straight forward, without polluting the standard library.
@ViaConDias
@ViaConDias 6 ай бұрын
@@karl_zylinski Okay. That sounds good. I absolutely agree that it's a great way to get some people over to try it out. I have been playing with Raylib in Nim and it's a good experience but could be better so I do get the marketing aspect of it.. Thanks for explaining
@gevilin153
@gevilin153 3 ай бұрын
Null string are not a "design mistake of c", design of c is simplicity - it gives all the fundamental things, rest is up to the programmer. Just make a string that does know it's size, you have all the tools needed.
@karl_zylinski
@karl_zylinski 3 ай бұрын
It depends on the perspective you look at it from. Your perspective makes sense within a C codebase. Mine is more from the angle of using libraries written in C from other languages. And in those cases the null termination character means that you often have to allocate strings when interfacing with C libraries, just to put a null at the end. From that perspective C is putting metadata at the end of a block of data instead of just having it as a number next to the block of the data.
@gevilin153
@gevilin153 3 ай бұрын
@@karl_zylinski I just don't think it's a design flaw of C itself, rather that of the standard C library. Life would be much easier if the standard library included a proper string type, then other libraries would just use it. It's a shame it doesn't
@DanFromIran
@DanFromIran 7 ай бұрын
I was loving it until I heard "dynamic generic array". I don't like anything that has magic underneath. I agree that \0 strings are annoying in C. have you tried zig?
@karl_zylinski
@karl_zylinski 7 ай бұрын
I don't like magic either. But with this, there's no magic. The dynamic array says which type it contains items of and all the code for how items are appended to the array is clearly readable in the standard library. Also you can use custom allocators to decide from where the dynamic array gets its memory. It's all very convenient, while you still have total control. I've used zig very little. I might give it another evaluation after my current project is done.
@DanFromIran
@DanFromIran 6 ай бұрын
@@karl_zylinski Thanks for that in depth reply. i think you will like zig too.
@encapsulatio
@encapsulatio 6 ай бұрын
I think you need to do better and say why would I choose it for gaming, instead or Zig or Nim or V.
@karl_zylinski
@karl_zylinski 6 ай бұрын
Fair enough! I think how interesting this video is depends on who watches it. For people who had problems in other languages with the things I listed, I think the video makes sense. But for people who haven't had my experiences in other languages, it is not a very informative video.
@ViaConDias
@ViaConDias 6 ай бұрын
I actually think he does very well in pointing out why to use it for games, and it seems to be directly made for that. The comparison there I think would be Jai (if it ever releases). I would be more interested in hearing about what it feels like outside games where both Nim and Zig are amazing (don't know V so no comment on that)
@ForeverZer0
@ForeverZer0 4 ай бұрын
@@ViaConDias While it is convenient, the "includes graphics libraries" is not actually a very compelling selling point, and I wish Odin would advertise its other strengths instead of that nonsense. Writing a script to generate the same bindings for pretty much any language can easily be accomplished. The bindings that are included are nothing special, just a clone of someone's project that was included in the vendor directory of the main Odin project. They aren't "built into the language" like some envision, nor even given any extra attention to make them more idiomatic for the language. I feel like Odin is trying to market itself too hard as a "game development language", when it actually has other strengths that are more noteworthy and set it apart from others.
@ViaConDias
@ViaConDias 4 ай бұрын
​@@ForeverZer0I agree and actually made another comment about this. Marketing it as including these graphics libs only puts extra work on the developer. How will it even work? Will Odin have a minor version update when one of the libs makes a new release? If I am told it includes these libs I expect it to be ready with the newest version the same day as the libs release. But then I can't update my language if I'm working on a project that is using an older version of the graphics libs? I am not a language developer so it might just be me, but I don't know how this would be managed. With Nim or Zig I know it is up to me to update my graphics libs when a new version is released. This has made me not look at Odin for now. It is not as fast to develop in as Nim and it is not as small and concise as Zig and if I really want a language specifically made for gave dev I will probably beg JB for beta access to Jai. Then again, I might very well be wrong about all of this 🙂
@MrAbrazildo
@MrAbrazildo 7 ай бұрын
If it hasn't classes, to proper hide variables in C++ style, it's not proper for games, in my opinion.
@karl_zylinski
@karl_zylinski 7 ай бұрын
I used to think so too. But in recent years I have coded using just structs where everything is public. If I truly want to hide how something works, then I make an API where it is not possible to fetch the internal structs.
@pierreollivier1
@pierreollivier1 7 ай бұрын
I've never understood that idea of having private variables made unavailable by choice or using API or getters/setters, it's bad for performance and doesn't make sense has you could easily set a naming convention for private stuff, for example i always start the identifier of variables i don't want to touch with _var. Maybe i'm missing something for the reason why to use such a patern.
@wiktorwektor123
@wiktorwektor123 7 ай бұрын
And majority of code that uses private variables in classes are simple getters and setters that do nothing more than simple equal sign, but you have your fancy encapsulation.
@MrAbrazildo
@MrAbrazildo 7 ай бұрын
@@wiktorwektor123This is OO bad practice.
@pierreollivier1
@pierreollivier1 7 ай бұрын
@@wiktorwektor123 yeah I honestly don't get it either. like your adding ton of boilerplate and unnecessary overhead, where you can just do __my_var or _pvar or whatever naming convention you want and achieve the same result, hell you could even do a special Macro if you really want it to look like a function call.
@Dragiux
@Dragiux 7 ай бұрын
Nice shill video.
@Selendeki
@Selendeki 6 ай бұрын
This must be a joke of sorts, or you don't know what shill means
@Selendeki
@Selendeki 3 ай бұрын
​@@RealAliens-fw4nq So, the video author is only pretending to like Odin and stands to gain from tricking us into liking it? Haha, hard to believe you're a real person.
@Selendeki
@Selendeki 3 ай бұрын
@@RealAliens-fw4nq If that's not what you wanted to imply then you clearly don't know what shill means, which is strange since you think you can tell me what it means.
@Selendeki
@Selendeki 3 ай бұрын
@@RealAliens-fw4nq You're not keeping track of what leaves your mouth much less understanding what you're reading and attempting to respond to. It's fine, we can leave it there.
Jai vs Odin systems programming languages (Non-spicy takes!)
20:10
Context Free
Рет қаралды 68 М.
I Tried JAI, Can It Replace C++?! (Programming Language)
21:05
ВЫКИНУЛА МОЙ АЙФОН?? #shorts
00:33
Паша Осадчий
Рет қаралды 1,1 МЛН
PINK STEERING STEERING CAR
00:31
Levsob
Рет қаралды 16 МЛН
reverse engineering makes you a better programmer (let’s try it out)
13:12
Low Level Learning
Рет қаралды 123 М.
MUST KNOW bashrc customizations to boost productivity in Linux
13:38
Vlang: The language of 2023?? | Prime React
35:53
ThePrimeTime
Рет қаралды 129 М.
Nim 2.0 Release! | Prime News
20:03
ThePrimeTime
Рет қаралды 59 М.
When Your Game Is Bad But Your Optimisation Is Genius
8:52
Vercidium
Рет қаралды 1,3 МЛН
Odin + Raylib: Snake game from start to finish
1:28:23
Karl Zylinski
Рет қаралды 1,3 М.
V - Best Programming Language to Learn in 2023?
8:44
Code to the Moon
Рет қаралды 132 М.