Me
How are rules used when applying User Groups?
Enki
**Source:** [Rules in Game Server](https://tripledotstudios.atlassian.net/wiki/spaces/KB/pages/2668494860/Rules+in+Game+Server)
Rules are a critical component for defining and applying User Groups across different configurations. Here's a comprehensive breakdown of how rules work:
### Basic Rule Operators
Rules use two primary logical operators:
| Operator | Behavior |
|----------|----------|
| **AND** | Users must match **ALL** added rules to receive the entity |
| **OR** | Users must match **AT LEAST ONE** rule to receive the entity |
### Rule Configuration Features
1. **Multiple Rules**:
- You can add multiple rules within a section
- Use the **[green + button]** to add additional values to certain rules
2. **Sections and Nesting**:
- Supports up to 3 levels of rule nesting
- Different colors help distinguish nested rule sections
- Can combine sections using AND/OR operators

### Practical Example
Consider targeting users with the following complex criteria:
- From France OR UK
- AND Game version equal to 2.7.0
- AND Installed the app 15 days ago or more

### Advanced Rule Management
#### Sections
- Allow nested rule combinations
- Help create more precise user targeting
- Can convert existing rules into sections
#### Named Rule Groups
- Save and reuse rule sets across different features
- Simplify configuration by creating standardized rule templates
### Priority and Matching
When applying User Groups:
1. Rules are evaluated from top to bottom
2. Sections with higher priority (top of the list) are checked first
3. Users must match ALL rules within a section (when using AND)
4. Users can match ANY rule within a section (when using OR)
### Best Practices
- Use sections to create complex, multi-level targeting rules
- Leverage AND/OR operators for nuanced user segmentation
- Keep rules clear and specific
- Use Named Rule Groups for recurring rule configurations
### Validation Constraints
- Maximum of 3 levels of rule nesting
- Rules must have at least one condition
- Priority is determined by the order of sections/groups
By understanding and effectively using rules, you can create highly targeted and dynamic User Groups across different configuration settings.