{"id":13741297,"url":"https://github.com/zenith391/didot","last_synced_at":"2025-05-08T21:33:33.390Z","repository":{"id":53833265,"uuid":"294902144","full_name":"zenith391/didot","owner":"zenith391","description":"Zig 3D game engine.","archived":true,"fork":false,"pushed_at":"2021-10-26T11:00:40.000Z","size":40010,"stargazers_count":84,"open_issues_count":1,"forks_count":1,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-08-04T04:07:37.337Z","etag":null,"topics":["game-engine","game-engine-3d","high-level","high-level-api","zig"],"latest_commit_sha":null,"homepage":"","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zenith391.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-09-12T08:24:09.000Z","updated_at":"2024-03-04T05:34:13.000Z","dependencies_parsed_at":"2022-08-22T13:40:37.233Z","dependency_job_id":null,"html_url":"https://github.com/zenith391/didot","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zenith391%2Fdidot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zenith391%2Fdidot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zenith391%2Fdidot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zenith391%2Fdidot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zenith391","download_url":"https://codeload.github.com/zenith391/didot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224774748,"owners_count":17367789,"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":["game-engine","game-engine-3d","high-level","high-level-api","zig"],"created_at":"2024-08-03T04:00:57.612Z","updated_at":"2024-11-15T11:31:09.288Z","avatar_url":"https://github.com/zenith391.png","language":"Zig","funding_links":[],"categories":["Libraries"],"sub_categories":[],"readme":"# Didot\nA Zig 3D game engine.\n\n---\n\n![Demo featuring skybox, karts, grass and a cube](https://raw.githubusercontent.com/zenith391/didot/master/examples/kart-and-cubes.png)\n\n## Introduction\n\nDidot is a multi-threaded 3D game engine programmed in Zig and aimed at high-level constructs: you manipulate game objects and meshes instead of OpenGL calls and batches.\n\nIt improves developers life by splitting the engine into multiple modules in order to have easier porting to other platforms. For example, you can change the windowing module from `didot-glfw` to `didot-x11` to use Xlib instead of depending on GLFW without any change to your game's code, as porting (except for shaders) is transparent to the developer's code.\n\n## Installation\nPrerequisites:\n- Zig compiler (`master` branch, didot is currently tested with commit `0aef1fa`)\n\nYou only need to launch your terminal and execute those commands in an empty directory:\n```sh\ngit clone https://github.com/zenith391/didot\nzig init-exe\n```\nAnd then, change the resulting `build.zig` file looks like this:\n```zig\nconst didot = @import(\"didot/build.zig\");\nconst Builder = @import(\"std\").build.Builder;\n\npub fn build(b: *Builder) void {\n    // ...\n    exe.setBuildMode(mode);\n    try didot.addEngineToExe(exe, .{\n        .prefix = \"didot/\"\n    });\n    exe.install();\n    // ...\n}\n```\n\n## Using Didot\nShowing a cube:\n```zig\nconst std = @import(\"std\");\nconst zlm = @import(\"zlm\");\nusingnamespace @import(\"didot-graphics\");\nusingnamespace @import(\"didot-objects\");\nusingnamespace @import(\"didot-app\");\n\nconst Vec3 = zlm.Vec3;\nconst Allocator = std.mem.Allocator;\n\nfn init(allocator: *Allocator, app: *Application) !void {\n    var shader = try ShaderProgram.create(@embedFile(\"vert.glsl\"), @embedFile(\"frag.glsl\"));\n\n    var camera = try GameObject.createObject(allocator, null);\n    camera.getComponent(Transform).?.* = .{\n        .position = Vec3.new(1.5, 1.5, -0.5),\n        .rotation = Vec3.new(-120.0, -15.0, 0).toRadians()\n    };\n    try camera.addComponent(Camera { .shader = shader });\n    try app.scene.add(camera);\n    \n    var cube = try GameObject.createObject(allocator, \"Mesh/Cube\");\n    cube.getComponent(Transform).?.position = Vec3.new(-1.2, 0.75, -3);\n    try app.scene.add(cube);\n}\n\npub fn main() !void {\n    var gp = std.heap.GeneralPurposeAllocator(.{}) {};\n    const allocator = \u0026gp.allocator;\n\n    var scene = try Scene.create(allocator, null);\n    comptime var systems = Systems {};\n    var app = Application(systems) {\n        .title = \"Test Cube\",\n        .initFn = init\n    };\n    try app.run(allocator, scene);\n}\n```\n\nAnd to make that into a textured cube, only a few lines are necessary:\n```zig\ntry scene.assetManager.put(\"Texture/Grass\", try TextureAsset.init2D(allocator, \"assets/textures/grass.png\", \"png\"));\nvar material = Material { .texturePath = \"Texture/Grass\" };\ncube.material = material;\n```\nFirst line loads `assets/textures/grass.png` to `Texture/Grass`.  \nSecond line creates a Material with the `Texture/Grass` texture.  \nThird line links the cube to the newly created Material.\n\nYou can also look at the [example](https://github.com/zenith391/didot/blob/master/examples/test-portal/example-scene.zig) to see how to make camera movement or load models from OBJ files or even load scenes from JSON files.\n\nSystems (currently):\n```zig\nfn exampleSystem(query: Query(.{*Transform})) !void {\n    var iterator = query.iterator();\n    while (iterator.next()) |o| {\n        std.log.info(\"Someone's at position {} !\", .{o.transform.position});\n    }\n}\n\npub fn main() !void {\n    // ...\n    comptime var systems = Systems {};\n    systems.addSystem(exampleSystem);\n    var app = Application(systems) {\n        .title = \"Test Cube\",\n        .initFn = init\n    };\n    try app.run(allocator, scene);\n}\n```\n\n[API reference](https://zenith391.github.io/didot/#root)\n\n## Features\n- [Scene editor](https://github.com/zenith391/didot-editor)\n- Assets manager\n- OpenGL backend\n  - Shaders\n  - Meshes\n  - Materials\n  - Textures\n- Windowing\n  - GLFW backend\n  - X11 backend\n- Model loader\n  - OBJ files\n- Image loader\n  - BMP files\n  - PNG files\n- Application system for easier use\n- Game objects system\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzenith391%2Fdidot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzenith391%2Fdidot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzenith391%2Fdidot/lists"}