{"id":16904188,"url":"https://github.com/mikea/ztd","last_synced_at":"2025-03-20T15:28:13.075Z","repository":{"id":66441905,"uuid":"565543955","full_name":"mikea/ztd","owner":"mikea","description":"Zig Tower Defense","archived":false,"fork":false,"pushed_at":"2023-01-16T18:19:35.000Z","size":3723,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-25T14:42:14.793Z","etag":null,"topics":["data-oriented-design","game","game-engine-2d","tower-defense","zig","ziglang"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mikea.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-13T18:33:33.000Z","updated_at":"2023-02-26T21:29:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"121be17f-69d2-4d6c-a95a-372bce2a6712","html_url":"https://github.com/mikea/ztd","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/mikea%2Fztd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikea%2Fztd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikea%2Fztd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikea%2Fztd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mikea","download_url":"https://codeload.github.com/mikea/ztd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244639264,"owners_count":20485855,"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":["data-oriented-design","game","game-engine-2d","tower-defense","zig","ziglang"],"created_at":"2024-10-13T18:32:02.842Z","updated_at":"2025-03-20T15:28:13.064Z","avatar_url":"https://github.com/mikea.png","language":"C++","readme":"# ZTD\n\nZig Tower Defense\n\nStatus: Technological demo\n\n## About\n\nThis game was written by me during fall 2022 holidays to learn Zig and Data Oriented Design approach.\nIt contains a highly optimized 2D sprite engine with custom OpenGL-based renderer.\n\nTo let the DOD shine, this project's goal was to push performance boundaries of the number of\nunits present in the simulation.\nCurrently on `Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz` the engine achieves up to\n10*10^6 units/sec of single-threaded performance.\n\n## Runtime Requirements\n\n- Linux with following packages: `libglfw3-dev`\n- Windows 64\n\n## Usage\n\nStart: `./ztd` or `./ztd \u003clevel\u003e`.\nAvailable levels: `level1`, `level2`, `level3`, `stress1`\n\nKeys:\n\n- PgUp/PgDn, Mouse Wheel - zoom\n- B - build mode\n- ESC - exit build mode, clear selection\n- q - quit\n\n## Development\n\nRequirements:\n\n- linux, `libglfw3-dev` package\n- Zig 0.11 (I use [zigup](https://github.com/marler8997/zigup) to fetch master version)\n\nCommands:\n\n- `zig build`\n- `zig build run`\n- `zig build run -Drelease-fast=true -- [\u003clevel\u003e]`\n\n## Docker multiplatform build\n\n`./dev.sh dist` will build linux and win64 release .zip archives.\n\n## Code Organization\n\nUnderlying data structures:\n\n- [src/geom.zig](src/geom.zig) - 2d geometry primitives\n- [src/sparse_set.zig](src/sparse_set.zig) - sparse set implementation\n- [src/denset_set.zig](src/denset_set.zig) - denset set implementation\n- [src/r_tree.zig](src/r_tree.zig) - R Tree\n- [src/table.zig](src/table.zig) - fast table of records and table of bounds\n- [src/rects.zig](src/rects.zig) - SIMD-friendly columnar []Rect\n\nGame engine:\n\n- [src/gl.zig](src/gl.zig) - OpenGL interface code\n- [src/imgui.zig](src/imgui.zig) - imgui interface code\n- [src/shaders.zig](src/shaders.zig) - opengl shaders utilities\n- [src/rendering.zig](src/rendering.zig) - different shader renderers\n- [src/sprites.zig](src/sprites.zig) - sprite atlas building and rendering\n- [src/viewport.zig](src/viewport.zig) - viewport calculations and update\n- [src/engine.zig](src/engine.zig) - game engine\n- [src/engine_testbed.zig](src/engine_testbed.zig) - simple testbed to debug the engine\n\nGame:\n\n- [src/model.zig](src/model.zig) - model objects stored in table\n- [src/game.zig](src/game.zig) - game logic\n- [src/resources.zig](src/resources.zig) - game resources\n- [src/levels.zig](src/levels.zig) - game levels\n- [src/ui.zig](src/ui.zig) - game UI and user interaction\n- [src/data.zig](src/data.zig) - units and buildings data (hp, damage, etc)\n- [src/main.zig](src/main.zig) - main entry poitn and game loop\n\n## License\n\n- code in `src/` is licensed under GPL3.\n- code in `lib/` is licensed under respective original licenses.\n- [mini world sprites](https://opengameart.org/content/miniworld-sprites) are licensed under CC0\n- [rubik font](https://fonts.google.com/specimen/Rubik/about) is licensed under Open Font License\n\n## Screenshot\n\n\u003cimg src=\"docs/Screenshot from 2023-01-16 10-16-28.png\" width=\"400\" /\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikea%2Fztd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmikea%2Fztd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikea%2Fztd/lists"}