Happy New Years

Hello. It’s been quite a while since i posted something here. In that time, I haven’t progressed very far with Unity’s ECS from the last post, mainly because Unity hasn’t majorly updated it till last month (December 2019). So at some point, I’ll have to update the systems and redo the bullet initializations. Once again, sorry for not posting anything, but there just hasn’t been too many interesting things lately that I can show off.

Happy New Years!

January Post

I uploaded Unity ECS Test 4 and 5 to Vimeo

There are a lot of changes since I uploaded the last Test Video (Number 3) back in November 2018.

-Added enemy waves support with their own bullet patterns
-Added Healh, Bomb, and Score prototype UIs
-Added SubEmitters for bullets
-Added Player Functionality (Movement, Shooting, Grazing, etc)
-Added basic Collision checks.
-Added basic Projectile damage and bomb clearing.

I’m pretty happy with how this turned out. Now the next issue on hand is to create a full blown level as a true prototype test. And I will probably 3d model better assets for the system too.

Early December Post

Surprise!  Hehe.

I actually don’t have much to update yet for the Bullet System Editor, because I’m still stuck on an issue (getting a specific amount of bullets and spawning more bullets on them), but when I figure it out, I’ll post more example videos.

On the flipside, I went through my flashdrives and almost forgot about this Unity project I made in the last months of my college senior year (June 2018).

It’s a Frames Per Second Test and Audio Visualizer demo made in Unity.  So Unity is not only about making games, but also showing off wacky or innovative concepts ^^


I think I will eventually make another blog post with regards to Bullet Hell/ Schmup concepts and talk about how I decided to go about making my BH system in Unity ECS.

But yea.  Have a good day!

Test 3

Somewhat short blog post with video.  I’m running into a development/scalability issue where I’m generating pretty much variations of the same pattern.  It’s…frustrating, to say the least, when my visual editor has to be updated to include all these variations.


Anyways, here is a 2D demonstration of my 3D system.  Extremely pleasing flowery patterns


Unity ECS BH System Test 2

Hi, it’s Kevin Wu

Just posting another progress video for the BH system.

Since the last video, there are a few more changes (although not demonstrated in this particular video):

  • -Improved Editor UI/functionality (now, it uses a Reorderable List for a user friendly interface)
  • -More patterns (Cylinder shaped, Cube/Rectangle, Star Shaped, Icosphere, Random Emitter)
  • -Experimental Procedural Patterns (As in, instead of emitting one full pattern in a single frame, the entity emits the pattern over a certain amount of seconds)

I’m still working on the experimental procedural patterns.  An example of what I mean by this can by seen here:

(timestamp at 1:30 if the video plays at the beginning).

At the time of this particular prototype (Dec. 2017), I was generating star shaped patterns through Unity’s Coroutines.  This let me “wait” between each spawn of a bullet, and it looked pretty good.

In Unity’s ECS API (or at least in the Job System), there is no concept of “waiting” in a job.  You send data to a job, and it executes and processes the data in conjunction with other jobs.  I can’t stop it nor stagger its execution.

To get around this, I appended two private variables to each BP entity to keep track of the spawning intervals and made a new function for each Bullet Pattern to spawn X amount of bullets only based on that current interval.

I guess that sounds kind of confusing, but basically, I stagger the spawning of bullets outside the jobs, and in a job, I spawn only 1 or two bullets.  This does mean that it takes many jobs to complete even one pattern over time.  In return, though,  I get massive performance increase because I’m not spawning like 4000 bullets in a single frame.


Unity ECS Bullet System Video Test 1

After another few weeks (and new changes to the ECS preview API), I finally got to a good point where I could upload a preview video of this converted BH system


It demonstrates test patterns, bullet movements, and target effect.

My next plan is to improve the spawning of the bullets.  ECS is great for managing entities that have already been instantiated and not so much when you spawn a couple of thousand new entities in a single frame.

In my OOP version, I had used object pooling to reduce the performance cost of “creating” bullets.  This means that all I had to do was “cheat” and not really instantiate bullets, but use previous and premade bullets and change their speeds and directions.  But in ECS, there is no concept of object pooling, so I had been creating entities literally at each execution and setting their values there.  As you can see, I suffer 5-7 frames everytime I spawn around 1600 entities, and this gets worse as I tried spawning 5000 in one frame.

One of the things I am hoping for later in the future from Unity is the ability to Burst Compile the Entity Manager.  As of right now, the burst compiler doesn’t work with it, and my system heavily employs the Entity Manager in its bullet patterns creations.


Unity and ECS Integration

Hello all, it’s been a while since my previous blog post, which was mostly showcasing off my editor version of a bullet pattern system.

In those few months, I’ve updated my system to use a global bullet manager such that now all lifeTime logic and movement is not handled individually by every bullet.  And man, was this a large performance update for me.  Previously, I couldn’t get 4-5,000 bullets to move adequate without incurring some fps loss.  Now, I can get by with about a few frames loss at the initial spawning.  I’ve also improved the look of the editor and added text info. support for the various input fields.

I am now very satisfied with this implementation of my Bullet System Editor, which is OOP and MonoBehaviour centered.

In a way, this leads me to my next update and adventure/implementation: Unity’s Entity Component System, which comes as a preview package in Unity since Unity 2018.1

I first heard of ECS during the GDC 2018 back in March 2018.  I didn’t quite understand it then, but now in the summer, when I have more time now to pursue my passions, I was able to study and find out more about this concept.  For half of July 2018, I slogged through the 2D ECS samples to understand the logic behind the systems.

Unity’s GitHub Resources on ECS

Link to Unity ECS 1

Link to Unity ECS in Detail

Link to Unity ECS Game Samples

I recommend just giving a quick browse through these links to understand what ECS entails.

In a nutshell (or at least for me), ECS is a Data-Oriented-Design (DOD) principle of programming.  Entities (E) are just general objects (usually IDs) with associated Components (C) that contain data to be operated on in Systems (S).  ECS design is meant to break down a game into many components and systems and allow for scalability, flexibility, and runtime performance.  Because of how entities are laid out in computer memory (side by side for instance), one operation can operate on a single “array” of entities without having to go through several pointers to memory.

This was absolutely perfect for what I wanted to accomplish: massive amount of bullets with solid run time performance.  And I have to say, after two weeks of frustration, it’s finally coming along.

Screenshot (199)

Screenshot (169)

I am quite excited for Unity’s ECS and its future release to full production.  As of right now, there are a few inconveniences, such as no competent editor preview of the entities (I have to use the Entity Debugger, and as you can see, the components are greyed out, making it hard to see the values), and there is no physics integration yet.

But the future looks very bright for Unity.