[go: up one dir, main page]

Understanding the Odin Programming Language book cover. It's blue with the name in big print. The author's name (Karl Zylinski) is at the bottom right.
Understanding the Odin Programming Language by Karl Zylinski

Do you want to learn the Odin Programming Language and demystify low-level programming?

Then this book is for you.

Read a sample or buy now

Understanding the Odin Programming Language is a book that teaches both basic and advanced Odin concepts. You'll learn about procedures, manual memory management, parametric polymorphism, data-oriented design, and much more.

The target audience is anyone with some programming experience. Odin is a simple yet powerful language, making this book a great introduction to low-level programming, regardless of your background.

A programming language is a tool. By understanding your tools, you will become a better craftsperson. Therefore, this book does not just explain how to write Odin code. It also explains why the language works the way it does.

What people say:

I highly recommend Karl Zylinski's excellently written book on Odin—perfect for anyone who wants to learn and understand the Odin programming language. -Bill "gingerBill" Hall, creator of Odin.
Karl makes a great job at explaining Odin. I had a good experience with garbage collected language like Golang and the book really helped me to transition to a non garbage collected language like Odin. -Review on store.zylinski.se by Kevin D.
I never read, I get distracted easily. But the writing style here is so good, that I didn't have any issues reading through the whole thing in a couple days. -Review on store.zylinski.se by Shaka.

Version 1.8 released! Read the release notes.

Available formats:

HTML

Shows how the book looks in the HTML format. There's a heading saying 'Parametric polymorphism'. There is some text and some extra information bubbles on the side. There is also some code near the bottom of the image.

Beautifully laid out and easy to navigate. A portable HTML file with all the fonts and images baked in. Similar to a PDF, but nicer to use.

The optimal reading experience on a computer. Can also be read on a phone or tablet.

Available on:
store.zylinski.se HTML+eBook Itch HTML+eBook

Read a sample

eBook

Shows an Amazon Kindle with the book open. There's an illustration visible, some headings and a bit of code.

Specially suited for e-readers and eBook apps.

Nice and simple layout. Includes all illustrations and supports color.

Available on:
store.zylinski.se HTML+eBook Itch HTML+eBook Amazon Kindle eBook Google Books

If you are unsure of which version to get, then I recommend buying it from store.zylinski.se or Itch. On there you'll get both the HTML and eBook versions.

Overview video Release notes
Version 1.8

Strings chapter overhaul

This version does some major changes to the strings chapter (chapter 11). It has been heavily revised and expanded. Some changes are:

  • Clearer about how UTF-8 is decoded into runes.
  • A section on how to manually decode UTF-8.
  • The old "bubble" about null termination has been made into a proper section.
  • The section "Deallocating strings mixed with string constants" has been made clearer and more useful by considering a map instead of an array.
  • A section on how the phrase "string constant" can be ambiguous.
  • The Windows section on UTF-16 has been mostly rewritten and now uses the new cstring16 type.
  • Many, many more small changes and edits.

Changes to other chapters

  • Chapter 1.5: Typo fix.
  • Chapter 2.4: Note about odin run . -keep-executable (new Odin behavior).
  • Chapter 3.2: Typo fix abut type inference.
  • Chapter 5.3: Clarification about the .(Type) syntax used to check the variant of unions.
  • Chapter 7.4: Clarified a sentence.
  • Chapter 7.8: Add information about "contextless" requirement for @init and @fini.
  • Chapter 10.1.5: Code typo fix.
  • Chapter 10.3: Remove unnecessary slice operation.
  • Chapter 11.6: Code typo fix.
  • Chapter 15.2: Move bubble about bit_set initializers to a more appropriate location.
  • Chapter 15.2.2: Typo fix.
  • Chapter 15.3: Typo fix.
  • ... and several additional small fixes!

Get the latest version by just re-downloading the book from wherever you bought it.

Version 1.7
  • Chapter 1: Fix broken Discord link
  • Chapter 5.1.3: Typo fix
  • Chapter 9.7: rand.int_max range clarification
  • Chapter 14.3: Improved 'Special_Array' example
  • Chapter 23: Typo fix
  • Chapter 26.6: Fix broken WebGPU example link
  • Appendix D: Fix compilation error
