HNHacker News
TopNewBestAskShowJobs

mabster

280 karma · joined October 25, 2021

submissionscomments
mabster··on Compressing a flag to 11 bits
Loved the title. I was like "that's 10 bits too many for a flag!" Haha
mabster··on Soup Raiders goes native: What you gain by building your own game engine
I'm out of the industry now, but I kept doing this for a while. I would want to "scratch an itch" and build a game out of hours. After a few attempts I realised I don't actually want to build a game, I want to build an engine
mabster··on Staging patches with git add (2024)
Ive got a tendency to modify many things as I go and break them into commits later. Generally I do git add -p until things are too interwoven. In that case, I've ended up with the following strategy:

git commit -m "WIP" & git revert HEAD & git revert HEAD & git reset HEAD^

Now I've got a copy of the changes as a commit and I'm my work tree. I widdle it down until its one change only. Then I do:

git commit -m "Bla" & git rebase -i HEAD~3 -X theirs

Them order Bla above WIP. I keep doing this "double revert" trick until the WIP no longer applies. Then done.

mabster··on Terence Tao's ChatGPT conversation about the Jacobian Conjecture counterexample
Engineering is very reliant on mathematics and as real world as it gets.
mabster··on Every Byte Matters
Ok fair enough. I don't write performance stuff in Java so I haven't even needed to look at this stuff to be honest. Most of the intrinsics I would want are there, except for any memory related stuff. I'm still not sure how structs are laid out in memory but I guess there's something for that too. My favourite thing in C++ is just loading a big binary blob and being able to point directly into it.

The only thing that was different was that we had a number of platform-specific intrinsics to really shake fast code out. E.g. shuffles on x86 on older SSE editions were terrible and we would have custom x86 code for shuffles or let memory out differently.

The only thing we use from C++ stdlib is unique_ptr. For everything else we had our own much more tailored, much faster, stuff. We had something like 10 different array containers for example.

