Web

Introduction

FlatRedBall supports web projects using Blazor Web Assembly and WebGL. Web projects use C# just like other FlatRedBall platforms. Web projects can use the FlatRedBall Editor, almost all FlatRedBall features, and support synced projects.

Creating a FlatRedBall Web Project

FlatRedBall Web projects can be created as standalone (primary) projects, or as synced projects. For more information on how to create a synced project, see the View Projects page. In other words, you can create a new project (File -> New Project) or you can add a new web synced project.

Whether you create a new project or use a synced project, you can select Web as the target for your new project.

Once you have created a Web project you can use the FlatRedBall Editor as if it's a regular Desktop project. For known limitations see the section below.

To run your project:

  1. Open the project in Visual Studio

  2. Press the button to begin debugging your project in Visual Studio

  3. A browser should appear running your game project

Debugging

FlatRedBall Web projects can be debugged in a number of ways:

  • To output to the browser console, use System.Console.WriteLine just like a normal console application. Note that output from this method appears in both the browser's console as well as Visual Studio's output window.

  • Breakpoints should function the same as normal FlatRedBall projects; however, as of .NET 8 at times stepover will step over a large block of code or may even freeze the application. This may be improved in future versions of .NET.

Known Limitations

As of August 2024 FlatRedBall Web is a new platform. The following are known limitations of the platform. Over time more limitations will be discovered, while some may be solved. For more information please check the FlatRedBall Discord server.

Gamepad

  • Switch controllers are not supported. Xbox One controllers have been tested and work correctly

  • Setting controller vibration is not supported

Audio

  • The user must interact with the browser before audio plays

File IO

  • Local saving and loading of files cannot be performed with the standard System.IO.File operations

Camera/Resolution

  • The browser determines the size of the game. Unlike regular DesktopGL projects, FlatRedBall cannot forcefully change the browser size. Of course, FlatRedBall properly reacts to resolution changes on a browser including maintaining the internal resolution and aspect ratio.

Debugging

  • Exceptions often do not break in the debugger, so you may need to watch the browser for exceptions in the debugger console (CTRL+SHIFT+i in Chrome)

Last updated