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....

<span title='2023-06-02 16:30:00 -0700 PDT'>June 2, 2023</span>&nbsp;·&nbsp;6 min&nbsp;·&nbsp;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....

<span title='2023-06-01 21:15:00 -0700 PDT'>June 1, 2023</span>&nbsp;·&nbsp;12 min&nbsp;·&nbsp;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....

<span title='2023-06-01 11:34:40 -0700 PDT'>June 1, 2023</span>&nbsp;·&nbsp;10 min&nbsp;·&nbsp;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....

<span title='2023-05-31 10:30:00 -0700 PDT'>May 31, 2023</span>&nbsp;·&nbsp;9 min&nbsp;·&nbsp;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....

<span title='2023-02-24 19:56:00 -0800 PST'>February 24, 2023</span>&nbsp;·&nbsp;12 min&nbsp;·&nbsp;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....

<span title='2023-02-23 11:46:10 -0800 PST'>February 23, 2023</span>&nbsp;·&nbsp;7 min&nbsp;·&nbsp;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....

<span title='2023-02-17 14:16:10 -0800 PST'>February 17, 2023</span>&nbsp;·&nbsp;5 min&nbsp;·&nbsp;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....

<span title='2023-02-10 13:40:10 -0800 PST'>February 10, 2023</span>&nbsp;·&nbsp;5 min&nbsp;·&nbsp;Ethan Moffat