.cursorrules (deprecated)
.cursorrules.cursorrulesroot
Quality
52/100
Scores the file, not the repository.Length
544 words
10 headings · 0 code blocksRepository
118
— · pushed 496 days agoLast changed
3 days ago
First indexed 3 days ago.1# Godot 4.4 Game Development .cursorrules23## Core Development Guidelines45- Use strict typing in GDScript for better error detection and IDE support6- Implement \_ready() and other lifecycle functions with explicit super() calls7- Use @onready annotations instead of direct node references in \_ready()8- Prefer composition over inheritance where possible9- Use signals for loose coupling between nodes10- Follow Godot's node naming conventions (PascalCase for nodes, snake_case for methods)1112## Code Style1314- Use type hints for all variables and function parameters15- Document complex functions with docstrings16- Keep methods focused and under 30 lines when possible17- Use meaningful variable and function names18- Group related properties and methods together1920## Naming Conventions2122- Files: Use snake_case for all filenames (e.g., player_character.gd, main_menu.tscn)23- Classes: Use PascalCase for custom class names with class_name (e.g., PlayerCharacter)24- Variables: Use snake_case for all variables including member variables (e.g., health_points)25- Constants: Use ALL_CAPS_SNAKE_CASE for constants (e.g., MAX_HEALTH)26- Functions: Use snake_case for all functions including lifecycle functions (e.g., move_player())27- Enums: Use PascalCase for enum type names and ALL_CAPS_SNAKE_CASE for enum values28- Nodes: Use PascalCase for node names in the scene tree (e.g., PlayerCharacter, MainCamera)29- Signals: Use snake_case in past tense to name events (e.g., health_depleted, enemy_defeated)3031## Scene Organization3233- Keep scene tree depth minimal for better performance34- Use scene inheritance for reusable components35- Implement proper scene cleanup on queue_free()36- Use SubViewport nodes carefully due to performance impact37- Provide step-by-step instructions to create Godot scene(s) instead of providing scene source code3839## Signal Best Practices4041- Use clear, contextual signal names that describe their purpose (e.g., player_health_changed)42- Utilize typed signals to improve safety and IDE assistance (e.g., signal item_collected(item_name: String))43- Connect signals in code for dynamic nodes, and in the editor for static relationships44- Avoid overusing signals - reserve them for important events, not frequent updates45- Pass only necessary data through signal arguments, avoiding entire node references when possible46- Use an autoload "EventBus" singleton for global signals that need to reach distant nodes47- Minimize signal bubbling through multiple parent nodes48- Always disconnect signals when nodes are freed to prevent memory leaks49- Document signals with comments explaining their purpose and parameters5051## Resource Management5253- Implement proper resource cleanup in \_exit_tree()54- Use preload() for essential resources, load() for optional ones55- Consider PackedByteArray storage impact on backwards compatibility56- Implement resource unloading for unused assets5758## Performance Best Practices5960- Use node groups judiciously for managing collections, and prefer direct node references for frequent, specific access to individual nodes.61- Implement object pooling for frequently spawned objects62- Use physics layers to optimize collision detection63- Prefer packed arrays (PackedVector2Array, etc.) over regular arrays6465## Error Handling6667- Implement graceful fallbacks for missing resources68- Use assert() for development-time error checking69- Log errors appropriately in production builds70- Handle network errors gracefully in multiplayer games7172## TileMap Implementation7374- TileMap node is deprecated - use multiple TileMapLayer nodes instead75- Convert existing TileMaps using the TileMap bottom panel toolbox option "Extract TileMap layers"76- Access TileMap layers through TileMapLayer nodes77- Update navigation code to use TileMapLayer.get_navigation_map()78- Store layer-specific properties on individual TileMapLayer nodes79
