October 22, 2024
A Bit of Work

I’ve been learning the Unity Job System, Burst Compiler, and Collections package. They all go together. You don’t need ECS to use Jobs, which is a fact I sort of missed initially. ECS is not that useful for the code I am working on. I am prematurely optimizing, but specifically for the sake of learning how to optimize.

But actually, first I am rewriting a large set of custom types. In fact, I am replacing them with—or rewriting them to rely on—types from the Mathematics package. I made a bunch of base vector types back in 2018. The vector types in the Mathematics package don’t replace all the functionality—lots of utilities and conveniences—so I have to rewrite all of that. And I have many composite types that use my vector types which have to be rewritten. This will make them all compatible with Burst, Jobs, and unmanaged code.

It’s a chore, but it’s fine. I’m good at chores. It will reduce the size of my codebase. And it gives me a chance to both refamiliarize, modernize—C# has changed—critique and maybe improve some of my code.

There are, however, some weird quirks about the Mathematics vector types. Like the equality operator (“==“) returns is not only component-wise, but returns vectors of booleans, instead of a single boolean. So you must use Equals(). I’m sure it’s fine, and Burst will optimize it down to the fastest thing. But it doesn’t read as nicely. Even using “==“ with two bool3's returns… a bool3.

In general, I feel more confident using Unity again, in terms of trusting the company, now that they turfed that idiot who was trying to exploit developers, and convince them to turn every game into a whale-hunting gambling meta-game. What a shithead.

Brought to you by PupperPost
   RSS | JSON