-
Notifications
You must be signed in to change notification settings - Fork 77
Conversation
Still needs test project update and a changelog. |
696b294
to
b3fc65d
Compare
Make EntityId readonly Simplify DiffComponentStorage
Fix EventStorage clearing
67c8816
to
5ab60b8
Compare
@@ -9,7 +9,7 @@ namespace Improbable.Gdk.Core | |||
/// Instances of this type should be treated as transient identifiers that will not be | |||
/// consistent between different runs of the same simulation. | |||
/// </remarks> | |||
public struct EntityId : IEquatable<EntityId> | |||
public readonly struct EntityId : IEquatable<EntityId> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth noting this in the changelog :)
public abstract class DiffComponentStorage<TUpdate> : IDiffUpdateStorage<TUpdate>, IDiffComponentAddedStorage<TUpdate>, IDiffAuthorityStorage | ||
where TUpdate : ISpatialComponentUpdate | ||
{ | ||
private readonly HashSet<EntityId> entitiesUpdated = new HashSet<EntityId>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make this protected since I'll need that in #1298 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
.Select(componentCommands => (componentCommands.Key, | ||
componentCommands.Value.Commands.Select(m => m.SendStorage))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find splitting the tuple over two lines really hard to grok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
private readonly Dictionary<uint, (int firstIndex, int count)> componentIdStorageRange = | ||
new Dictionary<uint, (int firstIndex, int count)>(); | ||
|
||
private readonly Dictionary<(uint componentId, uint commandId), IComponentCommandDiffStorage> componentCommandToStorage = | ||
new Dictionary<(uint componentId, uint commandId), IComponentCommandDiffStorage>(); | ||
|
||
private readonly Dictionary<Type, ICommandDiffStorage> typeToCommandStorage = | ||
new Dictionary<Type, ICommandDiffStorage>(); | ||
|
||
private readonly List<ICommandDiffStorage> commandStorageList = new List<ICommandDiffStorage>(); | ||
private readonly List<IComponentCommandDiffStorage> commandStorageList = new List<IComponentCommandDiffStorage>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A small explanation on this in comments would go a long way :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A IComponentCommandDiffStorage
implements ICommandDiffStorage
All instances in this list were the former, except for the world command storage that we manually added.
Instead, I now store the generated diff storages only, and the world storage is called manually. (This is only done for clearing afterwards)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm referring more to the range dictionary :)
workers/unity/Packages/io.improbable.gdk.core/View/DiffComponentStorage.cs
Outdated
Show resolved
Hide resolved
workers/unity/Packages/io.improbable.gdk.core/View/DiffComponentStorage.cs
Outdated
Show resolved
Hide resolved
.Select(componentCommands => (componentCommands.Key, | ||
componentCommands.Value.Commands.Select(m => m.SendStorage))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
workers/unity/Packages/io.improbable.gdk.core/Worker/ViewDiff.cs
Outdated
Show resolved
Hide resolved
workers/unity/Packages/io.improbable.gdk.core/Worker/ViewDiff.cs
Outdated
Show resolved
Hide resolved
CHANGELOG.md
Outdated
- Running forced code generation now deletes the `ImprobableCodegen.marker` file. [#1294](https://github.com/spatialos/gdk-for-unity/pull/1294) | ||
- Added tests coverage for the interaction between unlinking a GameObject and Reader/Writer/CommandSender/CommandReceiver state. [#1295](https://github.com/spatialos/gdk-for-unity/pull/1295) | ||
- Reduce complexity in ViewDiff and MessagesToSend classes. [#1290](https://github.com/spatialos/gdk-for-unity/pull/1290) | ||
- De-duplicate code for generated ComponentDiffStorage instances. [#1290](https://github.com/spatialos/gdk-for-unity/pull/1290) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- De-duplicate code for generated ComponentDiffStorage instances. [#1290](https://github.com/spatialos/gdk-for-unity/pull/1290) | |
- De-duplicate code for generated `ComponentDiffStorage` instances. [#1290](https://github.com/spatialos/gdk-for-unity/pull/1290) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you push this :P
Co-Authored-By: Paul Balaji <[email protected]>
Description
First iteration of simplifications in the Component section of code generation.
Includes an improvement in the ViewDiff and MessagesToSend, reducing a double lookup for storage instances to a single lookup.