-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathllms.txt
More file actions
291 lines (217 loc) · 10.5 KB
/
llms.txt
File metadata and controls
291 lines (217 loc) · 10.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
# DxMessaging
> Type-safe, synchronous event bus and messaging system for Unity
## Overview
DxMessaging is a high-performance messaging library for Unity (v2021.3+) that replaces traditional C# events and UnityEvents with a type-safe, lifecycle-managed communication pattern. It enables decoupled communication between game systems without direct references.
**Version:** 2.2.0
**License:** MIT
**Repository:** https://github.com/wallstop/DxMessaging
**Documentation:** https://wallstop.github.io/DxMessaging/
## Quick Facts
- **Language:** C# (.NET Standard 2.0)
- **Platform:** Unity 2021.3+
- **Package Manager:** OpenUPM, npm, Unity Package Manager
- **Tests:** NUnit + Unity Test Framework
- **Documentation:** MkDocs Material
## Key Features
- **Three Message Types:** Untargeted (PA System), Targeted (Commands), Broadcast (Observable Facts)
- **Automatic Lifecycle Management:** No manual unsubscribe needed, prevents memory leaks
- **Zero Coupling:** Systems communicate without direct references
- **Inspector Diagnostics:** Built-in Unity Editor tools showing message flow, timestamps, and payloads
- **Priority-based Execution:** Control message handler ordering
- **Interceptor Pipeline:** Validate and normalize messages before handlers execute
- **DI Framework Support:** Integrations for Zenject, VContainer, and Reflex
- **Source Generators:** Auto-constructor generation for messages
- **Low Allocation Design:** Struct-based with minimal GC pressure
- **Local Bus Islands:** Isolated testing with zero global state
## Core Concepts
### Message Types
1. **Untargeted Messages** - Global announcements (like a PA system)
- No specific target
- Anyone can listen
- Example: Game settings changed
2. **Targeted Messages** - Commands to specific entities
- Has a specific GameObject/Component target
- Only target and its children listen
- Example: Heal this specific character
3. **Broadcast Messages** - Observable facts from a source
- Has a source GameObject/Component
- Anyone can observe what happened
- Example: This enemy took damage
### Message Flow
```text
Emitter → MessageBus → Interceptors → Handlers (by priority)
```
## Project Structure
```text
/Runtime/Core/ Core messaging engine (MessageBus, Messages, Attributes)
/Runtime/Unity/ Unity integration (Components, DI support)
/Editor/ Inspector tools, analyzers, custom editors
/SourceGenerators/ C# Source Generators for auto-constructors
/Tests/Runtime/ NUnit tests
/Samples~/ Example projects (Mini Combat, DI, Inspector)
/docs/ MkDocs documentation site
```
## Getting Started
### Installation (OpenUPM - Recommended)
```bash
openupm add com.wallstop-studios.dxmessaging
```
### Basic Usage
```csharp
// Define a message
public readonly struct PlayerHealthChanged
{
public readonly float newHealth;
[DxAutoConstructor] // Auto-generates constructor
public PlayerHealthChanged() { }
}
// Send a message
MessageBus.Emit(new PlayerHealthChanged(75f));
// Listen for messages
MessageBus.Register<PlayerHealthChanged>(msg => {
Debug.Log($"Health changed to {msg.newHealth}");
});
```
### Unity Component Integration
```csharp
public class HealthDisplay : MessageAwareComponent
{
void OnEnable()
{
Register<PlayerHealthChanged>(OnHealthChanged);
}
void OnHealthChanged(PlayerHealthChanged msg)
{
// Automatically unregistered when component is disabled/destroyed
}
}
```
## Documentation Structure
### Getting Started
- [Overview](https://wallstop.github.io/DxMessaging/getting-started/overview/)
- [Installation](https://wallstop.github.io/DxMessaging/getting-started/install/)
- [Quick Start](https://wallstop.github.io/DxMessaging/getting-started/quick-start/)
- [Visual Guide](https://wallstop.github.io/DxMessaging/getting-started/visual-guide/)
### Concepts
- [Mental Model](https://wallstop.github.io/DxMessaging/concepts/mental-model/) - Core philosophy and design principles
- [Message Types](https://wallstop.github.io/DxMessaging/concepts/message-types/) - Untargeted, Targeted, Broadcast
- [Listening Patterns](https://wallstop.github.io/DxMessaging/concepts/listening-patterns/)
- [Targeting & Context](https://wallstop.github.io/DxMessaging/concepts/targeting-and-context/)
- [Interceptors & Ordering](https://wallstop.github.io/DxMessaging/concepts/interceptors-and-ordering/)
### Guides
- [Patterns](https://wallstop.github.io/DxMessaging/guides/patterns/) - Best practices and common patterns
- [Unity Integration](https://wallstop.github.io/DxMessaging/guides/unity-integration/)
- [Testing](https://wallstop.github.io/DxMessaging/guides/testing/) - Testing strategies for message-based systems
- [Diagnostics](https://wallstop.github.io/DxMessaging/guides/diagnostics/) - Inspector tools and debugging
- [Migration Guide](https://wallstop.github.io/DxMessaging/guides/migration-guide/)
### Architecture
- [Design & Architecture](https://wallstop.github.io/DxMessaging/architecture/design-and-architecture/)
- [Performance](https://wallstop.github.io/DxMessaging/architecture/performance/) - Benchmarks (10-17M ops/sec)
- [Comparisons](https://wallstop.github.io/DxMessaging/architecture/comparisons/) - vs Events, UnityEvents, other buses
### Advanced Topics
- [Emit Shorthands](https://wallstop.github.io/DxMessaging/advanced/emit-shorthands/)
- [Message Bus Providers](https://wallstop.github.io/DxMessaging/advanced/message-bus-providers/)
- [Registration Builders](https://wallstop.github.io/DxMessaging/advanced/registration-builders/)
- [Runtime Configuration](https://wallstop.github.io/DxMessaging/advanced/runtime-configuration/)
### Integrations
- [Zenject](https://wallstop.github.io/DxMessaging/integrations/zenject/) - Extenject/Zenject DI integration
- [VContainer](https://wallstop.github.io/DxMessaging/integrations/vcontainer/) - VContainer DI integration
- [Reflex](https://wallstop.github.io/DxMessaging/integrations/reflex/) - Reflex DI integration
### Reference
- [Quick Reference](https://wallstop.github.io/DxMessaging/reference/quick-reference/)
- [FAQ](https://wallstop.github.io/DxMessaging/reference/faq/)
- [Glossary](https://wallstop.github.io/DxMessaging/reference/glossary/)
- [Troubleshooting](https://wallstop.github.io/DxMessaging/reference/troubleshooting/)
## Key Files
- [README.md](https://github.com/wallstop/DxMessaging/blob/master/README.md) - 30-second pitch, mental models, quick start
- [CHANGELOG.md](https://github.com/wallstop/DxMessaging/blob/master/CHANGELOG.md) - Version history
- [CONTRIBUTING.md](https://github.com/wallstop/DxMessaging/blob/master/CONTRIBUTING.md) - Contribution guidelines
- [package.json](https://github.com/wallstop/DxMessaging/blob/master/package.json) - Package manifest
- [.llm/context.md](https://github.com/wallstop/DxMessaging/blob/master/.llm/context.md) - Repository guidelines for AI agents
## Development
### Build & Test Commands
```bash
# Format code
dotnet tool restore
dotnet tool run csharpier .
# Build source generators
dotnet build SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators.csproj
# Run tests (Unity Test Runner)
# Open Unity 2021.3+ project → Window → Test Runner → PlayMode
# Format markdown
npm run format:md
# Lint markdown
npm run lint:markdown
# Validate YAML
npm run check:yaml
# Spell check
npx cspell "**/*"
```
### Project Standards
- **Code Style:** 4-space indent, explicit types (no `var`), PascalCase for public APIs
- **Line Endings:** CRLF for most files, LF for shell scripts
- **Tests:** NUnit + Unity Test Framework, no underscores in test names
- **Documentation:** MkDocs Material, lazy numbering for ordered lists
- **Commits:** Imperative mood, reference issues/PRs
## AI Agent Context
This repository includes comprehensive AI agent guidance in the `.llm/` directory:
- **[.llm/context.md](https://github.com/wallstop/DxMessaging/blob/master/.llm/context.md)** - Repository guidelines, coding standards, testing policies
- **[.llm/skills/](https://github.com/wallstop/DxMessaging/tree/master/.llm/skills)** - 90+ specialized skill documents covering:
- **documentation/**
- **github-actions/**
- **packaging/**
- **performance/**
- **scripting/**
- **solid/**
- **templates/**
- **testing/**
## Common Pitfalls & Solutions
### Memory Leaks
**Problem:** Forgot to unsubscribe from events
**Solution:** Use `MessageAwareComponent` or `MessageHandler` for automatic lifecycle management
### Message Not Received
**Problem:** Handler registered after message was emitted
**Solution:** Messages are synchronous; ensure registration happens during `Awake`/`OnEnable`
### Wrong Message Type
**Problem:** Used Broadcast when Targeted was needed
**Solution:** See [Mental Model](https://wallstop.github.io/DxMessaging/concepts/mental-model/) for type selection guidance
### Performance Issues
**Problem:** Too many handlers or heavy interceptors
**Solution:** Use priority ordering, profile with Inspector diagnostics
## Performance Characteristics
- **Message Emit:** 10-17M operations/second (OS-specific)
- **Memory:** Low allocation, struct-based design
- **Handler Invocation:** Direct calls, no reflection
- **Registration:** O(1) add/remove with backing dictionary
- **Priority Ordering:** Stable sort on registration
See [Performance Documentation](https://wallstop.github.io/DxMessaging/architecture/performance/) for detailed benchmarks.
## Examples
### Mini Combat Sample
Demonstrates all three message types in a simple combat scenario:
- **Untargeted:** Game settings changes
- **Targeted:** Heal specific character
- **Broadcast:** Enemy takes damage
**Location:** `Samples~/Mini Combat`
### DI Integration Sample
Shows integration with Zenject, VContainer, and Reflex:
- Scoped message buses
- Container lifecycle integration
- IMessageRegistrationBuilder usage
**Location:** `Samples~/DI`
### Inspector Diagnostics Sample
Demonstrates debugging tools:
- Global observer pattern
- Message flow visualization
- Timestamp and payload inspection
**Location:** `Samples~/UI Buttons + Inspector`
## Support & Community
- **Issues:** https://github.com/wallstop/DxMessaging/issues
- **Discussions:** https://github.com/wallstop/DxMessaging/discussions
- **Email:** wallstop@wallstopstudios.com
- **OpenUPM:** https://openupm.com/packages/com.wallstop-studios.dxmessaging/
## License
MIT License - see [LICENSE.md](https://github.com/wallstop/DxMessaging/blob/master/LICENSE.md)
Copyright (c) 2017-2026 Wallstop Studios
---
**Last Updated:** 2026-02-17
**Generated from:** package.json v2.2.0, mkdocs.yml, .llm/context.md