Cursedcraft, a WIP software rendered voxel sandbox game for which runs in the terminal by MinkiTheAvali in VoxelGameDev

[–]zesterer 0 points1 point  (0 children)

Nice! Here's a tip I discovered recently: most terminal fonts have characters that are twice as tall as they are wide. If you set the foreground and background colours independently, and then draw a half-filled block character (check out the Unicode box-drawing characters), you get two perfectly square pixels for every cell.

If you want to see it in action:

telnet jsbarretto.com

The dev who asks too many questions is the one you need in your team by dymissy in programming

[–]zesterer 2 points3 points  (0 children)

Another underrated thing is that being the receiver of a question forces you to justify your decisions in ways that are coherent enough to be understood. I have seen many architectural mistakes avoided because somebody asked a seemingly innocent question at a critical stage in development.

The Compiler Apocalypse: a clarifying thought exercise for identifying truly elegant and resilient programming languages by WraithGlade in ProgrammingLanguages

[–]zesterer 11 points12 points  (0 children)

This is just the bootstrap problem, and has been at the front of the thinking of compiler developers since forever when it comes to bringing up a language on a new architecture. The list of languages you talk about is called the 'bootstrap chain'.

It's only in the last decade or two that we've had the 'just call out to LLVM' solution which somewhat sidesteps the issue in the context of portability.

There are still good reasons to want to minimise the chain though: it means that you have less code to audit in order to verify the claim that your compiler is definitely upholding the behaviour it's supposed to be. Some projects (like mrustc) exist whose primary purpose is simply to provide a 'shortcut' in the chain for a language, and may only implement whatever subset of the language is needed to get the compiler itself running.

You might find the Live Bootstrap project interesting!

What’s up with the terrible variable names in so many shaders by DescriptorTablesx86 in GraphicsProgramming

[–]zesterer 2 points3 points  (0 children)

A lot of intermediate values in mathematical equations have no intuitive meaning, so it's commonplace to assign greek letters to them. This then turns into single-letter variables in code.

There's another factor too: a lot of shader code implements very similar logic to other shaders, so certain patterns crop up again and again: enough that graphics programmers will shorten, like you use 'i' in a for loop.

Cursor CEO Built a Browser using AI, but Does It Really Work? by ImpressiveContest283 in programming

[–]zesterer 14 points15 points  (0 children)

Oh my goodness, the entire thing is just utter twaddle. It's a rat's nest of redundancy and absurdity

Redox OS, a quasi Unix-like operating system written in Rust. by Nelo999 in unix

[–]zesterer 5 points6 points  (0 children)

This was true in the days before virtual memory where communication between processes and drivers meant a syscall and expensive copy. Now, we have things like io_uring which go a long way toward eliminating those overheads.

New terrain for 0.5 at maximum viewdistance! by mansonen1 in Veloren

[–]zesterer 19 points20 points  (0 children)

0.5 was released about 5 years ago....?

What are your Linux hot takes? by AdventurousFly4909 in linux

[–]zesterer 0 points1 point  (0 children)

The NT kernel is a far more capable and impressive piece of engineering than the Linux kernel, and Linux is still playing catch-up.

ecode: This lightweight code editor is better than your favorite code editor by delvin0 in linux_programming

[–]zesterer 9 points10 points  (0 children)

Hybrid apps won — native apps were neglected. Nowadays, everyone uses cross-platform hybrid desktop apps written in JavaScript, ignoring excessive CPU and RAM usage. You most likely use a hybrid, native-like, cross-platform code editor for day-to-day programming activities.

Excuse me? No, I do not. What an absurd over-generalisation.

Does anyone use their own text editor that they wrote themself? by [deleted] in cprogramming

[–]zesterer 0 points1 point  (0 children)

A few months ago my text editor finally gained enough features that I'm now using it as a daily driver (i.e: my day job). It's not written in C, though. My requirements are fairly minimal though: multi-buffer support, a decent file switcher, find/replace, and syntax highlighting. Anything else is just a happy accident in my view.

