Alice, video-game in C# / Unity3D
Alice in wonderland-themed roguelike.
This is a project I started to pass time during the first months of the pandemic in 2020.
Heavily inspired by the Binding of Isaac.
Unity3D relies on C# as a core programming language, implementing Behaviors / Components
then attached to GameObjects, a classical composition paradigm
known as ECS.
The assets are either hand-made or public domain (music, sound effects).
Play Alice on itch.io - it runs in the browser.
It's loud, so you may want to turn the volume down.
Event-Sourcing in Domain-Driven-Design in C#
The core principle behind event sourcing is that State is transient, derived from a left-fold of previous
immutable events in a sequential, append-only log. Reasons for this architecture include the following.
- full auditability, convenient debugging, state snapshots - since state is only a computation from the changes stored as events
- time-travel/state reconstruction - the timestamping of events makes a timeline to explore a-posteriori
- supporting CQRS patterns - the writes by default being early as possible,
recording the request of state changes, reads always having to compute later, from the writes.
public record InsLedger(string lid): Event;
public record DelLedger(string lid): Event;
public record InsLine(string lid, string iid, int dv) : Event;
/* ... */
var evs = (new List<Event> {
new InsLedger("Louis"),
new InsLine("Louis", 0, +5000), // initial deposit
new InsLine("Louis", 1, -1500), // payment 1
new InsLine("Louis", 2, -300), // payment 2 etc.})
return evs.reduce(new Balance(), (balance, ev) => { /* ... */ })
In the snippet above, transaction events are defined - later, they are aggregated into a user balance state.
Martin Fowler popularized the concept. See his talk on Youtube
and his Event Sourcing article.