Svelto Mini Examples: Doofuses Must Eat


The Quest for Maintainable Code and The Path to ECS


Svelto.ECS 2.7: what’s new and best practices


Learning Svelto Tasks by example: The million points on multiple CPU cores example [now with Unity Jobs System comparison]

Code Design

The Quest for Maintainable Code and The Path to ECS

Premise In this potentially controversial article, I will explain why I believe ECS is a great paradigm to write simpler to mantain (and therefore less expensive) code and I will also try to explore the idea to formalise best practices through the application of the SOLID principles, which at glance

The truth behind Inversion of Control – Part V – Entity Component System design to achieve true Inversion of Flow Control

note: Svelto.ECS is now production ready, so you can start to use it after finishing reading the articles. At this point, I can imagine someone wondering if I still recommend to use an IoC container. IoC containers are handy and are quite powerful with Unity Engine, but they are dangerous.

The truth behind Inversion of Control – Part IV – Dependency Inversion Principle

The Dependency Inversion Principle is part of the SOLID principles. If you want a formal definition of DIP, please read the articles written by Martin[1] and Schuchert[2]. We explained that, in order to invert the control of the flow, our specialized code must never call directly methods of more abstracted

The truth behind Inversion of Control – Part III – Entity Component System Design

In the previous article I explained what the Inversion of Control principle is, then I introduced the concept of Inversion of Flow control. In this article I will illustrate how to apply it properly, even without using an IoC container. In order to do so, I will talk about Entity

The truth behind Inversion of Control – Part II – Inversion of Control

Note: this article assumes you already read my previous articles on IoC containers and the Part I Inversion of Control is another concept that turns out to be very simple once it has been fully processed or rather saying “absorbed”. Absorbed as going over being understood and becoming part of

The truth behind Inversion of Control – Part I – Dependency Injection

Note: this article series assumes you have already read my previous articles on IoC containers. There is an evil truth behind the concept of Inversion of Control container. An unspoken code tragedy taking place everyday while passing unnoticed. Firm in my intentions to stop this shame, I decided to stand

Inversion of Control with Unity – part 2

Note: this article explains the use of my old IoC container in more details. However I long stopped using it and its now deprecated, so read it for knowledge, but know that I now recommend to use an IoC container only to develop games as the ECS paradigm doesn’t need

Inversion of Control with Unity – part 1

Unity is a good game development tool and honestly I like most of its features. However the code framework is awkward to use on big projects where code maintainability is of fundamental importance. As you may have guessed, the following considerations in this article do not apply to simple projects


Svelto Mini Examples: The Unity Survival Example

08/04/2019 Note: this article is quite old (pre SECS 2.5) but since I ported the example to Svelto 2.8 (beta version at the time of this note), I updated this article as well, although it is still missing some important details related to the new features that ship with the

Svelto Mini Examples: Doofuses Must Eat

After finishing writing my previous article on ECS, I decided that a simple centralized repository of mini-examples would be beneficial for the Svelto users. These new and updated examples are meant to introduce Svelto under a different point of view, in line with the theory I explained in my aforementioned

Protected: Svelto.Tasks 2.0

There is no excerpt because this is a protected post.

Porting a boid simulation from UnityECS/Jobs to Svelto.ECS/Tasks

can Svelto.ECS be used with UnityECS? Is the Unity Job system really better than Svelto.Tasks? Let’s see it.

Svelto.ECS 2.7: what’s new and best practices

Svelto ECS 2.7 is out, let’s see what’s new: Exclusive Groups, new SwapEntityGroup and RemoveEntity and new Sequencer.

Introducing Svelto ECS 2.5

