4.9 KiB
Library Integration Test Scene
This test scene demonstrates all EinSoftworks utility libraries working together in a single integrated environment.
Libraries Tested
- ✅ EinSoftworks.Movement - First-person character controller with bunny hopping and air strafing
- ✅ EinSoftworks.Input - Input management and action handling
- ✅ EinSoftworks.Events - Event system for state changes and notifications
- ✅ EinSoftworks.StateManagement - Movement state machine (idle, walking, airborne, crouching)
- ✅ EinSoftworks.Camera - First-person camera with mouse look
- ✅ EinSoftworks.Utilities - Math and physics helpers
Reusable Scene Files
TestPlayer.tscn
A reusable first-person player character scene that can be instantiated in any level.
Features:
- Full movement system with advanced mechanics (bunny hopping, air strafing, crouching)
- Integrated camera with smooth crouch transitions
- Gamepad and keyboard/mouse support
- Optional UI integration (works standalone or with TestUI)
Usage:
# Instance the player scene
var player = preload("res://Scenes/Testing/TestPlayer.tscn").instantiate()
add_child(player)
player.position = Vector3(0, 2, 0)
# Optionally connect UI labels
player.SpeedVal = $UI/TestUI/StatsPanel/VBoxContainerValues/SpeedVal
player.StateVal = $UI/TestUI/StatsPanel/VBoxContainerValues/StateVal
# etc...
TestUI.tscn
A reusable debug UI overlay showing real-time movement statistics.
Features:
- Stats panel with speed, state, position, and velocity
- Clean, non-intrusive bottom-left placement
- Automatically updates when connected to TestPlayer
Usage:
# Instance the UI scene
var ui_layer = CanvasLayer.new()
add_child(ui_layer)
var test_ui = preload("res://Scenes/Testing/TestUI.tscn").instantiate()
ui_layer.add_child(test_ui)
Scene Components
LibraryTest.tscn
The main integration test scene demonstrating all libraries working together.
Components:
- TestPlayer instance with full movement capabilities
- TestUI instance showing real-time stats
- TestGameManager for event handling and player reset
- Test environment (floor, ramp, platforms, walls)
TestGameManager
- Manages game state and event subscriptions
- Listens to movement events
- Provides player reset functionality (Home key)
Environment
- Large floor for movement testing
- Ramp for testing slope movement and surfing
- Multiple platforms for jump testing
- Wall boundaries
Controls
| Key | Action |
|---|---|
| W/A/S/D | Move forward/left/back/right |
| Space | Jump |
| Shift | Sprint |
| Ctrl | Crouch |
| Mouse | Look around |
| ESC | Toggle mouse capture |
| Home | Reset player position |
Testing Features
Movement Mechanics
- Basic Movement: Walk around using WASD
- Sprinting: Hold Shift while moving for increased speed
- Crouching: Hold Ctrl to crouch (reduces speed and height)
- Jumping: Press Space to jump
- Bunny Hopping: Jump repeatedly while strafing to gain speed
- Air Strafing: Strafe left/right while in air and turn mouse to gain speed
- Surfing: Run up the ramp and maintain speed on the slope
State Management
Watch the State label change as you:
- Stand still (Idle)
- Move (Walking)
- Jump (Airborne)
- Crouch (Crouching)
Event System
Check the console output for event notifications:
- Movement state changes
- Jump events
- Speed change events
Expected Behavior
- Smooth Movement: Character should accelerate and decelerate smoothly
- Air Control: Should be able to change direction slightly while airborne
- Speed Preservation: Speed should be maintained between jumps (bunny hopping)
- State Transitions: States should change smoothly without glitches
- UI Updates: All UI elements should update in real-time
- Event Flow: Console should show event notifications
Performance
Target: 60+ FPS on modern hardware The FPS counter in the top-right shows current performance.
Troubleshooting
Mouse Not Captured
- Press ESC to toggle mouse capture mode
- Mouse must be captured for camera look to work
Character Not Moving
- Verify input actions are defined in project.godot
- Check console for any error messages
- Ensure all libraries are properly referenced
No UI Updates
- Check that UI labels are properly connected to TestPlayer
- Verify TestUI script is attached to the UI Control node
Events Not Firing
- Check console output for event messages
- Verify EventManager autoload is configured
- Ensure event subscriptions in TestGameManager._Ready()
Development Notes
This scene serves as both a test environment and a reference implementation for integrating all EinSoftworks libraries. You can use this as a template for your own game scenes.
The scene demonstrates:
- Proper library initialization
- Event subscription/unsubscription patterns
- UI integration with game systems
- State management integration
- Input handling best practices