{"id":16356953,"url":"https://github.com/bijington/orbit","last_synced_at":"2025-04-03T11:09:46.434Z","repository":{"id":41531036,"uuid":"378910495","full_name":"bijington/orbit","owner":"bijington","description":"The Orbit engine is a game engine built on top of .NET MAUI Graphics. The objective is to firstly enjoy the journey of building a game engine and secondly providing a framework that allows us to utilise the best parts of a cross-platform framework while building a 'typical' game.","archived":false,"fork":false,"pushed_at":"2024-10-01T10:33:21.000Z","size":48460,"stargazers_count":289,"open_issues_count":15,"forks_count":36,"subscribers_count":27,"default_branch":"main","last_synced_at":"2024-10-12T01:44:38.629Z","etag":null,"topics":["dotnet-maui","game-development","game-engine","hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bijington.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":".github/funding.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["bijington"]}},"created_at":"2021-06-21T11:40:43.000Z","updated_at":"2024-10-01T10:33:27.000Z","dependencies_parsed_at":"2023-10-04T05:01:43.926Z","dependency_job_id":"134a06a0-2269-42f4-b292-d20a20e2ed10","html_url":"https://github.com/bijington/orbit","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bijington%2Forbit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bijington%2Forbit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bijington%2Forbit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bijington%2Forbit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bijington","download_url":"https://codeload.github.com/bijington/orbit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246989743,"owners_count":20865331,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dotnet-maui","game-development","game-engine","hacktoberfest"],"created_at":"2024-10-11T01:44:37.445Z","updated_at":"2025-04-03T11:09:46.413Z","avatar_url":"https://github.com/bijington.png","language":"C#","funding_links":["https://github.com/sponsors/bijington"],"categories":[],"sub_categories":[],"readme":"# Orbit Engine\n\nThe Orbit engine is a game engine built on top of .NET MAUI Graphics. The objective is to firstly enjoy the journey of building a game engine and secondly providing a framework that allows us to utilise the best parts of a cross-platform framework while building a 'typical' game.\n\n[![NuGet](https://buildstats.info/nuget/Bijington.Orbit.Engine?includePreReleases=true)](https://www.nuget.org/packages/Bijington.Orbit.Engine/)\n\n## The game loop approach\n\nThe engine provides a 'typical' game loop approach where it will process input from the user (TBA), call update across the scene and game objects, perform a render cycle for the scene and game objects and then wait until the next loop of the previous is ready.\n\n```mermaid\nflowchart LR\n    processInput([Process Input]) --\u003e\n    update([Update Game]) --\u003e\n    render([Render]) --\u003e\n    wait([Wait]) --\u003e processInput\n```\n\n## Example usage\n\nThis section aims at explaining how to use the engine in your project.\n\n### Registering with the `MauiAppBuilder`\n\nThe first step is to register the game engine in your `MauiProgram.cs` file using the `UseOrbitEngine` extension method:\n\n```csharp\nbuilder\n    .UseMauiApp\u003cApp\u003e()\n    .UseOrbitEngine()\n```\n\nCurrently this just registers the `GameSceneManager` provided by the framework as a **singleton**. In the majority of scenarios this should be fine, if you ever need multiple instances (perhaps you want 2 scenes running side-by-side in a couch based co-op mode) then you will likely need to register this as `AddTransient` manually yourself and don't call `UseOrbitEngine`.\n\n### Creating your first `GameScene`\n\nA `GameScene` represents a screen in your game and its associated state. This is typically your home screen, actual game screen or even individual levels.\n\n```csharp\npublic class MainScene : GameScene\n{\n    public MainScene()\n    {\n        // Call Add(..) to add GameObjects to your scene.\n    }\n\n    public override void Render(ICanvas canvas, RectF dimensions)\n    {\n        base.Render(canvas, dimensions);\n\n        // Render the state of your scene.\n    }\n\n    public override void Update(double millisecondsSinceLastUpdate)\n    {\n        base.Update(millisecondsSinceLastUpdate);\n\n        // Update the state of your scene.\n    }\n}\n```\n\n### Creating your first `GameObject`\n\nA `GameObject` represents a single object in your game. It is recommended that you keep this as simple as possible.\n\n```csharp\npublic class Paddle : GameObject\n{\n    public override void Render(ICanvas canvas, RectF dimensions)\n    {\n        base.Render(canvas, dimensions);\n    \n        // Render the state of your object.\n    }\n\n    public override void Update(double millisecondsSinceLastUpdate)\n    {\n        base.Update(millisecondsSinceLastUpdate);\n\n        // Update the state of your scene.\n    }\n}\n```\n\n### Rendering your `GameScene`\n\nThe `GameSceneView` provides the surface on which your game will be rendered. The `IGameSceneManager` implementation allows you to load scenes into the `GameSceneView` and also then control the state of the scene (e.g. Pause, Stop, Start).\n\n#### XAML\n\nTo render the `GameSceneView` in XAML first add the namespace:\n\n```xaml\nxmlns:engine=\"clr-namespace:Orbit.Engine;assembly=Orbit.Engine\"\n```\n\nThen add the view itself as part of the content of your page:\n\n```xaml\n\u003cengine:GameSceneView x:Name=\"GameView\" /\u003e\n```\n\n**NOTE:** the GameSceneView inherits from [Microsoft.Maui.Graphics.GraphicsView](https://docs.microsoft.com/dotnet/maui/user-interface/graphics/) which gives a fair amount of touch based interaction should you need to. *Orbit will eventually provide an encapsulated way of tracking user based touch/click interaction.*\n\n#### C#\n\nIt is also possible to build your page with just C#. First add the following using:\n\n```csharp\nusing Orbit.Engine;\n```\n\nThen add the view itself as part of the content of your page:\n\n```csharp\npublic MyPage()\n{\n    Content = new GameSceneView();\n}\n```\n\n### Loading a scene\n\nOnce you have added your `GameSceneView` you need to use the `IGameSceneManager` implementation to call `LoadScene`.\n\n```csharp\npublic MyPage(IGameSceneManager gameSceneManager)\n{\n    gameSceneManager.LoadScene\u003cMainScene\u003e(GameView);\n}\n```\n\nThis will leave the scene in the `Loaded` state, in order to actually start the game you will need to call `gameSceneManager.Start()`.\n\n\u003e **Note**\n\u003e The lifetime of dependencies are scoped per call to `LoadScene` therefore if you register implementations as `AddScoped` with the `MauiAppBuilder` then you will get a new instance each time `LoadScene` is called. This works particularly well when you need a single instance for the life of a scene.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbijington%2Forbit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbijington%2Forbit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbijington%2Forbit/lists"}