Troubleshooting
This page covers common issues and their solutions when working with Pill.
Build Issues
Cargo Build Fails
Problem: cargo build fails with compilation errors.
Solutions:
Update Rust toolchain:
powershellrustup updateClean build cache:
powershellcargo clean cargo build --releaseCheck Rust version:
powershellrustc --versionPill requires Rust 1.70 or later.
Verify dependencies: Make sure all path dependencies in
Cargo.tomlare correct:toml[dependencies] pill_engine = { path = "../Pill-Engine/engine/pill_engine" }
Linker Errors on Windows
Problem: Linker errors like LINK : fatal error LNK1181.
Solutions:
Install Visual Studio Build Tools:
- Download from Visual Studio
- Select "Desktop development with C++"
Verify MSVC is installed:
powershellcargo --version --verboseShould show
host: x86_64-pc-windows-msvc
DLL Not Found Errors
Problem: "The program can't start because *.dll is missing".
Solutions:
Build in release mode:
powershellcargo build --releaseCheck DLL path: Make sure the DLL is in the same directory as the executable or in the path.
Rebuild dependencies:
powershellcargo clean cargo build --release
Runtime Issues
Black Screen on Startup
Problem: Window opens but shows only a black screen.
Solutions:
Check camera setup:
rust// Ensure camera is enabled and has proper settings CameraComponent::builder() .enabled(true) // Must be true! .fov(60.0) .clear_color(Color::new(0.5, 0.5, 0.5)) .build()Verify scene is active:
rustlet scene = engine.create_scene("Main")?; engine.set_active_scene(scene)?; // Don't forget this!Check entity has mesh and material:
rust.with_component(MeshRenderingComponent::builder() .mesh(&mesh_handle) // Valid handle? .material(&material_handle) // Valid handle? .build())Verify camera position: Make sure the camera can see your entities.
Crash on Startup
Problem: Application crashes immediately.
Solutions:
Check config.ini:
ini[window] title = "My Game" width = 1280 height = 720Enable debug mode:
powershellcargo run # Debug build shows more error infoCheck resource paths:
rust// Make sure files exist at these paths Mesh::new("Truck", "models/Truck.obj".into()) // Check: res/models/Truck.obj exists?Verify all components are registered:
rustengine.register_component::<TransformComponent>(scene)?; // Register ALL components before creating entities!
Low FPS / Performance Issues
Problem: Game runs slowly or stutters.
Solutions:
Build in release mode:
powershellcargo build --releaseDebug builds are 10-100x slower!
Check MSAA settings in
config.ini:ini[graphics] msaa = 4 # Try 0 or 2 for better performanceReduce polygon count:
- Simplify 3D models
- Use lower-resolution textures
- Remove unnecessary entities
Profile your systems:
rustfn my_system(engine: &mut Engine) -> Result<()> { let start = std::time::Instant::now(); // Your code here println!("System took: {:?}", start.elapsed()); Ok(()) }Limit entity iteration:
rust// Avoid iterating all entities every frame if possible // Cache data when you can
Physics Issues
Objects Fall Through Floor
Problem: Dynamic objects pass through static colliders.
Solutions:
Check collider setup:
rust// Floor (static) .with_component(RigidBodyComponent::builder() .body_type(RigidBodyType::Fixed) // Must be Fixed! .build()) .with_component(ColliderComponent::builder() .shape(SharedShape::cuboid(10.0, 0.5, 10.0)) // Match mesh size .build()) // Object (dynamic) .with_component(RigidBodyComponent::builder() .body_type(RigidBodyType::Dynamic) .build()) .with_component(ColliderComponent::builder() .shape(SharedShape::ball(1.0)) // Match mesh size .mass(10.0) // Don't forget mass! .build())Check physics timestep in
config.ini:ini[physics] timestep = 0.016667 # 60 FPSVerify collider sizes: Make sure collider shapes match visual meshes reasonably well.
Objects Won't Move
Problem: Dynamic objects don't respond to forces.
Solutions:
Check body type:
rustRigidBodyComponent::builder() .body_type(RigidBodyType::Dynamic) // Not Fixed or Kinematic .build()Verify mass:
rustColliderComponent::builder() .mass(10.0) // Must be > 0 for dynamic objects .build()Check if gravity is enabled:
ini[physics] gravity = -9.81 # Negative for downward
Jittery Physics
Problem: Objects shake or vibrate.
Solutions:
Add damping:
rustRigidBodyComponent::builder() .body_type(RigidBodyType::Dynamic) .linear_damping(0.5) // Reduces movement .angular_damping(0.5) // Reduces rotation .build()Adjust collision properties:
rustColliderComponent::builder() .friction(0.5) // Surface friction .restitution(0.3) // Bounciness (lower = less bounce) .build()Use continuous collision detection: For fast-moving objects, enable CCD (check engine docs).
Resource Loading Issues
Model Not Rendering
Problem: Mesh doesn't appear even though code seems correct.
Solutions:
Verify file exists: Check that
res/models/YourModel.objexists.Check model format:
- Must be OBJ format
- Should have normals and UVs
- No extreme polygon counts
Verify resource handle:
rustlet mesh = engine.add_resource(Mesh::new("Test", "models/Test.obj".into()))?; // Make sure this doesn't error!Check material setup: Objects need both mesh AND material to render.
Texture Not Loading
Problem: Model shows up but texture is missing or wrong.
Solutions:
Check texture path:
rustTexture::new( "MyTexture", TextureType::Color, ResourceLoadType::Path("textures/MyTexture.png".into()) // Check this path! )Verify texture format:
- Supported: PNG, JPEG, BMP, TGA
- RGB or RGBA
- Power-of-2 dimensions recommended (512x512, 1024x1024, etc.)
Check material binding:
rustMaterial::builder("MyMaterial") .texture("Color", texture_handle)? // Make sure this is correct .build()
Audio Not Playing
Problem: No sound or audio source not working.
Solutions:
Check audio listener:
rust// Must have one AudioListenerComponent in scene engine.build_entity(scene) .with_component(CameraComponent::default()) .with_component(AudioListenerComponent::builder() .enabled(true) .build()) .build();Verify audio source:
rustAudioSourceComponent::builder() .audio_clip(&clip_handle) .volume(1.0) // 0.0 = silent, 1.0 = full volume .looping(true) // For continuous sounds .play_on_start(true) // Start immediately .build()Check file format:
- Supported: WAV, OGG, MP3
- Not corrupted
- Reasonable file size
Verify Windows audio: Make sure your system volume is up and not muted.
Networking Issues
Cannot Connect to Server
Problem: Client can't connect to server.
Solutions:
Check server address:
rustlet server_addr = "127.0.0.1:5000"; // Correct IP and port?Verify server is running: Make sure the server application started successfully.
Check firewall: Windows Firewall might block the connection. Add exception if needed.
Enable net feature:
toml[dependencies] pill_engine = { path = "../Pill-Engine/engine/pill_engine", features = ["net"] }Use conditional compilation:
rust#[cfg(feature = "net")] { // Networking code here }
Entity Sync Issues
Problem: Entities don't synchronize properly between clients.
Solutions:
Verify NetworkStateComponent:
rustNetworkStateComponent { net_entity_id: unique_id, // Must be unique per entity! owner_id: client_id, state: NetEntityState::Spawn, transform: Some(transform.clone()), }Check update frequency: Balance between bandwidth and responsiveness.
Add networking system:
rustengine.add_system("NetworkingClient", pill_engine::networking_system_client)?;
Hot Reloading Issues
Changes Not Reloading
Problem: Code changes don't reflect in running game.
Solutions:
Rebuild the library:
powershellcargo buildHot-reload only works if you rebuild!
Check file watcher: Make sure
pill_standaloneis monitoring the correct DLL.Verify DLL output:
powershellcargo build --message-format=shortCheck that the DLL is actually being updated.
Try restarting: Sometimes a full restart is needed after major changes.
Editor / IDE Issues
rust-analyzer Errors
Problem: VS Code shows errors that don't exist or won't go away.
Solutions:
Reload window:
- Press
Ctrl+Shift+P - Type "Reload Window"
- Press Enter
- Press
Restart rust-analyzer:
- Press
Ctrl+Shift+P - Type "rust-analyzer: Restart server"
- Press Enter
- Press
Check Cargo.toml: Make sure all dependencies are valid.
Clean and rebuild:
powershellcargo clean cargo build
Slow Autocomplete
Problem: IDE is slow or unresponsive.
Solutions:
Disable unnecessary features: In settings.json:
json{ "rust-analyzer.checkOnSave.command": "clippy", "rust-analyzer.cargo.loadOutDirsFromCheck": false }Increase memory limit: Close other applications to free up RAM.
Exclude target directories:
json{ "files.watcherExclude": { "**/target/**": true } }
Getting More Help
If your issue isn't covered here:
- Check example projects: See how they handle similar situations
- Enable debug logging: Add
println!()statements to understand flow - Read error messages carefully: They often point to the exact problem
- Search GitHub issues: Someone might have had the same problem
- Create a minimal reproduction: Simplify your code to isolate the issue
Creating a Bug Report
When reporting issues, include:
- Rust version:
rustc --version - OS and version: Windows 10/11, etc.
- Minimal code example: Smallest code that reproduces the issue
- Error messages: Full error text with backtrace
- What you expected: What should happen
- What actually happened: What went wrong
Useful Debug Commands
# Check Rust installation
rustc --version
cargo --version
# Verbose build output
cargo build --verbose
# Run with backtrace
$env:RUST_BACKTRACE=1; cargo run
# Check dependencies
cargo tree
# Clean everything
cargo clean
Remove-Item -Recurse -Force target/Common Error Messages
"Cannot find crate for pill_engine"
Fix: Check the path in Cargo.toml points to the correct location.
"No such file or directory (os error 2)"
Fix: Resource file doesn't exist. Check the path and filename.
"Thread 'main' panicked at..."
Fix: Check the line number and error message. Often indicates:
- Missing component registration
- Invalid handle use
- Resource not found
"Borrow checker error"
Fix: You're trying to borrow engine mutably multiple times. Restructure your code to release borrows earlier.
Performance Benchmarks
Expected performance on modern hardware:
- 1000 static entities: 60+ FPS
- 100 dynamic physics objects: 60 FPS
- Simple game: 60-144 FPS
- Complex scene: 30-60 FPS
If you're below these, check the performance optimization section in Next Steps.
Still stuck? Feel free to open an issue on GitHub with details about your problem!