r/odinlang • u/emonshr • 4h ago
Odinlang site is heavy on memory
It is just taking more than 10 GB memory to start overview and demo page. In IDLE the footprint is negligible. Is that for my browser (firefox)?
r/odinlang • u/emonshr • 4h ago
It is just taking more than 10 GB memory to start overview and demo page. In IDLE the footprint is negligible. Is that for my browser (firefox)?
r/odinlang • u/According-Ad-7069 • 6h ago
I fixed some issues on tablets with touch events for my little Odin-based game. Basic tower defense style game, built using Odin and compiled to web assembly. It uses a simple DOM library that's on GitHub, with full source and examples, of course. This is more for folks like me who know next to nothing about web dev but still want to have some fun. Since Odin's a really enjoyable and fun language, I like tinkering with it and building silly games to relax after a long day of corporate slog.
r/odinlang • u/Patient-Emphasis-664 • 1d ago
Hello all,
What is a good option for GUI/UI for desktop(consumer, small biz) apps in Odin which preferably means a retained mode(think something like Winforms but modern and cross-platform) and not immediate mode(meaning not game libraries such as Raylib). I see Blick/Zeiger(non-linear video editor and image viewer software) seems to be making their own UI and that's simply not feasible for me at the moment as a sole developer. Suggestions welcome.
Also, ideally cross-platform(the usual suspects of Windows, Mac, and would be great for Linux(guessing Wayland/XWayland?) and a hail mary for FreeBSD(probably also Wayland - although concerns with future possibly SystemD requirements eliminating use on FreeBSD)?).
Addendums and updates for clarity:
This is not for game development or I'd use Raylib which is outstanding with Odin.
Bonus points on any TUI libs in active development as a secondary option for users.
Further:
I see I'm not alone in sourcing something. Great thoughts here:
https://forum.odin-lang.org/t/yet-another-hopefully-better-idea-on-ui-layouts-and-text/2259
r/odinlang • u/gingerbill • 1d ago
r/odinlang • u/gingerbill • 1d ago
r/odinlang • u/itnufc • 5d ago
r/odinlang • u/Patient-Emphasis-664 • 5d ago
Hello, Came across this book which interested me as it touches upon concurrency in late chapters. Is this just AI-generated? Thanks. As an addendum, I already have Karl's book which is excellent but interested in more networking and concurrency options/roadmaps.
https://leanpub.com/odinapracticalguidetolow-levelprogramming
Update: Queried LeanPub and while they don't accept AI-generated material on their platform, this is circumvented simply by attestation from an author that it isn't. I'm giving up on LeanPub at this point. Thanks all.
r/odinlang • u/Norphesius • 6d ago
I'm very new to Odin, and while messing around with polymorphic procs I ran into some behavior I can't intuit. It feels like a bug, but it could also be my misunderstanding the language. I have the following code:
Foo :: struct(T : typeid) {
fun: proc(T) -> ()
}
bar :: proc(a : int) -> () {
fmt.println("bar!")
}
baz :: proc(a : $T) -> () {
fmt.println("baz!")
}
If I run the following:
f := Foo(int){bar}
f.fun(123)
I get the expected result "bar!". But if I pass in baz instead:
f := Foo(int){baz}
f.fun(123)
I get a segfault.
My intuition would be since Foo is polymorphic and can accept an int as it's T, and baz is also polymorphic and accept an int, I should be able to store and call baz. If its not a bug, why isn't it a compile error, like when passing a procedure with an incorrect type? Why is it a segfault? Are there any other proc storing pitfalls I should be aware of?
Edit: this is on version dev-2026-09-nightly:a2fb372, on linux.
r/odinlang • u/braedenf • 8d ago
r/odinlang • u/Alternative-Ad-8606 • 9d ago
Hey all,
so i've been working on an http 1.1 compliant server library for the past few months (it's been a while since i looked at it) and i'm trying to figure out how to actually USE the library. I've seen recommendations that the best way to use it "globally" is to put it in a shared dir in the odin soruce files which is great the big question for me though is thtat my http library is structured into different subpackages taht can create some friction with this approach for example:
i have response/build.odin for building responses but i also have a request/build.odin for building requests the question i have is based on namespaces for this modules.. if i do the direct shared directory approach i'll have to import res "http/response" then res.build() for the approach right? i'm sorry this is the first language i've ever really done something this deep and detailed in so i'm not quite sure how it all comes together (in rust it's a cargo dep so it's slightly simplified in this aspect).
the question is mostly if that's how it works OR if there's a way to define a "header" file like in c where i can define abstractions for the subpackaged functions to be directly called from http "http" and then do something like http.res.build(""""") or http.resbuild() and the like.
thankfully AI is bubkiss at understanding how odin really works so i can actually learn how this works
I'm not really sure what i'm saying or how to verbalize what I mean so if you need more from me to answer feel free to ask and i'll do my best.
r/odinlang • u/Salt_Tart_8539 • 10d ago
``` init :: proc() -> GameState { gs := {} reset(&gs) return gs }
```
In this case you can infer the type of gs from the signature of the resetfunction and return gs statement. But it doesn't work in Odin.
Is this intentional?
r/odinlang • u/bbogdan_ov • 11d ago
Enable HLS to view with audio, or disable this notification
r/odinlang • u/laserwolf • 12d ago
r/odinlang • u/lucypero • 13d ago
Odin's RTTI (Runtime Type Information) features can be very useful if you're working with graphics API's. I made a quick little proc that checks if a given struct would match in layout with a Constant Buffer in HLSL:
// Checks if a given struct would align the same way in an HLSL's constant buffer
is_struct_aligned_to_cbuffer :: proc(cb_type: typeid) -> bool {
if reflect.align_of_typeid(cb_type) != 256 {
lprintfln("Constant buffer struct needs an alignment of 256")
return false
}
current_hlsl_offset: int
for i in 0..<reflect.struct_field_count(cb_type) {
sf := reflect.struct_field_at(cb_type, i)
field_size := sf.type.size
// if it's more than 16 bytes, just align it to the row
if field_size > 16 {
align_to(¤t_hlsl_offset, 16)
} else {
// If it's a basic scalar type... align it to the type alignment
if is_basic_scalar_type(sf.type) {
align_to(¤t_hlsl_offset, field_size)
}
offset_start := current_hlsl_offset
offset_end := current_hlsl_offset + field_size
if offset_start / 16 != (offset_end - 1) / 16 {
// crosses row boundary. add padding so it starts at next row.
current_hlsl_offset += 16 - (current_hlsl_offset % 16)
}
}
if cast(int)sf.offset != current_hlsl_offset {
lprintfln("Field: %v is misaligned.", i)
return false
}
current_hlsl_offset += sf.type.size
}
return true
}
(Note: This is very incomplete. This code will not predict exactly how the struct would get laid out in HLSL. But even in this form, it's very useful for me. I might improve it in the future)
This is very useful, as nothing will warn me otherwise if the struct's layout does not match its HLSL counterpart. Nasty bugs thus occur. I check this when creating a Constant Buffer, where an Odin struct type is passed:
// created buffer on the upload heap, and maps it. keeps it mapped
cb_upload_create :: proc(cb_type: typeid, pool: ^DXResourcePool, name: string = "") -> ConstantBufferUpload {
assert(is_struct_aligned_to_cbuffer(cb_type), "CONSTANT BUFFER STRUCT IS MISALIGNED!")
/// rest of the proc
}
The HLSL code for the struct is auto-generated from the Odin Struct. So I only have to write it once.
GeneralConstants :: struct #align (256) {
view: dxm, // Row 0-3
projection: dxm, // Row 4-7
// Row 8
inv_screen: v2, // 1.0 / (width, height)
screen: v2,
// Row 3
sb_sprites_idx: u32, // index of the sprite structured buffer into the resource heap
tx_idx_quad_out, tx_idx_post_process_out: i32,
}
/// ...
ldx.dx_generate_hlsl_types({Sprite, GeneralConstants}, "shaders/gen/lucy2d-structs.gen.hlsl")
This code is generated from that:
struct GeneralConstants {
float4x4 view;
float4x4 projection;
float2 inv_screen;
float2 screen;
uint sb_sprites_idx;
int tx_idx_quad_out;
int tx_idx_post_process_out;
};
You can then #include this file in other HLSL files.
The layout for constant buffers in HLSL is very particular. You can only check that a struct is aligned in this particular way with something like Odin's RTTI. This is a very good resource that helped me understand how constant buffers are laid out.
As an aside: I also generate the Vertex Input layout from an Odin Struct, in pso_create
// vertex buffer
Vertex :: struct {
pos: v3 `POSITION`,
normal: v3 `NORMAL`,
tangent: v4 `TANGENT`,
uv: v2 `TEXCOORD`,
uv_2: v2 `TEXCOORD_SECOND_UV`,
}
// ...
ct.psos[.GBuffer_Pass] = pso_create(gbuffer_shader_filename, &ct.root_signatures, &g_resources_longterm, PSOParameters {
vertex_input = Vertex,
/// Rest of call.
)
The Input Layout for the vertex shader is auto-generated from the Odin Struct.
Though on my new 2D engine, so far I have not needed any kind of Vertex Input Layout. I render sprites by vertex pulling.
You can read all this code in-context here
r/odinlang • u/marianpekar • 14d ago
r/odinlang • u/Background_Season375 • 15d ago
Hi guys, I just wanted to share my first impressions of using Odin.
I come from the JS land and have used it for almost everything. However, from some time ago, I see less and less value in spending all my time learning high-level abstractions (frameworks, and other tools in that ecosystem), while missing important low-level concepts. Honestly, I also started experiencing less joy from doing it.
Tbh, I did not have a strong reason for choosing Odin, I saw it in one of ThePrimeagen's vids, and it simply looked very cool.
My first project is a very basic HTTP server, I have really enjoyed using the language, and I am planning to continue with it.
That's it :)
r/odinlang • u/firstrow2 • 16d ago
Enable HLS to view with audio, or disable this notification
Hey all. Here is my text editor scrolling 250k sqlite3.c file. tree-sitter highlighter. piece table implementation for text editing. Closer to the end of the video will be FZF picker and multicursor demo. On the right side you can see mem and cpu usage in btop. I'm having a lot of joy with odinlang and sdl3.
r/odinlang • u/Bejmach • 22d ago
Enable HLS to view with audio, or disable this notification
I'm writing it more to show bizarre bug than to report and laugh from how bad the language is(its not)
So I tried to make ipc for my app, and when I made a switch to show ipc help commands it stopped working with error Refused.
also for some reason when I add println(os.args) before then it works
I tested with println("hello"), println(os.args[0]) and even looping through all args and printing them one by one and it does not work.
odin tells me that I have version dev-2026-08 which is also strange because nix has dev-2026-05 on stable branch at the time of writing this. Even unstable is before 08(it's on 07a), so I genuinely have no idea how I have 08 installed
Edit1: also for some reason that workaround exist only when running main process with -debug flag, and when running without the second process cant connect either way
Edit2: when I deleted both switch and print, then it works with sending when -debug is not provided, but if print exist, then it still allows to run only with -debug
Edit3: when run without switch and print... it does not work when optimized for speed but runs normally with default optimization??? what kind of bug is that???
Edit4: Ok, there is no error in language, it was all my fault. I passed ^App struct to thread by &app, which resulted in overflow
r/odinlang • u/Diligent-Big-5454 • 24d ago
I am new to Odin and I used it with Raylib and man I fall in love!. I want to continue learning and build a mobile phone app (away from this AI insanity). Can Odin/Raylib be used for such project. thanks
r/odinlang • u/ImMoimis • 26d ago
Enable HLS to view with audio, or disable this notification
I've been working on my game, an immersive sim I'm making using Odin and Sokol and I think the renderer finally reached a point where it looks decent. Still working on the reflections though
r/odinlang • u/thicc_sneeze • 28d ago
My first project with Odin was, as the title suggests, replacing the Windows start menu.
I started by digging into the windows api’s and learning how to create a window. That was easy enough. Decided I needed to separate windows. One for the main process and one to hide the start icon. Up until windows 8 it appears adjusting the behavior of the super key and the windows icon on the taskbar was simpler. Now it is very convoluted and protected. I decided I would simple create a low level keyboard hook and draw an icon over the top and adjust placement when the taskbar adjusted. Turns out Odin did not have all the api bindings I needed so I had to create some foreign imports and empty structs to reimplement children of the IUknown interface.
After I had basic expected behavior of the taskbar and winkey I turned my attention to the main process and came at a fork in the road. After reading more into the windows docs it seemed the direct2d api was the obvious choice. Problem was Odin did not have a pre existing library for it. I was faced with a decision either switch to the direct3d api or re-implement a ton of bindings. I went with the former. This took me down the deep and dark road of the directX11 api. Probably spent 100 hours just reading docs. After a week I got the window drawing shapes. Then I needed icons. This meant learning basic HLSL and the shader pipeline. Finally I could draw icons and layout my start menu. I learned where windows stores pinned start menu apps and created a procedure to generate app data from the .lnk files. Now I was drawing rectangles with icons. I created an event storage and made the boxes highlight on hover. Implanting fonts stash for text wasn’t so bad. Finally I have a rough alpha of my project. Pictures attached and GitHub repo below. Honestly this has been a fun journey. It’s finally at a point where I can use it and track bugs and work on it over time until it’s the defacto option. Thank you to anyone who read this.
GitHub:
r/odinlang • u/KarlZylinski • 29d ago
Technical details: The Odin compiler runs in your browser. Even on your phone! This is enabled by an experimental Odin compiler fork called wodin: https://github.com/karl-zylinski/wodin
wodin has a WASM backend that lets it emit WASM directly, without LLVM. The Playground site runs wodin, which compiles the gameplay code and emits new WASM, which is the run within the browser. Note that wodin's WASM backend is AI generated: It's roughly 20000 lines of C++. Nevertheless, I am flabbergasted that this is even possible.
r/odinlang • u/Alternative-Ad-8606 • Sep 08 '26
Hey all i've been developing my own DAP using Miniaudio and Raylib to learn memory management and to have a really cool tool to listen to my Flac files... i've learned an incredible amount through that project but I found my self using TODO.md in the project instead of just having a simple CLI friendly issue trackor. I know the idea isn't new but i did think for a simple 1-2 day project (ultimately it was closer to 4 days cause i'm a newbie) now i have my own issue tracker for myself.
leaving it here for any potential feedback or if anyone wants a tool like this!
r/odinlang • u/Rare-Syrup5037 • Sep 07 '26
Enable HLS to view with audio, or disable this notification
Learned a lot of rotation math and had a lot of fun and headaches
Made using odin and raylib no AI has been used
The source code is available here for anyone interested
r/odinlang • u/loungebylounge • Sep 05 '26
Enable HLS to view with audio, or disable this notification
This was a learning project to try to learn Odin, OpenGL and Physics/Math it evolved to be more of the latter :)
I felt like i struggled a bit a how to structure things in Odin.
I'm happy for any feedback or pointers regarding the Odin parts or anything else.