mastodon.gamedev.place is one of the many independent Mastodon servers you can use to participate in the fediverse.
Mastodon server focused on game development and related topics.

Server stats:

5.3K
active users

mrgaturus

NPainter will not be written in Nim anymore, i will rewrite Nim parts of the program in C and use Haxe HashLink for user interface programming.

This plan looks quite strange but it will make life easier and make it has a future-proof development, also Haxe aligns with the gui toolkit paradigm that could not be fully implemented due some Nim design flaws

@mrgaturus huh! this kinda reminds of the thing AzPainter did with its own mlk gui toolkit

it seems like that worked really well for azel!

good luck with the rewrite~ ^^

@archenoth i pushed Nim to it's limits, aside the ui/ux is now messy due some Nim design flaws i'm also getting so much slow compile times 😭 .

i've looking Haxe in the real world for some time and it's very amazing, the runtime idea for ui/ux was inspired by how Blender is made having the logic and gui toolkit written in C/C++ but the ui/ux written in Python. Haxe HashLink VM is very small that fits my needs for still having a tiny binary

@mrgaturus @archenoth Is there a Nim forum post about the problems you had with nim your UI, and possible design flaws. I would like to read it if so. Slow compile time is a known issue and being worked on, but compiling with clang is significantly faster than gcc IME.

@ITwrx first, this now make a lot sense for me: news.ycombinator.com/item?id=3

Now my opinions
- NPainter is now a huge project (110 nogui files, 123 npainter files), 60% is now written in C to overcoming Nim limitations and annoyances
- upcoming nimony/nim 3 is going to break many unsafe tricks which are super important for both nogui and npainter so it could be semi rewrite but adding more safe boilerplate everywhere and the new macro system could lack macrocache variables

news.ycombinator.comI started programming in Nim around 2015 and still write code in it from time to... | Hacker News

@ITwrx
- I have huge plans for Android/iPad in a future and Nim doesn't support those platforms, I'm having some issues with Clang (bucket fill crashes in clang but not gcc and the culprit is nim)

The most important
- I'm now needing true object oriented programming for UI/UX programming, my macros tries simulate it, they are so hacky that in big scale it's starting being super annoying

NPainter is now stuck if there is not another nogui overhaul and it's the perfect opportunity to ditch Nim

@mrgaturus There is some support for mobile, but Nim doesn't compile to Java. I don't need/want OO, myself.

@ITwrx i will not use Haxe Java, the Haxe HashLink runtime is written in C that can also be compiled for NDK and iOS/iPad OS

@ITwrx @mrgaturus ooh! fun fact! while android apps aaaare typically written with java or kotlin for their actual user-facing stuff, you can actually just have 99% of your code be in a language that complies to an ELF for the architecture of the phones you wanna support!

that's why you can run most nongraphical aarch64 statically linked linux binaries (for example, a lot of things written in go!) on android phones without needing to modify them if you have access to a terminal

that means npainter doesn't need to be totally rewritten in another language for an android port--just a frontend would~

@archenoth @ITwrx The program will have the same code for all platforms, i just need add native platform support to my gui toolkit (maybe a SDL3 backend for Android/iOS).

The problem was Nim which it's runtime seems to be very incompatible with mobile (imagine issues of GLib).

Also for mobile i'm thinking for a home frontend to properly manage drawings, permissions and have integration with Google Drive without doing that in C/C++.
You can embed a SDL3 application in a Android/iOS component

@mrgaturus I would be curious to know what limitations and annoyances caused the rewrite to C, but if you're too busy, it's no big deal. I'm looking forward to Nimony/Nim 3 to address my main issues with Nim, and i don't expect much/any compatibility/breakage issues with my projects' code.

@ITwrx the code written in C as today is due:
- SIMD code is not good in Nim, the generated C code may break unrolling momentum and confuse the optimizer due massive usage of redundant temporals
- Pixel processing is a lot better with pointer arithmetic
- Nim always assumes every to float and int so it doesn't respect small types like int16, int32, so you need explicit conversions even for a 0 int literal
- X11 and Win32 bindings are awful so the usage is written in C and exported to Nim

@ITwrx sadly no but treeform and guzba stuff convinced me to use Nim. I can't deny Nim played a huge role for the project being the incubator and also made me gain many programming skills

@mrgaturus I've also learned a lot from my usage of Nim. Moving from mostly interpreted to compiled, loose vs strict typing, trying all the Nim web frameworks and ultimately ending up re-implementing Laravel/higher level features myself with Guildenstern + Sqliteral/sqlite. Making some desktop linux apps with gintro and owlkettle. I really like Nim's syntax and readability and my code is shorter and better organized than before, as well as less buggy overall. I'm also happy with the small ram and cpu usage, and binary size.

@ITwrx i wrote my own libraries from scratch and almost to ditch nimble and use nim command directly (but i ended up ditching nim 😅 )
if you want you can check out how was my gui tookit in nim, the test folder includes some examples and npainter was the big cake.
the final thing i did for Nim was green threads coroutines with an easy usage (check test/tasync_coro.nim)

github.com/mrgaturus/nogui

@mrgaturus looking forward to the next version :)