DOTS Snippets: Listening for new and destroyed entities

It's time for another DOTS Snippets! A common operation in games is tracking when something is created or destroyed such that we can execute some operations when they happen. Let's imagine a game example. Say we're making a 2D grid based city builder where each city object (house, building, or road) can be placed on … Continue reading DOTS Snippets: Listening for new and destroyed entities

Why job structs are better than Entities.ForEach()

I started dabbling with Unity's DOTS ever since it came out in 2018. I have used every evolution of its API from [Inject] to IJobForEach then to job structs (chunk iteration) and Entities.ForEach(). There's even a new one now, IJobEntity (haven't explored it yet). To me, job structs are the best. They're more verbose but … Continue reading Why job structs are better than Entities.ForEach()

DOTS Snippets: Using EntityCommandBuffer in parallel

I'm starting this new set short posts aside from my monthly thing where I show short DOTS code that does common things. We're currently making our current game using pure ECS. As such, we have developed some code patterns that we use frequently. I have a bunch of these snippets but I don't think they … Continue reading DOTS Snippets: Using EntityCommandBuffer in parallel

How we made our loading screen

We have adopted the same loading screen that we made in Academia: School Simulator to our new game City Hall Simulator. The cool thing about this loading screen is that it shows a progress bar which I think is a good UX feature so the player knows how much further along the game is going … Continue reading How we made our loading screen

BitArrayX and LinearHashMapX

Truthfully, I'm out of topics to write about so here's some more DOTS utilities that we've written that you can use. Both of these can be used inside an IComponentData struct and are Burst compatible. BitArrayX Booleans are quite wasteful when you have lots of them. Each one is represented as a single byte which … Continue reading BitArrayX and LinearHashMapX

The safest way to use DOTS in your MonoBehaviour project

Before I begin with the article, I would like to let you know I'm giving away a free game by subscribing to my mailing list. With that out of the way, let's get it on! The problem is that if you want to leverage the speed of Burst, you have to use a subset of … Continue reading The safest way to use DOTS in your MonoBehaviour project

Some DOTS Utilities: NativeCounter and NativeSum

I haven't shared some utility scripts for a while now. It's about time I do so again. We've been making a game in pure ECS and we have created lots of utilities along the way. Allow me to share to you NativeCounter and NativeSum. We are making a game called City Hall Simulator. It's a … Continue reading Some DOTS Utilities: NativeCounter and NativeSum

Agent actions as entities

If you follow this blog, you may know that we're currently working on a new simulation game but we're totally using pure ECS this time. We have just decided on the game name this week. We're calling it City Hall Simulator! I hope it's clear what the game entails from the game name alone. Prototype … Continue reading Agent actions as entities

About coming up with game code architecture

I ran into a Reddit thread in r/gamedev (can't find it anymore) about a teacher asking what topics are important but least talked about or have few resources so he can make instructional videos about them. Majority of the responses is about code architecture or how to structure code. This got me thinking "maybe I … Continue reading About coming up with game code architecture