# Cross Platform


> **ARCHIVED** -- Cross-platform development guidance documented here has been archived.

## What was cross-platform development?

Cross-platform development for Facebook games referred to the practice of building games that could work across multiple surfaces and form factors within the Facebook ecosystem, including:

- **Facebook desktop web** (facebook.com in a desktop browser)
- **Facebook mobile web** (facebook.com in a mobile browser)
- **Facebook mobile apps** (the Facebook app for iOS and Android)
- **Messenger** (the Messenger app for iOS and Android)
- **Other platforms** (native mobile apps, third-party platforms)

The goal was to allow developers to reach players wherever they were, with a consistent experience, while adapting to the unique capabilities and constraints of each platform.

## Historical context

### Early cross-platform challenges

In the early days of Facebook gaming, developers faced significant challenges building cross-platform experiences:

- **Canvas Games** were designed primarily for desktop web browsers and did not work well on mobile devices.
- **Mobile Canvas** was introduced as a bridge, allowing Canvas Games to run in the Facebook mobile app, but the experience was often suboptimal due to the iframe-based architecture.
- **Native mobile apps** required entirely separate codebases and distribution through the Apple App Store and Google Play Store, with different login flows, payment systems, and social integrations.

### The Instant Games solution

Instant Games addressed many cross-platform challenges by design:

- **HTML5-based**: Instant Games are built with web technologies (HTML5, JavaScript, CSS) that run natively in both desktop and mobile browsers.
- **Embedded in Facebook and Messenger**: Instant Games launch directly within the Facebook app and Messenger on both iOS and Android, as well as on desktop web. Players do not need to install anything.
- **Single codebase**: Developers write one game that runs across all supported surfaces. The Instant Games SDK handles platform-specific differences.
- **Responsive design**: Games can adapt their layout and controls to different screen sizes and input methods (touch vs. mouse/keyboard).

### Cross-platform identity and data

Cross-platform development also involved ensuring player identity and data consistency:

- **Player identity**: A player should be recognized as the same person regardless of which platform they use. The Instant Games SDK provides a consistent player ID across surfaces.
- **Game state**: Player progress and purchases should be accessible on any platform. Developers typically achieve this through server-side storage.
- **Social graph**: Friends and social features should work consistently across platforms, which the Instant Games SDK supports.

## Key considerations for cross-platform games

While much of this guidance has been superseded by the Instant Games platform, the following principles remain relevant for developers thinking about cross-platform game design:

### Input handling

- **Touch vs. mouse**: Mobile players use touch controls, while desktop players use a mouse and keyboard. Design your game's controls to work with both input methods, or provide separate control schemes.
- **Screen size**: Mobile screens are significantly smaller than desktop monitors. Ensure that UI elements (buttons, text, game objects) are appropriately sized for all screen sizes.
- **Orientation**: Consider whether your game works best in portrait or landscape mode, and how it behaves when the device is rotated.

### Performance

- **Device diversity**: Mobile devices range from low-end to high-end. Optimize your game to perform well on lower-powered devices to maximize your reach.
- **Network conditions**: Mobile players may be on slow or unreliable connections. Minimize the data your game needs to download and handle network interruptions gracefully.
- **Memory and battery**: Mobile devices have limited memory and battery life. Efficient resource management is critical.

### Platform-specific features

- **Notifications**: The notification systems on mobile and desktop work differently. Use the Instant Games SDK's built-in notification features rather than building your own.
- **Sharing**: Share dialogs may look and behave differently across platforms. Test sharing flows on each platform to ensure they work correctly.
- **Audio**: Mobile browsers have restrictions on audio autoplay. Always trigger audio in response to a user interaction.

## Current state

Today, the Instant Games platform is the primary way to build games on Facebook, and it inherently supports cross-platform play:

- A single Instant Game build runs on Facebook (desktop and mobile), Messenger, and other supported surfaces.
- The Instant Games SDK abstracts platform differences, so developers rarely need to write platform-specific code.
- For developers who also want to offer native mobile or PC versions of their game, server-side account systems can be used to synchronize player data across builds.

The dedicated "Cross Platform" product and documentation have been archived because cross-platform support is now a built-in feature of the Instant Games platform rather than a separate offering.

## Related resources

- [Instant Games Overview](https://developers.facebook.com/documentation/games/overview) - Learn about the current platform, which supports cross-platform play by default.
- [Build Section](https://developers.facebook.com/documentation/games/build) - Technical guides for building Instant Games that work across all supported surfaces.
- [Cross Play (Archived)](https://developers.facebook.com/documentation/games/archive/cross-play) - Historical documentation on the cross-platform identity framework.
- [Legacy Web Games (Archived)](https://developers.facebook.com/documentation/games/archive/legacy-web-games) - Historical documentation on Canvas Games.