{"id":13496808,"url":"https://github.com/STREGAsGate/GateEngine","last_synced_at":"2025-03-28T19:31:11.667Z","repository":{"id":159148070,"uuid":"591829037","full_name":"STREGAsGate/GateEngine","owner":"STREGAsGate","description":"Swift Game Engine supporting Windows, Linux, macOS, HTML5, and more 🚂","archived":false,"fork":false,"pushed_at":"2025-03-16T06:47:10.000Z","size":6498,"stargazers_count":366,"open_issues_count":24,"forks_count":12,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-03-27T06:08:25.807Z","etag":null,"topics":["cross-platform","directx","directx-12","game-engine","gamedev","html5","ios","linux","macos","metal","opengl","swift-game-engine","swift5","wasm","webassembly","webgl","windows"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/STREGAsGate.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","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":["STREGAsGate"],"patreon":"STREGAsGate","open_collective":null,"ko_fi":"STREGAsGate","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2023-01-22T01:56:10.000Z","updated_at":"2025-03-26T22:46:44.000Z","dependencies_parsed_at":"2024-03-26T02:31:19.247Z","dependency_job_id":"b8e2180b-102a-4858-8895-9d5ab55a121a","html_url":"https://github.com/STREGAsGate/GateEngine","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/STREGAsGate%2FGateEngine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/STREGAsGate%2FGateEngine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/STREGAsGate%2FGateEngine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/STREGAsGate%2FGateEngine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/STREGAsGate","download_url":"https://codeload.github.com/STREGAsGate/GateEngine/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246088445,"owners_count":20721688,"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":["cross-platform","directx","directx-12","game-engine","gamedev","html5","ios","linux","macos","metal","opengl","swift-game-engine","swift5","wasm","webassembly","webgl","windows"],"created_at":"2024-07-31T19:02:00.418Z","updated_at":"2025-03-28T19:31:11.644Z","avatar_url":"https://github.com/STREGAsGate.png","language":"Swift","readme":"# GateEngine\nA cross platform game engine for Swift that allows you to build 2D and 3D games.\u003c/br\u003e\nGateEngine includes intuitive APIs for loading resources, handling user inputs, and rendering content.\n\n## Platform Support:\n| Platform | CI | Graphics | Audio | Keyboard | Mouse | Touch | Gamepad |\n|---------:|:---|:---------|:------|:---------|:------|:------|:--------|\n| [**macOS**](https://apps.apple.com/us/app/xcode/id497799835) 10.15+ | [![](https://img.shields.io/github/actions/workflow/status/STREGAsGate/GateEngine/macOS.yml?label=Swift%206.0)](https://github.com/STREGAsGate/GateEngine/actions/workflows/macOS.yml) | ✔︎ | ✔︎ | ✔︎ | ✔︎ | ✔︎ | ✔︎ | \n| [**Windows**](https://www.swift.org/getting-started/#on-windows) 10,11 | ⚠️ | ✔︎ | ⛌ | ✔︎ | ✔︎ | ⛌ | ✔︎ |\n| [**Linux**](https://www.swift.org/getting-started/#on-linux) | ⚠️ | ✔︎ | ✔︎ | ✔︎ | ✔︎ | ⛌ | ✔︎\n| [**iOS**](https://apps.apple.com/us/app/xcode/id497799835) 13.0+\u003c/br\u003e[**iPadOS**](https://apps.apple.com/us/app/xcode/id497799835) 13.0+\u003c/br\u003e[**tvOS**](https://apps.apple.com/us/app/xcode/id497799835) 13.0+ | [![](https://img.shields.io/github/actions/workflow/status/STREGAsGate/GateEngine/iOS-tvOS.yml?label=Swift%206.0)](https://github.com/STREGAsGate/GateEngine/actions/workflows/iOS-tvOS.yml) | ✔︎\u003c/br\u003e✔︎\u003c/br\u003e✔︎ | ✔︎\u003c/br\u003e✔︎\u003c/br\u003e✔︎ | ✔︎\u003c/br\u003e✔︎\u003c/br\u003e✔︎ | ⛌\u003c/br\u003e✔︎\u003c/br\u003e⛌ | ✔︎\u003c/br\u003e✔︎\u003c/br\u003e⛌ | ✔︎\u003c/br\u003e✔︎\u003c/br\u003e✔︎\n| **Android**¹ | ⚠️ | ⛌ | ⛌ | ⛌ | ⛌ | ⛌ | ⛌\n| [**HTML5**](https://book.swiftwasm.org/getting-started/setup.html) | ⚠️ | ✔︎ | ✔︎ | ✔︎ | ✔︎ | ✔︎ | ✔︎ | \n\nComplete: ✔︎ | Incomplete: ⛌ | Partial: ◑\n\u003csub\u003e\n\u003c/br\u003e¹Pending a community made cross compile SDK.\n\u003c/br\u003e⚠️ Development of this platform is slowed while the core engine is completed.\n\u003c/sub\u003e\n\n## About\nGateEngine is designed to give game developers access to approachable and intuitive APIs to code a game using Swift.\n\n### Math\nGateEngine has a custom math library completely coded in Swift. \nGameMath allows developers to write math functions using a spoken language style API. \nGameMath uses context aware types like `Position3`, `Direction3`, and `Size3`. \nThis adds an additional layer of understanding to APIs due to the inherent context each type provides.\n```swift\nlet position: Position3 = Position3(0, 1, 0) * Size3(1, 1, 1)\n...\nlet moved: Position3 = position.moved(units, toward: direction)\n...\nlet reflected: Direction3 = direction.reflected(off: surfaceNormal)\n...\nlet halfway = source.interpolated(to: destination, .linear(0.5))\n```\n\n### Resources\nGateEngine has a simple and intuitive resource loading and caching API. \nResources can be constructed instantly and are non-blocking. \nThe reference returned is a cache handle and creating multiple instances of the same resource will return the same cache handle. \nSo you don't need to worry about managing your resources. \nYou can simply create resources wherever you need.\n```swift\n// Load geometry\nlet geometry = Geometry(path: \"model.obj\")\n\n// Reused the same cache as above. No load required.\nlet theSameGeometry = Geometry(path: \"model.obj\")\n```\nA resource state lets you know when a resource is ready to be used. \nIn many situations the resource state is checked automatically, like when rendering. \nThe renderer will automatically skip resources that aren't ready.\nBut in some situations you may need to check the resource state manually.\n```swift\nlet tileMap = TileMap(path: \"tilemap.tmj\")\n...\nif tileMap.state == .ready {\n    // ready to be accessed\n}\n```\n\nGateEngine tucks error handling away. \nA resource failing to load is usually a development error in games. \nIt's not typically a runtime error that needs to be handled.\n\nWriting do-try-catch for every resource would become tedious so GateEngine places errors in the resource state.\nThis allows you to code the game as if the resource was a value type.\n\nResource errors are logged automatically so you don't usually need to check them.\n```sh\n[GateEngine] warning: Resource \"tileSet.tsj\" failedToLocate\n[GateEngine] warning: Resource \"tileMap.tmj\" failedToLocate\n```\n\nBut if you would like to design a fail-able resource handling mechanism, you can do so by checking for the error in the resource state.\n```swift\nif case .failed(let error) = resource.state {\n    // This error was already output as a warning\n}\n```\n\n### Rendering\nGateEngine uses a high level rendering API designed to be flexible and customizable. \nRendering is done in the order things are added allowing you to easily reason about the outcome.\n```swift\n// Create a 2D draw container\nvar canvas = Canvas()\n\n// Draw a sprite at a specific location \ncanvas.insert(sprite, at: position)\n\n// Draw the canvas inside the window\nwindow.insert(canvas)\n```\n\u003csub\u003eAdvanced users can also leverage the lower level DrawCommand API for even more customizability.\u003c/sub\u003e\n\n### Shaders\nIn most cases, shaders are handled automatically. \nHowever if you need to make a custom shader, GateEngine provides an easy and intuitive solution.\n\nGateEngine uses a Swift based shader API that allows you to write your shaders directly within your project. \nThe shaders automatically work on every platform, and there is no cross-compile tools or files to mess with.\n```swift\n// \"Vertex Colors\" vertex shader written in Swift\nlet vsh = VertexShader()\nlet mvp = vsh.modelViewProjectionMatrix\nlet vertexPosition = vsh.input.geometry(0).position\nvsh.output.position = mvp * Vec4(vertexPosition, 1)\nvsh.output[\"color\"] = vsh.input.geometry(0).color\n\n// \"Tinted Texture\" fragment shader written in Swift\nlet fsh = FragmentShader()\nlet sample = fsh.channel(0).texture.sample(\n    at: fsh.input[\"texCoord0\"]\n)\nfsh.output.color = sample * fsh.channel(0).color\n```\n\u003csub\u003e*Shaders are currently under development and are missing some functionality.*\u003c/sub\u003e\n\n## Getting Started\nAdd the package to your project like any other package.\n```swift\n.package(url: \"https://github.com/STREGAsGate/GateEngine.git\", .upToNextMinor(from: \"0.1.0\"))\n```\n\u003csub\u003e*iOS/tvOS require an Xcode project. You cannot use a Swift Package Manager executable for iOS or tvOS.*\u003c/sub\u003e\n\n### Linux Specific Setup\nFor Linux you must install dev packages for OpenGL and OpenAL.\nOn Ubuntu the following terminal commands will install the needed packages:\n```sh\nsudo apt-get update --fix-missing\nsudo apt-get install freeglut3-dev\nsudo apt-get install libopenal-dev\n```\n\n# Examples\nA suite of example projects is available at [GateEngine Demos](https://github.com/STREGAsGate/GateEngineDemos).\u003c/br\u003e\nThese examples cover a variety of topics including Rendering, User Input and Scripting.\n\n# Support GateEngine!\nGateEngine relies on community funding.\nIf you appreciate this project, and want it to continue, then please consider putting some currency into it.\nEvery little bit helps! \u003c/br\u003e\nSupport With:\n[GitHub](https://github.com/sponsors/STREGAsGate),\n[Ko-fi](https://ko-fi.com/STREGAsGate),\nor\n[Patreon](https://www.patreon.com/STREGAsGate).\n\n## Community \u0026 Followables\nA GateEngine development blog is published on Discord [here](https://discord.gg/PfqFwQPV96).\u003c/br\u003e\nDiscord is also a great place to ask questions or show off your creations.\n\n[![Discord](https://img.shields.io/discord/641809158051725322?label=Hang%20Out\u0026logo=Discord\u0026style=social)](https://discord.gg/5JdRJhD)\n[![Twitter](https://img.shields.io/twitter/follow/stregasgate?style=social)](https://twitter.com/stregasgate)\n[![YouTube](https://img.shields.io/youtube/channel/subscribers/UCBXFkK2B4w9856wBJfCGufg?label=Subscribe\u0026style=social)](https://youtube.com/stregasgate)\n[![Reddit](https://img.shields.io/reddit/subreddit-subscribers/stregasgate?style=social)](https://www.reddit.com/r/stregasgate/)\n\n# History\nGateEngine started its life in 2016 as a \"for fun\" project that used the typical strategy, for hobby game engine projects, of high performance and small footprint. \nIt used a scene graph and only worked on Apple devices using OpenGL.\n\n![Engine Creation 01](https://github.com/STREGAsGate/GateEngine/blob/main/.github/resources/EngineCreation01.jpg?raw=true)\n\nI created a deferred renderer, which is a technique that can reduce work for extremely complicated triple-A games. \nAt the time I thought this was the greatest thing ever and I really enjoyed learning about.\n\n![Engine Creation 02](https://github.com/STREGAsGate/GateEngine/blob/main/.github/resources/EngineCreation02.jpg?raw=true)\n\nThen I added lighting, which was again a really fun learning process. \nBeing able to see results on screen is very motivating and I'm sure that's why most game engines start out as graphics libraries.\n\n![Engine Creation 03](https://github.com/STREGAsGate/GateEngine/blob/main/.github/resources/EngineCreation03.jpg?raw=true)\n\nAnd then I added shadow and normal mapping.\n\n![Engine Creation 04](https://github.com/STREGAsGate/GateEngine/blob/main/.github/resources/EngineCreation04.jpg?raw=true)\n\nEventually I added skinning and UI.\nAnd I created a 3D model of myself as a test. \nThis is an early attempt at loading files from the COLLADA format.\nSomething was still a little off, but I did eventually fix it 😜\n\n![Engine Creation 05](https://github.com/STREGAsGate/GateEngine/blob/main/.github/resources/EngineCreation05.gif?raw=true)\n\nAnd I still needed to actually build the \"engine\" part. At this point the engine was just a graphics simulation.\nDrawing stuff is actually a fairly small portion of what a game engine does.\nI eventually learned about collision and different data techniques like Entity-Component-System.\n\nAnd thats when I started the re-writes...\n\nDeveloping an engine is a large learning process. \nEvery time you come up with a good way to do it, you will come up with a better way before you're done implementing the previous way.\nAt the beginning, iterations are complete rewrites and over time the iterations become more fine grained.\n\nSlowly, my skill at making engines caught up to the designs I was creating and GateEngine began to stabilize. \nIt was at this point that I realized I wasn't making any games.\nI was just building tech demos.\n\nSo I decided on my first 3D game. Espionage is a 3D stealth action game that I'm still working on today. \nIt's inspired by the games I grew up with, and it's the kind of game I always wanted to make.\n\n![Espionage Screenshot](https://github.com/STREGAsGate/GateEngine/blob/main/.github/resources/EspionageScreenshot.jpg?raw=true)\n\nIt's a very big project and it will likely take me a very long time to finish it as a solo developer.\nI personally prefer large projects. \n\nI haven't yet been enticed to join a game jam, but perhaps that would be fun experience to try at some point. \nMaybe we'll have a GateJam someday!\n\nAnyway, GateEngine was a massive undertaking, and was created to be enjoyed. \nSo go make something awesome of your own!\n","funding_links":["https://github.com/sponsors/STREGAsGate","https://patreon.com/STREGAsGate","https://ko-fi.com/STREGAsGate","https://www.patreon.com/STREGAsGate"],"categories":["Swift"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSTREGAsGate%2FGateEngine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSTREGAsGate%2FGateEngine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSTREGAsGate%2FGateEngine/lists"}