Version 1.6
  • New section 17.5 called "Breaking cyclic dependencies using callbacks", about how to use callbacks to work around situations where you'd need a cyclic dependency and how to create rudimentary interfaces.
  • Chapter 13.1.2: Updated the tracking allocator examples based on recent changes to how the handling of bad frees work.
  • A new section 18.6 called "More complicated build setups". A short section about writing bigger custom build scripts.
  • A new section 26.10 called "Code generation": It just says what code generation is and links to an example.
  • Appendix D: Removed some unnecessary things from the the Raylib + Box2D sample and made it a bit clearer.
  • Added an icon to the HTML version, so it's easier to find the tab.
  • Chapter 23.3: Made it clearer that you don't need to avoid dynamic literals, but you need to understand that they allocate memory.
  • Chapter 6.3: Typo fix
  • Chapter 8.1.3: Fix incorrect direction of the vector from_1_to_2
  • Chapter 8.1.4: Consistent use of procedure name draw_image instead of sometimes using draw_texture.
  • Chapter 12.1: Typo fix
  • Chapter 23.1: Minor rephrasing for clarity
Version 1.5

I have read the whole book, essentially doing an extra editing pass. I've made a huge amount of changes that make the text clearer. Here are some of the bigger changes:

  • Clarification about the size of My_Union in 5.3
  • Use the words "member" and "value" when talking about enums. Previously I used "enum value" and "value". The old wording was confusing and ambiguous.
  • Renamed chapter 26 to "A few more things..." and edited the content a bit.
  • Mention #load in chapter 26
  • Mention @rodata in chapter 26
  • A section about "Making libraries compile cleanly" in chapter 26
  • New section 7.8 (@init and @fini)
  • Section 4.3 (Loops) has been improved.
  • Section 6.3 (A pointer to a struct) is now more pedagogical.
  • Section 10.3 (Custom iterators) has been improved.
  • New section 11.5.1 (Deallocating strings that are mixed with string constants)
  • Section 12.6 (context.user_ptr and context.user_index) has a new example.
  • Fix for illustration in 2.6 having a minor error.
  • Move dynamic literals to chapter 23 (Things in Odin to avoid) since they are disabled by default, for a good reason.
  • Chapter 18: Nuance about "not needing a build system" and what I actually mean when I say "build system".
  • Made a few things in 6.5 clearer
  • Fix typos in 5.1.3, 5.2.1, 6.5, 10.2.1 reported by readers (thanks!)
  • Added version number to front.
  • Fix for YouTube links using wrong "external link" symbol in HTML version.
  • Link to CAT & ONION on itch.io (since it comes with Odin code).
  • Mention #reverse in "Chapter 4: Some additional basics"
Version 1.4
  • Regarding automatic passing as immutable references: Changed "sufficiently large" into "larger than 16 bytes". Recently, Odin changed the threshold to always be 16 bytes, regardless of platform.
  • Clarified side-bubble in 6.2 regarding how many bits of a pointer that are usually used.
  • Make it clearer what is meant by "procedure's stack memory" in 8.1.2.
  • Added a comment in 8.1.3 about what "stack allocated array" means and point out that a later chapter will show how to dynamically allocate fixed arrays.
  • Fix for EPUB issue where some of the appendices looked weird.
  • Minor typo fixes.
Version 1.3
  • Fix for EPUB issue where some of the appendices looked weird.
  • More nuance in 13.1.1 about cleaning up memory allocations at shutdown.
  • More nuance in 5.3.5 about using Odin for non-gamedev.
  • Clarifications in 3.2 regarding my sloppy use of the word "decimal".
  • Fixed level not being a pointer in 13.2 and added some info about why it needs to be a pointer.
  • Fixed an error in 8.1.1 where the index 20 was used instead of index 10.
  • Additional typo fixes.
Version 1.2
  • New section on Address Sanitizer in chapter 13.
  • Fixed 28 different typos and grammar issues based on a list that PythagoRascal sent me. Thanks!
  • Fixed indentation error in bit_set chapter.
  • Clarifications about using bit_set versus using a-set-that-is-a-map.
  • Section on Small_Array has has been improved for clarity.
  • Mentioned that Untyped Floats can be implicitly converted to integers if no truncation happens.
  • Clarification about how delete works.
  • Added a bubble that mentioned what @static on local variables does.
  • Additional typo fixes, some from people on my Discord. Thanks everyone!
Version 1.1 Released shortly after 1.0. Fixes a bunch of typos.

About the author

A picture of the author Karl Zylinski. He is standing among autumn leaves.

Karl Zylinski is an independent game developer and programming educator. He is the author of Understanding the Odin Programming Language, a book that teaches Odin in an approachable way. Karl is the creator of the video game CAT & ONION. It was the first commercial video game made in the Odin Programming Language. He also runs a YouTube channel where he shares educational material on Odin and game development.

In the past Karl has worked as a game engine programmer at Our Machinery, Bitsquid and Autodesk. He has also worked as a game programmer at Hazelight (A Way Out) and Friendly Foe (SOULBOUND).

Karl has a bachelor's degree in astrophysics. In his free time he likes to play video games, hike, go bouldering and play piano.

Visit his website and blog at zylinski.se.

Chat about Odin and game development on his Discord server.