You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Overall, this was a week of slow progress and a lot of back-and-forth. I spent most of this week refactoring the rules system...system. On Monday, I spent many hours on a scratch refactor that I would eventually revert. This is a necessary process because even if the time doesn't yield a commit, it helps to illuminate the entirety of the change.
Decomposing the Game State
In Devlog No 2, I discussed a Localized System State refactor. I explored this change this week, spending a few "working showers" on flows for entity CRUD operations, persistence, etc. This revealed that the best path forward (for now) is to reduce IGameState.cs. to simple CRUD operations and leave all other logic in the rules system layer.
I think it's possible to get there safely by locking down the mutability of entities and their components. This will probably lead to GC issues, but I'll cross that bridge when the time comes.
Refactoring the Event System
Previously, URF used reflection to fetch any event handlers, then passed events to the appropriate methods at runtime. I tend to be very against reflection since it's often used in "clever" code that disables much of the safety the compiler can provide. However, my rule of thumb is that reflection generally makes sense in framework code but not system/service-level code. Since "framework" is in the name, I blazed ahead.
However, this path falls apart if you need any sequencing in event handlers:
The GetMethods method does not return methods in a particular order, such as alphabetical or declaration order. Your code must not depend on the order in which methods are returned, because that order varies.
This fact made it troublesome to notice game state changes before responding to them (e.g., an EntityCreated response should note a new Entity before attempting to do anything with that Entity). So, I removed the attribute-based handlers and unified all event handling under IEventHandler.cs. I also wrote a new document on how to Add Custom Events since it takes a little bit of OOP magic.
New Incubation - Packaging
I'm considering packaging the project and releasing it as a GitHub release for two reasons. The first is that it's a better DevOps practice- by releasing early and often, we have a better view of the project's usability. Secondly (and selfishly), I want to build my own closed-source roguelike on the framework without sacrificing the benefits of an open-source repo.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Devlog No 3 -- Event System Refactoring
Overall, this was a week of slow progress and a lot of back-and-forth. I spent most of this week refactoring the rules system...system. On Monday, I spent many hours on a scratch refactor that I would eventually revert. This is a necessary process because even if the time doesn't yield a commit, it helps to illuminate the entirety of the change.
Decomposing the Game State
In Devlog No 2, I discussed a Localized System State refactor. I explored this change this week, spending a few "working showers" on flows for entity CRUD operations, persistence, etc. This revealed that the best path forward (for now) is to reduce
IGameState.cs.
to simple CRUD operations and leave all other logic in the rules system layer.I think it's possible to get there safely by locking down the mutability of entities and their components. This will probably lead to GC issues, but I'll cross that bridge when the time comes.
Refactoring the Event System
Previously, URF used reflection to fetch any event handlers, then passed events to the appropriate methods at runtime. I tend to be very against reflection since it's often used in "clever" code that disables much of the safety the compiler can provide. However, my rule of thumb is that reflection generally makes sense in framework code but not system/service-level code. Since "framework" is in the name, I blazed ahead.
However, this path falls apart if you need any sequencing in event handlers:
Doc Source
This fact made it troublesome to notice game state changes before responding to them (e.g., an EntityCreated response should note a new Entity before attempting to do anything with that Entity). So, I removed the attribute-based handlers and unified all event handling under
IEventHandler.cs
. I also wrote a new document on how to Add Custom Events since it takes a little bit of OOP magic.New Incubation - Packaging
I'm considering packaging the project and releasing it as a GitHub release for two reasons. The first is that it's a better DevOps practice- by releasing early and often, we have a better view of the project's usability. Secondly (and selfishly), I want to build my own closed-source roguelike on the framework without sacrificing the benefits of an open-source repo.
That's all for this week!
Beta Was this translation helpful? Give feedback.
All reactions