Svelto ECS so far… Svelto.ECS wasn’t born just from the needs of a large team, but also as result of years of reasoning behind software engineering applied to game development(*). Compared to Unity.ECS the main goals and reasons for Svelto.ECS to exist are different enough to justify its on going development (plus Svelto is

Learning Svelto Tasks by example: The million points on multiple CPU cores example [now with Unity Jobs System comparison]

[11/03/2018] : added Unity Jobs System version and updated timings. Please check at the end of the article. With my previous article on Svelto.Tasks and multi-threaded cache friendly code, I failed to show visually the power of Svelto.Tasks because I didn’t know how to upload a huge amount of data

Learning Svelto.ECS by example – The Vanilla Example

It’s not simple to learn a new framework and even less shift code paradigm. This is why Svelto.ECS has been written with simplicity in mind. Even so, I realised that I ought to write more tutorials to clarify some simple concepts that are not straightforward to grasp at first. That’s why

Svelto.ECS 2.0 is production ready

This an introductory post to Svelto.ECS 2.0. Other two posts will follow, one explaining the examples line by line and another explaining all the Svelto.ECS concepts in a simpler fashion than before. Therefore this article is written for who already knows Svelto.ECS. Svelto.ECS 2.0 is (at the time of writing

Svelto.ECS+Tasks to write Data Oriented, Cache Friendly, Multi-Threaded code

Note: this article assumes that the reader knows how to use Svelto.ECS and Svelto.Tasks although the findings are interesting regardless.   Introduction New exciting features are coming to Svelto.ECS and Svelto.Tasks libraries. As I am currently focused on optimizing Robocraft for Xbox One, I added several functionalities that can help

Svelto TaskRunner – Run Serial and Parallel Asynchronous Tasks in Unity3D

Note: this is an on-going article and is updated with the new features introduced over the time.  In this article I will introduce a better way to run coroutines using the Svelto.Tasks TaskRunner. I will also show how to run coroutine between threads, easily and safely. You can finally exploit

Svelto ECS is now production ready

Note: this article is now outdated as Svelto.ECS 2.0 is out. Read it to have a complete picture on the concepts, but the most up to date information can be found now here. Note: in this article you will meet the term Node which has been superseded by the term Entity


Fastest way to set elements in a preallocated array in c#

Finally I found the time to play with unmanaged arrays and Memory<T>/Span<T>. In order to investigate possible improvements of the data structures used by Svelto.ECS, I wanted to know what the fastest way to set elements in a preallocated array could be. Using the very powerful BenchmarkDotNet and with the

C# Murmur 3 hash anyone?

If you need a fast and reliable (read very good to avoid collisions) hashing algorithm (not cryptographic), look no further, Murmur 3 is here to the rescue. Take it from here, it’s compatible with Unity3D. Directly translated from the c++ version. More info on Wikipedia and on this definitive answer on stack overflow

Svelto Inversion of Control Container

If it’s the first time you visit my blog, please don’t forget to read my main articles on the subject before to continue this post: http://www.sebaslab.com/ioc-container-for-unity3d-part-1/ http://www.sebaslab.com/ioc-container-for-unity3d-part-2/ It’s finally time to share the latest version of my Inversion of Control container, which I named Svelto IoC, which I will keep updated

What I have learned while developing a game launcher in Unity

This post can be considered partially outdated as my mind changed quite a bit since when I originally wrote it. First of all, I would never suggest to write a game launcher in Unity now. Use instead .net or the latest version of mono with xamarin. Mono library embedded with Unity 4 is too

What’s wrong with Unity SendMessage and BroadcastMessage and what to do about it

Unity 3D is a well designed tool, I can say that. It is clearly less painful to use than UDK, no matter what its limitations are. However, as I keep on saying, the c# framework is still full of bad design choices, probably unfortunate inheritances from unity script (why don’t

How to compress and decompress binary streams in Unity

recently I needed to compress a binary stream that was getting to big to be serialized over internet. I could not find any way to compress files easily, so eventually I used a 3rd party library that works very well in Unity3D (web player included): SharpZipLib I suppose the following

My First Flash Multiplayer Game with Photon Cloud

For a long time I wanted to make some experiments with Photon Network Engine at home. During my professional experience, I worked on several multiplayer games, therefore I was pretty curious about it. Exit Games provides two versions of Photon Network Engine: the traditional Photon Server edition and the new Photon Cloud

On Commands and Events

Events and Commands are two communication tools that I use really often. I have planned more exhaustive articles on the topic, but now I want to write a short post about one rule I apply when I use them. Sometimes it occurs to me the question: should the listener class know

Develop HTML5 games without JS and DOM for flash developers – Part 2: Jangaroo

The reason why I called the first tutorial of this series Part 1 is because I knew there were other alternatives around to develop HTML5 games, carefully avoiding javascript. However after some researches it turned out that the only really working alternative suitable for actionscript developers is Jangaroo. Let’s talk

How to run your Flex/AS3 iOS App without buying a developer license

So, I wanted to experiment with actionscript, flex and iPhone, but I do not have a mac and I am not really keen to pay 99$ just to make some plain experiments; besides I have not intention to make a living out of it, so I do not think it

Run Serial and Parallel Asynchronous Tasks in Unity3D and C#

Please note, this article refers to an old version of the TaskRunner which is not supported anymore. The latest version is here. Every now and then it is necessary to run a series of tasks in a given order, for example to guarantee that some data has been downloaded before to continue

My First Game

knowing how short my memory is, I saved all my professional life memories in a folder on my HD. Some of those memories are meaningful only to me, but why not sharing my first, completed game (yeahh it was 1997…I think) ? The version I am linking is actually the

Perlin Noise – Notes

Some time ago I collected some notes about Perlin Noise all over the web (sorry I don’t remember the original articles). These notes were finalized to implement a GPU coherent noise based smoke effect. I reckon these notes could be useful for somebody else as well.

Enhanced Face Cluster Global Illumination Introduction

This short, not mathematical, introduction written in 2005, explains why I worked on a Global Illumination System and what it is. This article is not part of the objectives of this blog, but I anyway liked the idea to add it.

Design By Contract Actionscript helper class

I did not plan to write this article, but since I wrote this bunch of classes in few minutes, I thought to share the code with everybody. I did not invent anything, I just ported the useful Kevin McFarlane’s DesignByContract helper class that I use for my c# Unity Projects

Develop HTML5 games without JS and DOM for flash developers – Part I: Haxe

Before I start talking about my first “HTML5” experience, let me say something: after 15 years of c++ game development today I make games at the company where I work and I experiment at home using ActionScript 3, C# (Unity) and Haxe. Do I miss the C++ times? Not really,