{"id":37123118,"url":"https://github.com/tston529/boredgame","last_synced_at":"2026-01-14T14:13:25.379Z","repository":{"id":57558915,"uuid":"319212859","full_name":"tston529/boredgame","owner":"tston529","description":"Ascii game engine whose board state can be rendered through calls to the Mattermost API","archived":false,"fork":false,"pushed_at":"2020-12-23T18:15:07.000Z","size":1280,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-06-20T10:22:33.139Z","etag":null,"topics":["game-engine-prototype","go"],"latest_commit_sha":null,"homepage":"","language":"Go","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/tston529.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-12-07T05:25:03.000Z","updated_at":"2024-06-20T10:22:33.141Z","dependencies_parsed_at":"2022-09-18T04:22:00.537Z","dependency_job_id":null,"html_url":"https://github.com/tston529/boredgame","commit_stats":null,"previous_names":["tston529/mattermost-game-engine"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/tston529/boredgame","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tston529%2Fboredgame","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tston529%2Fboredgame/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tston529%2Fboredgame/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tston529%2Fboredgame/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tston529","download_url":"https://codeload.github.com/tston529/boredgame/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tston529%2Fboredgame/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28422414,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T13:30:50.153Z","status":"ssl_error","status_checked_at":"2026-01-14T13:29:08.907Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["game-engine-prototype","go"],"created_at":"2026-01-14T14:13:24.882Z","updated_at":"2026-01-14T14:13:25.363Z","avatar_url":"https://github.com/tston529.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# boredgame\nASCII game engine whose board state will be rendered through calls to the Mattermost API  \n\n[![Build status](https://img.shields.io/appveyor/build/tston529/boredgame?style=for-the-badge)](https://ci.appveyor.com/project/tston529/boredgame/branch/main)\n\nNOTE: Requires Go v1.13 or above, there's specific error handling in the Mattermost api package that was only released starting in that version.\n\ninstalling: \n`go get -u github.com/tston529/boredgame`\n\nTo run on mattermost, define a \\*.yaml file with the structure:\n```yaml\nuser: \"\u003cusername\u003e\"\npass: \"\u003cpassword\u003e\"\nserverurl: \"\u003cmattermost server url\u003e\"\nteamname: \"\u003cmattermost team\u003e\"\n```\n\ngame data is also a yaml file, in the structure:\n```yaml\n---\nmap:\n  filename: \"path/to/map/file.txt\"\n  data:\n    x: !!int # width of map\n    y: !!int # height of map\n    # more custom game-specific data is allowed here if desired\ntiles:\n  tile_name_1:\n    ascii: !!str\n    data:\n      # optional; custom game-specific data goes here\n  ...\n  tile_name_n:\n    ascii: !!str\n    data:\n      # optional; custom game-specific data goes here\nactors:\n  actor_name_1:\n    ascii: !!str\n    data:\n      # optional; custom game-specific data goes here\n  ...\n  actor_name_n:\n    ascii: !!str\n    data:\n      # optional; custom game-specific data goes here\n\n# only necessary for emoji-based games, this defines tilesets used in message boxes.\n# However, all are mandatory if emoji-based message boxes are desired.\nmessage: \n  blank: !!str # used for filling in blank space.\n  msg_vert: !!str # vertical edge of box\n  msg_horiz: !!str # horizontal edge of box\n  corner: !!str # corner of box (emoji equivalent of ascii art '+')\n\n  # message will be rendered using emoji as well, make sure they\n  # are labeled consistently (e.g. \":scrabble_a:, :scrabble_b:, :scrabble_c:, etc.\")\n  alpha_prefix: !!str \n```\n\nBoilerplate code for getting a game to render on mattermost:\n```go\nimport (\n  \"github.com/tston529/boredgame\" // invoke methods from `engine`\n  \"github.com/tston529/boredgame/mmrender\" // invoke methods from `mmrender`\n\n  // this is less-important, util is a subpackage for dumping helper functions not directly related to the engine\n  // \"github.com/tston529/boredgame/util\" // invoke methods from `util`\n)\n// Handle command line args, namely destination channel or user. The rest of the mattermost \n// credentials (username, password, url, team) are set in a yaml file read in a call to\n// `LoadMattermostData(filename string) MattermostData`.\nmmUser := flag.String(\"user\", \"\", \"The user to receive the DM of the game\")\nmmChannel := flag.String(\"channel\", \"\", \"The channel to receive the game message\")\n\n// I made this engine with custom emojis in mind. In your game's main yaml data file, you are\n// to set the text to be rendered for each tile and actor, under the yaml header `ASCII`.\n// These can be emoji tags (e.g. \":my_custom_emoji:\")\n// If you choose not to use emoji and have this flag set to false, the message will turn out \n// messy since the font used is not monospaced, so make sure this flag is set (true by default) \n// when not using emoji.\nmmPreformatted := flag.Bool(\"pre\", true, \"Whether to wrap each frame in backticks to be rendered as preformatted text on Mattermost.\")\nflag.Parse()\n\nif *mmUser != \"\" \u0026\u0026 *mmChannel != \"\" {\n    fmt.Println(\"Can't specify both user and channel, choose one or the other.\")\n    os.Exit(1)\n}\n\n// determines what rendering strategy to use (`cli` uses escape sequences to smoothly update each frame)\nvar cli bool\nif *mmUser != \"\" || *mmChannel != \"\" {\n    cli = false\n}\n\nif !cli {\n    if *mmPreformatted {\n        preBeginWrap = \"```\\n\" // Until I care enough to write better code, I defined these as globals in my tests.\n        preEndWrap = \"\\n```\"\n    } else {\n        preBeginWrap = \"\"\n        preEndWrap = \"\"\n    }\n    mmData := mm_render.LoadMattermostData(\"./path/to/mattermost-credentials.yml\")\n\n    mm_render.StartMattermostClient(mmData.ServerUrl, mmData.User, mmData.Pass)\n    if *mmUser != \"\" {\n        mm_render.GetDirectMessageChannel(*mmUser)\n    } else if *mmChannel != \"\" {\n        mm_render.FindTeam(mmData.TeamName)\n        mm_render.GetChannel(*mmChannel)\n    }\n\n  // This PostMessage is only to be called once -\u003e it saves the post metadata under the hood\n  // which it will use to update the message with the newly-generated frame.\n    mm_render.PostMessage(\"Starting game\")\n}\n\ngameData = engine.LoadGameData(\"./path/to/game-data.yml\")\n\n/*\n   ...\n   I wrote the majority of my game's loops as anonymous goroutines, I invoke them here.\n   ...\n*/\n\n// Core loop; continue rendering each frame until all player's lives are lost.\nfor !exit {\n    if cli {\n        // Feel free to copy-paste this line until I write a smarter line generator.\n        // Until then, change the \"27\" at the end to the height of your string (total lines rendered)\n        fmt.Printf(\"\\x1b[0E\\x1b7%s%s\\x1b[K\\x1b[2G\\x1b[27A\", gameMap, player1.Hud())\n    } else {\n        // This is partly where making the preformatting wraps global comes in useful.\n        mm_render.SendNextFrame(fmt.Sprintf(\"%s%s%s%s\", preBeginWrap, gameMap, player1.Hud(), preEndWrap))\n    }\n    // render at 10fps. Just right for a text-based board-style game, especially if you're concerned about Mattermost rate limits. \n    time.Sleep(100 * time.Millisecond)\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftston529%2Fboredgame","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftston529%2Fboredgame","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftston529%2Fboredgame/lists"}