{"id":20619041,"url":"https://github.com/tessapower/snek","last_synced_at":"2026-05-14T22:47:08.450Z","repository":{"id":64603730,"uuid":"576601918","full_name":"tessapower/snek","owner":"tessapower","description":"A simple remake of the classic game Snake, built in Java and with my own TEngine.","archived":false,"fork":false,"pushed_at":"2022-12-19T08:56:40.000Z","size":77505,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-17T05:07:55.756Z","etag":null,"topics":["game","game-engine","java17","maven","snake-game","snek"],"latest_commit_sha":null,"homepage":"https://tessapower.github.io/snek/","language":"Java","has_issues":false,"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/tessapower.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":"2022-12-10T11:22:53.000Z","updated_at":"2024-05-22T00:48:12.000Z","dependencies_parsed_at":"2023-01-29T21:01:02.047Z","dependency_job_id":null,"html_url":"https://github.com/tessapower/snek","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tessapower%2Fsnek","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tessapower%2Fsnek/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tessapower%2Fsnek/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tessapower%2Fsnek/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tessapower","download_url":"https://codeload.github.com/tessapower/snek/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242277652,"owners_count":20101536,"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","game-engine","java17","maven","snake-game","snek"],"created_at":"2024-11-16T12:10:19.136Z","updated_at":"2026-05-14T22:47:08.443Z","avatar_url":"https://github.com/tessapower.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `snek!` ![snek](https://user-images.githubusercontent.com/25911223/206885551-74c5e2ef-65f3-44d0-a13a-7d6d6f83317e.gif)\n\n[![Java CI with Maven](https://github.com/tessapower/snek/actions/workflows/maven-build.yml/badge.svg)](https://github.com/tessapower/snek/actions/workflows/maven-build.yml)\n[![Javadoc](https://github.com/tessapower/snek/actions/workflows/javadoc.yml/badge.svg)](https://github.com/tessapower/snek/actions/workflows/javadoc.yml)\n[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/tessapower/snek/blob/main/LICENSE)\n\n[→ Documentation](https://tessapower.github.io/snek)\n\nA simple remake of the classic game Snake (with a few flourishes!) using my own 2D game\nengine, [TEngine](https://github.com/tessapower/tengine).\n\n![Gameplay](./docs/game-play.gif)\n\n\u003e **Note**\n\u003e\n\u003e This was my very first game, and looking back on it now, there are a lot of improvements I'd make.\n\u003e The architecture is slightly more reminiscent of a GUI library than what you would expect from a\n\u003e game engine. In any case, here it is preserved for the sake of nostalgia! :)\n\n## Requirements\n\n- Minimum Java SE 17+\n- IntelliJ, Eclipse, or your favourite Java editor\n- Maven (install locally for command-line-only builds)\n\n## How to run `snek!`\n\nThis project uses the Maven build system. My editor of choice is IntelliJ, so there is a ready-made\nrun configuration included in this project called \"Run Game\". If your editor supports\nMaven, you can run the `install` goal and launch the `snek.jar` found in `snake/target`\ndirectory. Otherwise, you can build and run the game from the command line.\n\nBuilding the project from the command line requires you to have Maven installed locally, so `brew\ninstall maven` or `choco install maven` or however you need to with your package manager of choice.\n\nThen enter the following commands from the project root:\n\n```shell\n# install dependencies and build\nmvn install\n# run the game\njava -jar snake/target/snek.jar\n```\n\n## How to play `snek!`\n\nSnake is a bit of a rite of passage, so we all know the rules. Use the arrow keys (or W-A-S-D if\nyou are player two), to move around the world. Eat the apples, try not to crash into stuff, don't\nhit your own tail, etc.\n\nhttps://user-images.githubusercontent.com/25911223/206885403-cf983a9c-0557-4816-bd44-db15b6a3cfe9.mp4\n\n## Architecture\n\n### Overview\n\n`snek!` was developed with the minimum version of Java 17, and uses Maven to build the project\nincluding its dependencies, and package it into an executable `.JAR`. The project is organised to\nwork with the Maven build system—you'll find all the source code in `snake/src/main/java/`.\n\n### `TEngine`\n\nThe game engine used to develop `snek!` is my very own (and very first) game engine, called\n`TEngine`! You can find out more about it [here](https://github.com/tessapower/tengine). The version\nused at the time has been included locally as a module to simplify the build process.\n\n### The `snek!` Game Actor\n\nThe star of the show is `snek`, of course! As the `TEngine` uses ECS to model Actors, the `snek`\nActor is also structured this way—we separate out the logic from the graphical representation, and\nthis decoupled structure offers more flexibility throughout development. The graphical\nrepresentation is further broken down into two separate components, the head and the tail. The\nlogical representation is also further separated out and encapsulated in the Player class, which\nyou can see in the class diagram below:\n\n![The `snek!` Game Actor](docs/images/snek-actor.svg)\n\nThis makes it quite easy to have each aspect of the `Snek` Actor manage itself and update its different components\nseparately.\n\nThe `Snek` Actor largely manages itself, including growing its tail as necessary, rotating its head to face the right\ndirection, and handling key events. The only parts that need to be coordinated from the outside are responding to\ncollisions and needing to be told to eat an apple. A higher level `GameWorld` manages the interactions between the actors.\n\n### The `GameWorld`\n\nThe `GameWorld` coordinates the gameplay, which is grid based, and manages the interactions between actors depending on\nthe game configuration (one or two player, infinite or normal mode).\n\n![The `GameWorld`](docs/images/game-world.svg)\n\nOn a given tick, the `GameWorld` will check if the `Snek` actors have collided with the walls, with themselves,\nor with each other. It then checks if an `Apple` has been eaten, and passes that to the appropriate `snek` player,\nwhich will know what to do with it. The `GameWorld` will then organise removing the `Apple` from the world,\nand placing a new one at a random location. We can see this interaction fleshed out below:\n\n![`GameWorld` managing interactions](docs/images/world-management.svg)\n\n### Screen Management\n\nAt a higher level than the `GameWorld` is the `PlayGameScreen`, which is, as the name suggests, the screen that is\nloaded when the user starts playing the game. We also have the `MenuScreen`, which internally is made up of\nsmaller `Menu`s, and the `GameOverScreen`. To manage moving between all of these screens at a higher level, we have the\n`Game` class, which extends the `TEngine` game engine, and is the entry point for the program. The `Game` is where we\ninitially set up everything needed for `Snek`, and then it manages loading and unloading each of these screens. It then\nlistens for callbacks from each screen to know when to transition and which screen to load next.\n\n![`GameWorld` managing interactions](docs/images/screen-management.svg)\n\nThe first screen loaded is the `MenuScreen`, which lets the player select the game configuration and makes\nthat available to the `PlayGameScreen` through `Settings`. While the `PlayGameScreen` is loaded, it updates the\n`GameState` so that when the game is over and the `GameOverScreen` is loaded, it can be passed the `GameState` and\ndisplay the results.\n\n### Package Diagram\n\nThere are lots of things I didn't cover, so here's an overview of the packages and classes in\n`snek!`:\n\n![Package Diagram](docs/images/package-diagram.svg)\n\n## Attributions\n\n- [Animated Snake by Calciumtrice](https://opengameart.org/content/animated-snake), Creative Commons Attribution 3.0 license.\n- [Retro Gaming Font by Daymarius](https://www.dafont.com/retro-gaming.font), free for personal and commercial use.\n- [Music by Steven Melin](https://stevenmelin.com), free for personal and commercial use.\n- [Sound Effects by Juhani Junkala](https://juhanijunkala.com/), free for personal and commercial use.\n\n## License\n\nThis project is licensed under the [MIT license](https://github.com/tessapower/snek/blob/main/LICENSE).\n\n### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in\nthis repository by you, shall be licensed as MIT, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftessapower%2Fsnek","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftessapower%2Fsnek","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftessapower%2Fsnek/lists"}