{"id":26600841,"url":"https://github.com/bobgeis/nimspacerocks","last_synced_at":"2025-08-26T01:19:03.945Z","repository":{"id":71039310,"uuid":"221936349","full_name":"bobgeis/nimSpaceRocks","owner":"bobgeis","description":"Asteroids using nim -\u003e js: https://bobgeis.github.io/nimSpaceRocks","archived":false,"fork":false,"pushed_at":"2019-12-02T23:35:19.000Z","size":285,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-23T18:48:11.825Z","etag":null,"topics":["asteroids","canvas","game","html5","nim","nim-lang","nim-language"],"latest_commit_sha":null,"homepage":"","language":"Nim","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/bobgeis.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2019-11-15T14:06:44.000Z","updated_at":"2022-10-26T23:31:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"e526b3f5-74a4-40ad-b5bb-20555e6cb0f7","html_url":"https://github.com/bobgeis/nimSpaceRocks","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bobgeis/nimSpaceRocks","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobgeis%2FnimSpaceRocks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobgeis%2FnimSpaceRocks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobgeis%2FnimSpaceRocks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobgeis%2FnimSpaceRocks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bobgeis","download_url":"https://codeload.github.com/bobgeis/nimSpaceRocks/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobgeis%2FnimSpaceRocks/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272156292,"owners_count":24883218,"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","status":"online","status_checked_at":"2025-08-25T02:00:12.092Z","response_time":1107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["asteroids","canvas","game","html5","nim","nim-lang","nim-language"],"created_at":"2025-03-23T18:35:39.292Z","updated_at":"2025-08-26T01:19:03.932Z","avatar_url":"https://github.com/bobgeis.png","language":"Nim","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# nimSpaceRocks\n\nAn asteroids game written to learn nim.  Written targeting the js backend.\n\n[**Play it here**](https://bobgeis.github.io/nimSpaceRocks)\n\n## Controls\n\n* Arrow Keys or WASD move the player ship.\n* Spacebar fires the disruptor and unpauses the game.\n* Escape starts a new game.\n* Enter unpauses and pauses the game.\n* While paused, press Left and Right to time travel.\n* While paused, press Down to save to browser local storage.\n\n## Objectives\n\nOh no! Some hooligans are dumping space rocks into Subspace Locus 1457 again!\n\nLuckily, a dedicated rescue and rock-buster ship is already prepped and on site.  That's you!\n\n* Try to keep Subspace Locus 1457 safe for travelers by busting rocks.\n* Bring any escape pods you rescue to the hospital station in the upper right.  You will be rewarded with a temporary enhancement to your weapon.\n* Bring any valuable minerals you happen to collect to the refinery base in the lower left.  You will be rewarded with a temporary enhancement to your weapon.\n* If you get into a jam or if you have to abandon ship, use the Omega-13.  It will let you go back in time up to 13 seconds. \"Enough time to undo one mistake.\" ~Commander Taggart\n* Good luck!\n\n## Attributions\n\n* [Image of the Carina Nebula](https://commons.wikimedia.org/wiki/File:Carina_Nebula.jpg) as a background.  Used under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).  Credit to [ESO/T. Preibisch](http://www.eso.org/public/images/eso1208a/).\n\n* [flatted](https://github.com/WebReflection/flatted) for serializing.  Used under [ISC license](https://github.com/WebReflection/flatted/blob/master/LICENSE). Credit to Andrea Giammarchi, @WebReflection.\n\n* [terser](https://github.com/terser-js/terser) for shrinking the release script.  Used under [BSD license](https://github.com/terser-js/terser/blob/master/LICENSE).\n\n## Developers\n\n### Prerequisites\n\n* [The Nim programming language](https://nim-lang.org/) - We're using nim's javascript backend.  We're also using some of the tools that come with it, such as nimble.\n\n* [flatted.js](https://github.com/WebReflection/flatted) - We're using this to serialize nim-in-js datastructures so we can put them in localStorage.  This was mostly an exercise in typing a javascript library.  Surprisingly straightforward!\n\n* [terser](https://github.com/terser-js/terser) - We're using this to minify the produced javascript after nim is done producing it.\n\n### Developing\n\nWith the above requirements met, cd into this folder.\n\nTo build a dev version: `nimble dev`\nTo build a release version: `nimble prod`\nTo start a [local server](http://localhost:8000/): `nimble serve`\n\nI used vscode with the [nim extension](https://marketplace.visualstudio.com/items?itemName=kosz78.nim) with build on save.  I also recommend using [indent-rainbow](https://marketplace.visualstudio.com/items?itemName=oderwat.indent-rainbow).\n\nWhile playing, you can press the \"l\" key to log the current game state to the console.\n\n### Notes on Code Layout\n\n* src/nimSpaceRocks.nim is the main entry point.  It does some very basic set up.\n\n* src/game.nim does most of the actual work in its procs.  A \"Game\" object represents the total game state.\n\n* src/scene.nim contains the type def for a game \"Scene\".  However, most of the procs that manipulate it are in game.nim.  Note that while a Scene is what you see on the screen at any given moment, there's more to the game that one Scene (such as the previous Scenes stored in the timeline!).\n\n* Utility/helper functions/procs that are not specific to this game, are in src/helper.  This includes typings for browser APIs that are not part of the standard lib (such as HTML5 canvas wrappers).\n\n* Utility/helper functions/procs that *are* specific to this game, are in src/common.\n\n* For the game entities, I'm putting their types and basic functions in the src/objs.  A function/proc is basic if it depends on no other types of game entities.\n\n* For procs/systems that require multiple kinds of interacting game entities, I'm putting those procs into src/interact.  This is to avoid circular dependencies.  Each interaction is named for the two kinds of things that are interacting (alphabetically), so code that collides bullets with rocks is in \"bulletrock.nim\".\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbobgeis%2Fnimspacerocks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbobgeis%2Fnimspacerocks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbobgeis%2Fnimspacerocks/lists"}