Ethan Moffat

Hello there!

  • I’m a software engineer out of the Seattle area. On this site you’ll find links to my public presence on the internet, a portfolio of various projects I’ve worked on, a collection of random thoughts I’ve had, and general info about me.

Optimizing texture data processing in Monogame

At the end of my post on C# garbage collection profiling I noted one additional problem generating a ton of garbage in EndlessClient: hovering the mouse over NPCs. In EndlessClient, a mouseover action on an NPC should show the NPC’s name if there is a visible pixel under the mouse pointer OR there are no visible pixels on the texture (in the case of invisible NPCs). The way we check the value of a pixel in Monogame is via the GetData method on a texture, by getting the pixel value at the exact coordinate of the mouse, projected onto the NPC texture as rendered to the NPC render target....

June 2, 2023 · 6 min · Ethan Moffat

Reducing data copies in C# with Span<T> and pointers

Coming immediately off the heels of C# garbage collection profiling, I wanted to dive a little deeper into performance optimizations I made in the image loading routines for EndlessClient. The need for this performance improvement originated from two things - a desire to reduce the number of data copies when loading images, and a genuine need to reduce the number of garbage collections EndlessClient was triggering. EndlessClient and PE files EndlessClient is developed using Monogame....

June 1, 2023 · 12 min · Ethan Moffat

Optimizing dotnet GC performance

Happy Pride Month! 🏳️‍🌈 I recently spent a good deal of time diving into the garbage collector in my project EndlessClient. After making a change for resizing the game window dynamically and retooling the UI to be responsive, I noticed during debugging sessions that there were a boatload of GC events showing up. This was having a negative impact on performance as well as making it hard to spot actual issues in the performance analysis tools that run in Visual Studio by default....

June 1, 2023 · 10 min · Ethan Moffat

Multi-key lookups in C#

A common problem in EndlessClient occurs when trying to look up an entity. When rendering the entity, the rendering pipeline wants to know its X/Y coordinates on the map. When the packet protocol is signaling that the entity has performed an action, we want to find this entity by its unique ID. Unfortunately, C# doesn’t provide a data structure out of the box that provides quick lookup times by either key....

May 31, 2023 · 9 min · Ethan Moffat

Estimating software projects

Estimation in software is a topic that is covered ad nauseam on the internet. There are no shortage of people giving their opinions on how to make good estimates. There are also no shortage of consulting companies trying to sell you services to help you with this admittedly difficult topic. Since I’m rather passionate about project management and Scrum principles (which are often misunderstood or poorly implemented), I figured it was time to start dropping opinions on how to do estimation properly....

February 24, 2023 · 12 min · Ethan Moffat

git 101: Basic Workflow

I always find it easiest to learn new concepts when I can actually do something interactively to help me learn them. This next part of the git 101 series will introduce setting up a local workspace, connecting with GitHub, making your first commit, and pushing it to the remote repository. Prerequisite: Create a GitHub Account Github has become the de facto standard for hosting open-source on the internet. I will leave whether that is a good thing up to the reader to decide....

February 23, 2023 · 7 min · Ethan Moffat

git 101: About Source Control

Source control is an incredible technology. It’s like having an undo/redo stack, but for an entire project. It allows you to sensibly branch/merge code, track changes you’ve made, and refer to old versions of code. It might be the single most important and useful development tool in a developer’s toolbox. One such tool, git, has become the de facto standard for source control among developers. Other solutions such as svn (subversion) and hg (mercurial) have use in the industry, but their market share pales in comparison to the sheer volume of developers using and familiar with git for their projects....

February 17, 2023 · 5 min · Ethan Moffat

Dependencies in a Microservices Architecture

If you’ve been around the software community, you’re probably aware of the microservice architectural pattern that has become prevalent in the industry. Every team with a monolithic architecture suddenly wants to migrate to a microservices pattern. There are a few good reasons for this: It allows for teams to independently develop and version components of the system Deployments of individual components don’t impact the entire system Parts of the system that have a heavier load can be scaled independently of the rest of the system A single component going down (theoretically) doesn’t bring down your whole system That final point is what I want to focus on....

February 10, 2023 · 5 min · Ethan Moffat