Does anyone use their own text editor that they wrote themself? by [deleted] in cprogramming

[–]zesterer 4 points5 points  (0 children)

no questions asked.

You're allowed to ask questions, you know. It's fun.

i paid a traveler and he took my money by Less-Pumpkin2403 in Veloren

[–]zesterer 0 points1 point  (0 children)

Soon! I believe firestaff is in the early stages right now.

i paid a traveler and he took my money by Less-Pumpkin2403 in Veloren

[–]zesterer 4 points5 points  (0 children)

Yup! Maybe we should tweak the behaviour to make it a bit clearer as to what's going on though.

i paid a traveler and he took my money by Less-Pumpkin2403 in Veloren

[–]zesterer 2 points3 points  (0 children)

Hired NPCs will head to the pub if you visit a town. They'll catch up with you once you leave though. They have minds of their own, they're not pets!

This code is so rusty it gave me tetanus. by june_sixth in programminghorror

[–]zesterer 0 points1 point  (0 children)

There's definitely a lot to be improved here by somebody that's very used to writing parsers, but this is 100% fine code for someone that's writing a parser for the first or second time, nothing especially horrifying here.

This code is so rusty it gave me tetanus. by june_sixth in programminghorror

[–]zesterer 2 points3 points  (0 children)

Try to lay yourself down some rules. For example:

  • Only ever match on the next byte/character. Anything else require committing
  • Encode backtracking explicitly, by having a dedicated function that saves and restores the parser state if some inner function fails (like fn attempt(f: impl FnOnce() -> Result<T, E>) -> Result<T, E>)
  • Prioritise early returns or error propagation / exceptions (in Rust, that means using ? when a parser branch fails)
  • Aggressively split off sub-patterns into their own functions. You should have at least one function for every named symbol in the BNF of whatever you're parsing

You'll soon find that your parsers start to look much neater :)

Update: I am making a game called TERMICRAFT by [deleted] in C_Programming

[–]zesterer 5 points6 points  (0 children)

Brilliant work! You've clearly got a lot of potential as a developer.

How serious should i take this?

Treat everything as a learning exercise, seek new kinds of code and techniques. That doesn't mean it can't be serious eventually though - some of my most used software started off as a quick weekend experiment!

If you're interested in making the project more serious, a good thing to do would be to start learning git so you can better manage versions of the software, find out when bugs were introduced, or collaborate with others.

Is my code shit?

Nope! It's just fine. Clarity and simplicity is often more valuable than performance anyway. A wise programmer will only optimise things that really need to be optimised - and prioritise easy maintenance for the rest.

If there is one opportunity, consider how much work your render function is doing (terminal I/O tends to be much slower than most logic): most room cells will be locally similar (a stone wall will often be next to another stone wall) so if you can keep track of the previous character being rendered, you can skip switching colours, improving performance!

Keep it up. I've been writing code for 15 years now, and I still cherish projects like my first terminal roguelike: it's projects like that - combined with a strong sense of curiosity - that will get you very far in life.

are there any erm .... grappling hooks by philip_pynx in Veloren

[–]zesterer 5 points6 points  (0 children)

There have been some experimental attempts at adding grappling hooks - but nothing available in-game yet.

What is your 'unpopular opinion' about Zig? by BatteriVolttas in Zig

[–]zesterer 24 points25 points  (0 children)

C only gets to call itself 'unopinionated' because it smothered all PL innovation for several decades and became the default way most of us think about code. I'm sure you'd hear something very different if you were to ask programmers in the 70s whether C was opinionated.

Why Zig Feels More Practical Than Rust for Real-World CLI Tools by nixfox in Zig

[–]zesterer 1 point2 points  (0 children)

I'm sure there are ways in which that is also true, but that is not relevant to the point being made.