Contributing to Game Framework
Thank you for your interest in contributing! This guide covers contributing to both the SDK (gameframework) and CLI (game-cli) projects.
Getting Started
Prerequisites
- Flutter SDK: 3.3.0 or higher
- Dart SDK: 3.0.0 or higher
- Git: For version control
- Unity/Unreal: For testing engine integrations
Projects
Development Setup
SDK (gameframework)
# Clone repository
git clone https://github.com/xraph/gameframework.git
cd gameframework
# Install dependencies
make bootstrap
# Run tests
make test
# Run static analysis
make analyzeCLI (game-cli)
# Clone repository
git clone https://github.com/xraph/game-cli.git
cd game-cli
# Install dependencies
dart pub get
# Build and install
make install
# Run tests
make testContributing Workflow
1. Fork and Clone
# Fork the repo on GitHub, then:
git clone https://github.com/YOUR_USERNAME/gameframework.git
cd gameframework
# Add upstream remote
git remote add upstream https://github.com/xraph/gameframework.git2. Create a Branch
git checkout -b feature/your-feature-name
# or
git checkout -b fix/bug-description3. Make Changes
- Write clean, readable code
- Follow the coding standards
- Add tests for new features
- Update documentation as needed
4. Test Your Changes
# Run tests
make test
# Run static analysis
make analyze
# Format code
make format
# Test on actual devices if possible
flutter run5. Commit Changes
Use clear, descriptive commit messages:
# Good commit messages:
git commit -m "feat: Add WebGL support for Unity plugin"
git commit -m "fix: Resolve memory leak in Android controller"
git commit -m "docs: Update Unity integration guide"
# Format:
# type(scope): subject
#
# Types: feat, fix, docs, test, refactor, style, perf, chore6. Push and Create PR
git push origin feature/your-feature-nameThen create a Pull Request on GitHub with:
- Clear title describing the change
- Description explaining what and why
- Reference to related issues
- Screenshots (for UI changes)
- Testing performed
Coding Standards
Dart Code Style
Follow Effective Dart:
// ✅ Good
class GameEngineController {
/// Creates a game engine controller.
GameEngineController({
required this.engineType,
this.config = const GameEngineConfig(),
});
final GameEngineType engineType;
final GameEngineConfig config;
/// Sends a message to the game engine.
Future<void> sendMessage(String target, String method, String data) async {
// Implementation
}
}
// ❌ Bad
class game_engine_controller {
game_engine_controller(this.engineType, [this.config]);
var engineType;
var config;
sendMessage(target, method, data) {}
}Documentation
All public APIs must have documentation:
/// A unified widget for embedding game engines in Flutter.
///
/// This widget provides a common interface for displaying game engines
/// like Unity and Unreal Engine within a Flutter application.
///
/// Example:
/// ```dart
/// GameWidget(
/// engineType: GameEngineType.unity,
/// onEngineCreated: (controller) {
/// controller.sendMessage('GameManager', 'Start', 'level1');
/// },
/// )
/// ```
class GameWidget extends StatefulWidget {
// ...
}Testing
Writing Tests
import 'package:flutter_test/flutter_test.dart';
import 'package:gameframework/gameframework.dart';
void main() {
group('GameEngineConfig', () {
test('should create with default values', () {
const config = GameEngineConfig();
expect(config.fullscreen, false);
expect(config.runImmediately, false);
});
test('should serialize to map correctly', () {
const config = GameEngineConfig(fullscreen: true);
final map = config.toMap();
expect(map['fullscreen'], true);
});
});
}Test Requirements
- All new features must have tests
- Bug fixes should include regression tests
- Maintain 80%+ coverage for core code
Documentation
Types of Documentation
- Code Comments - Explain complex logic
- API Documentation - Document all public APIs
- README Files - Guide users and developers
- Example Code - Show usage patterns
- Architecture Docs - Explain design decisions
Getting Help
Resources
- Documentation: docs.gameframework.dev
- Examples: Check example folders in repositories
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Questions?
- Open a discussion on GitHub
- Check existing issues and PRs
- Review the documentation
Recognition
Contributors will be:
- Listed in CONTRIBUTORS.md
- Credited in release notes
- Mentioned in the README (for significant contributions)
License
By contributing, you agree that your contributions will be licensed under the MIT License.
Thank you for contributing to Game Framework! Every contribution helps make the project better for everyone.