Yeah what you described with templates is what we are doing re speculative optimisation. We have tuned versions for different workloads. We would inspect before we decide which one to run (only if that wasn't slower then just having one implementation, which was often the case because of instruction cache).

Something to be aware of is that on consoles mmapping a page to be executable was forbidden. So no JIT. And you aim for your slowest target so PC just follows that.

mabster··on Every Byte Matters
I'm a Java developer now, amongst other languages. The advantage of Java is that it takes A LOT less time to develop something, so there is the whole bang for buck for sure. I have had a few problems where I would love shared direct memory access and some atomics (because it would be a lot easier). But for the most part developing in Java is a lot quicker.

I don't think game developers are more conservative than any other developers. We do have large C++ codebases and so it's hard to change.

All modern engines have a few scripting languages tacked on too.

Something like Lua usually is the sweet spot: most of the people developing scripts are not developers. We even had a Java interpreter for scripting once, but it lost favor for this reason.

There were exceptions, but I found that developers generally preferred C# over Java anyway. Our assets pipelines are generally in C# already.

Any speculative optimisation we were doing by hand. There is the whole deferring allocations / moving allocations, both of which we were already doing (e.g. copying every frame).

A lot of our C++ code is intrinsics (including memory primitives like _mm_stream_ps and barriers) and you HAVE to have good control over how memory is laid out (e.g. knowing that data is split between cache lines so that you you don't get contention). Lots of spin locks too. I just don't see how you can do this kind of low level work in Java.

mabster··on Every Byte Matters
Low level CPU-related optimisation is absolutely still a thing. The GPU is always filled to the brim trying to get as much quality out of a graphics frame so a lot gets offloaded to the CPU. When I was doing this I was doing a lot of low-level CPU optimisation. GPU optimisation was usually more about transform process topology but there was plenty of low-level work to do there too.

Games are both high throughput AND low-latency and C++ is still king there

mabster··on Muxcard, a DIY credit card size computer
I did notice that difference too. But previous "credit card size" projects have all been several mm (as in couldn't fit a wallet designed for credit cards). So 1 mm is... pretty sweet!
mabster··on Muxcard, a DIY credit card size computer
I went to the page expecting to rant about how it's not actually credit card size because of the thickness and was for once pleasantly surprised! Kudos to the author! It looks great!
mabster··on Talking to strangers at the gym
That's pretty close to "be like Keanu Reeves"!
mabster··on The buns in McDonald's Japan's burger photos are all slightly askew
It's always the kitchen for me across food places (in Australia). Ending up with pickles when I removed them. Ending up with coke zero instead of coke. But the worst is ending up with anything mock meat!
mabster··on Rob Pike’s Rules of Programming (1989)
It's been mixed moving to normal code: I haven't had to low-level optimise for ages now (man I miss that). But performance in the O() sense has been the same.

Game engine development is very much about processing of data. The pipeline is long and the tree is wide. Being able to reason about complicated data processing topologies mapped very easily across.

mabster··on Rob Pike’s Rules of Programming (1989)
I haven't watched his videos on his language for ages, but this was a big thing he wanted in his language: being able to swap between array-of-structs and struct-of-array quickly and easily.
mabster··on Chuck Klosterman on why we've never actually seen a real football game
Unless LA stood for Latin America haha.
mabster··on Chuck Klosterman on why we've never actually seen a real football game
I guessed American when it was compared to Hockey, Baseball and Basketball.

In Melbourne, Australia, Football is again another sport (but it not being called Footy gives it a way).

mabster··on The chess bot on Delta Air Lines will destroy you (2024) [video]
I flew Scoot airlines recently and my 13” MacBook Air was too big to have on my lap even though the seat in front was not reclined.

There's also something about those seats where you get back pain when you try to sleep with your own seat reclined.

mabster··on The biggest CRT ever made: Sony's PVM-4300
Memories shattered. Yeah, you're right and I would have watched interlaced broadcast content.

I saw interlaced NTSC video in the digital days where the combing was much more obvious and always assumed it was only an NTSC thing!

mabster··on The biggest CRT ever made: Sony's PVM-4300
I'm guessing you're talking about interlacing?

I've never really experienced it because I've always watched PAL which doesn't have that.

But I would have thought it would be perceived as flashing at 60 Hz with a darker image?

mabster··on Control structures in programming languages: from goto to algebraic effects
You nailed it - that's my criticism :)

I've worked with a lot of code like this (particularly C libraries and litanies of return codes), and it's fine... But I prefer something like Java-style exceptions. And with Java lambdas or Kotlin the trend is unfortunately away from checked exceptions these days...

I too am interested in your other reasons!

mabster··on Control structures in programming languages: from goto to algebraic effects
I'm the opposite - I really like checked exceptions in Java because it's very easy to see how developers are handling errors and they also form part of the function signature.

Most functions will just pass on exceptions verbatim so it's better than error return values because with them the entire codebase has to be littered with error handling, compared to fewer try catch blocks.

setjmp, etc. are like unchecked exceptions, so I'm also not a fan, but I use this occasionally in C anyway.

mabster··on Analysis indicates that the universe’s expansion is not accelerating
I just pictured someone getting a message to check which model was right from an ancestor 20 giga generations ago!
mabster··on An overengineered solution to `sort | uniq -c` with 25x throughput (hist)
Or the timeline just doesn't have capacity for experimentation so the expectations are clear right from the start!
mabster··on An overengineered solution to `sort | uniq -c` with 25x throughput (hist)
In context most of the major optimisation work was on the engine. The game code can be and usually is slow but we do try to tame things in an O() sense.

I worked licensed titles for a while and that area the quality of a title and whether it sells were largely uncorrelated haha!

mabster··on An overengineered solution to `sort | uniq -c` with 25x throughput (hist)
I've written this kind of function so many times it's not funny. I usually want something that is fed from an iterator, removes duplicates, and yields values as soon as possible.
mabster··on An overengineered solution to `sort | uniq -c` with 25x throughput (hist)
We had similar thoughts about "premature optimisation" in the games industry. That is it's better to have prematurely optimised things than finding "everything is slow". But I guess in that context there are many many "inner-most loops" to optimise.
mabster··on PlayStation 3 Architecture (2021)
I can't remember the details because we coded the SPU in C, but the PS3 SPUs had odd and even cycles with different access properties too.
mabster··on I am a programmer, not a rubber-stamp that approves Copilot generated code
I worked with a developer that copied and pasted A LOT and would keep his fingers on the old copy and paste buttons (Ctrl-Ins, etc.). I've even seen him copy and paste single letters. He's one of the most productive developers I've ever worked with.
mabster··on Show HN: I've built a tiny hand-held keyboard
In my setup I use Colemak DH mod which loses the Vim arrows but I added a modifier where the 'a' key (left pinky on home row) when held down switches the right home row to arrow keys. Hasn't been an issue.
mabster··on A safe, non-owning C++ pointer class
We purposefully didn't use shared_ptr and hence weak_ptr. With these, it is all too easy to construct the "bad" version which has the stub reference count and pointer stored far away in memory from the object itself requiring a double dereference to access the object which is bad for cache performance. Instead we derived off a shareable class that has the reference count to make sure it is close in memory.

We were happy to use unique_ptr, however.

mabster··on Easy Forth (2015)
Was also gonna jump in with the old way of doing circle boundaries, which can be done all integer: https://en.m.wikipedia.org/wiki/Midpoint_circle_algorithm
Page 1 of 5Next →