{"id":13438042,"url":"https://github.com/ryanpcmcquen/basque","last_synced_at":"2025-04-05T09:08:46.612Z","repository":{"id":42769765,"uuid":"237597220","full_name":"ryanpcmcquen/basque","owner":"ryanpcmcquen","description":"A top-down 2d game engine, written from scratch in under 1000 lines of C. Development of the game based on this engine is streamed on Twitch: https://www.twitch.tv/ryanpcmcquen","archived":false,"fork":false,"pushed_at":"2023-10-10T16:56:44.000Z","size":66210,"stargazers_count":449,"open_issues_count":1,"forks_count":24,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-03-29T08:07:20.815Z","etag":null,"topics":["2d-game-engine","c-game","c99","game-engine","game-engine-2d","gitpod","hacktoberfest","sdl2","sdl2-image","sdl2-mixer","sdl2-ttf"],"latest_commit_sha":null,"homepage":"https://ryanpcmcquen.itch.io/basque","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ryanpcmcquen.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}},"created_at":"2020-02-01T10:20:08.000Z","updated_at":"2025-01-16T04:21:47.000Z","dependencies_parsed_at":"2024-01-23T18:13:33.087Z","dependency_job_id":"83fabe00-eb57-42a8-9c83-0d215e975509","html_url":"https://github.com/ryanpcmcquen/basque","commit_stats":null,"previous_names":[],"tags_count":88,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanpcmcquen%2Fbasque","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanpcmcquen%2Fbasque/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanpcmcquen%2Fbasque/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanpcmcquen%2Fbasque/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryanpcmcquen","download_url":"https://codeload.github.com/ryanpcmcquen/basque/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247312080,"owners_count":20918344,"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":["2d-game-engine","c-game","c99","game-engine","game-engine-2d","gitpod","hacktoberfest","sdl2","sdl2-image","sdl2-mixer","sdl2-ttf"],"created_at":"2024-07-31T03:01:02.441Z","updated_at":"2025-04-05T09:08:46.584Z","avatar_url":"https://github.com/ryanpcmcquen.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"# Basque\n\nBasque is a cross-platform top-down 2d game engine.\n\n---\n\nRunning on Windows:\n\n![Basque Windows demo](demos/basque_windows_demo.gif \"Basque Windows demo\")\n\nRunning on Mac:\n\n![Basque Mac demo](demos/basque_mac_demo.gif \"Basque Mac demo\")\n\nRunning on Linux:\n\n![Basque Linux demo](demos/basque_linux_demo.gif \"Basque Linux demo\")\n\nRunning in your browser (thanks to WebAssembly and Emscripten):\n\n![Basque Wasm demo](demos/basque_wasm_demo.gif \"Basque Wasm demo\")\n\n[Play Basque Wasm](https://htmlpreview.github.io/?https://cdn.jsdelivr.net/gh/ryanpcmcquen/basque@master/wasm/basque.html \"Play Basque Wasm\")\n\nNow with touch controls!\n\n---\n\nPackages for all platforms are available under the GitHub Action here:\n\n[![Compiling ...](https://github.com/ryanpcmcquen/basque/workflows/Compiling%20.../badge.svg)](https://github.com/ryanpcmcquen/basque/actions)\n\nOr on Itch:\n\nhttps://ryanpcmcquen.itch.io/basque\n\n---\n\nToo lazy to do local setup? You can give it a spin using Gitpod or Replit, the only downfall will be lack of audio.\n\n[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/ryanpcmcquen/basque)\n\n[![Run on Replit](https://replit.com/badge/github/ryanpcmcquen/basque)](https://replit.com/github/ryanpcmcquen/basque)\n\n---\n\n#### Global keyboard shortcuts:\n\n\u003ckbd\u003e↑\u003c/kbd\u003e: Move player North\n\n\u003ckbd\u003e→\u003c/kbd\u003e: Move player East\n\n\u003ckbd\u003e↓\u003c/kbd\u003e: Move player South\n\n\u003ckbd\u003e←\u003c/kbd\u003e: Move player West\n\n\u003ckbd\u003eq\u003c/kbd\u003e: Quit\n\n\u003ckbd\u003ee\u003c/kbd\u003e: Toggle edit mode\n\n#### Edit mode shortcuts:\n\n\u003ckbd\u003el\u003c/kbd\u003e: Toggle map library\n\n\u003ckbd\u003eMouse button 1\u003c/kbd\u003e (left click): Place tile\n\n\u003ckbd\u003eMouse button 2\u003c/kbd\u003e (right click): Select tile\n\n---\n\n### Why do this?\n\nWhy not just use Godot/Unity/et cetera? Basque has a very different priority list than these engines. It is _not_ a generic engine. There isn't much here, but it is a good starting point if you are looking to roll your own engine, here is what it does:\n\n-   Compiles cross platform (Linux/Mac/Windows/WebAssembly, see [Esoteric ports](#esoteric-ports) for other platforms).\n-   Visual map editing (with an easy to understand plain text format).\n-   Spritesheet animation.\n-   Background music.\n-   Scrolling.\n-   Collision detection.\n-   Rudimentary frame rate limiting.\n-   Accepts command line arguments (currently only for enabling fullscreen mode).\n-   Resolution detection (estimates window size to 80% of the screen or uses the full resolution for fullscreen mode, this can be switched off).\n-   High DPI awareness. By default the game will not run in high DPI mode, but it will be aware of high DPI contexts. This prevents things from looking fuzzy with weird scaling settings.\n-   Automated GitHub and GitLab packaging pipelines.\n-   Scancode based movement (rather than event loop key states). This keeps the controls from being susceptible to operating system key repeat rates and delays.\n-   Unicode (UTF-8) file path support.\n\nEverything that is here should not be considered a final or optimal solution, but rather, a simple approach that can be morphed into a better solution. At this point the engine will become more specific to the game I am building, which is why I see this as the best time to open source it. Hopefully, it can be useful to others, either as a starting point, or as a reference of some things you can accomplish with SDL2.\n\n---\n\n### Map editing/layouts/attributes:\n\nThe current map system utilizes three main files:\n\n-   [map_attributes.txt](assets/data/map_attributes.txt)\n-   [map_layout.txt](assets/data/map_layout.txt)\n-   [map_library.txt](assets/data/map_library.txt)\n\nWhile editing the map, you may use the visual map editor (available in `DEBUG_MODE` by pressing \u003ckbd\u003ee\u003c/kbd\u003e) or edit the text files directly. Basque checks the timestamps of the files, and will reload them if they change, you do not need to recompile or relaunch Basque to do this. `map_layout.txt` also has suffixed versions created, with the intention of supporting future redo/undo functionality. The current number of versions that are kept is 100. This is of course, configurable.\n\n`map_attributes.txt` follows the following format (all items are integers):\n\n```\nTILE_INDEX:\n{ X_CLIP, Y_CLIP }, { NORTH_BORDER, EAST_BORDER, SOUTH_BORDER, WEST_BORDER },\n```\n\nComments preceded with `//` in the attributes file are allowed. The other file types do not allow comments.\n\n`map_layout.txt` and `map_library.txt` are comma separated integers, representing the tile indices. Newlines represent new rows.\n\nFor example:\n\n```\n  0,  1,  2,  3,  4,  1,  5,  _\n 27, 16, 16, 16, 16, 16, 17,  _\n 27, 16, 16, 16, 16, 16, 17,  _\n 27, 16, 28, 16, 16, 16, 17,  _\n```\n\nThe visual map editor (available in `DEBUG_MODE` by pressing \u003ckbd\u003ee\u003c/kbd\u003e) automatically writes the indices with even spacing. `_` is a shortcut for a blank tile (the index for which is configurable under `configuration.h`).\n\n`map_library.txt` is intended to be a resource for picking tiles (available in `DEBUG_MODE -\u003e EDIT_MODE` by pressing \u003ckbd\u003el\u003c/kbd\u003e), while editing the world map (`map_layout.txt`). It has a few special properties. It will not show the player, and it always appears starting at the top left corner of the screen. It is also _not_ editable by the map editor.\n\n---\n\n### Basque currently requires:\n\n-   SDL2\n-   SDL2_image\n-   SDL2_mixer\n-   SDL2_ttf\n\n---\n\n### Getting SDL2 installed:\n\n#### Linux:\n\n##### apt:\n\n```\nsudo apt-get install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev\n```\n\n##### dnf:\n\n```\nsudo dnf install SDL2-devel SDL2_image-devel SDL2_mixer-devel SDL2_ttf-devel\n```\n\n##### eopkg:\n\n```\nsudo eopkg install sdl2-devel sdl2-image-devel sdl2-mixer-devel sdl2-ttf-devel\n```\n\n##### nix:\n\n```\nnix-env --install SDL2 SDL2_image SDL2_mixer SDL2_ttf\n```\n\nOr whatever the equivalent package is for your distro.\n\n#### Mac:\n\n```\nbrew install sdl2 sdl2_image sdl2_mixer sdl2_ttf\n```\n\n#### Windows:\n\nRun the script here: [install_sdl_on_windows.cmd](install_sdl_on_windows.cmd)\n\n---\n\nOr follow one of the below procedures:\n\n##### Cmd or Powershell:\n\n```\nnuget install sdl2.nuget -NonInteractive -ExcludeVersion -OutputDirectory C:\\INCLUDE\\\nnuget install sdl2_image.nuget -NonInteractive -ExcludeVersion -OutputDirectory C:\\INCLUDE\\\nnuget install sdl2_mixer.nuget -NonInteractive -ExcludeVersion -OutputDirectory C:\\INCLUDE\\\nnuget install sdl2_ttf.nuget -NonInteractive -ExcludeVersion -OutputDirectory C:\\INCLUDE\\\n```\n\n```\nmkdir C:\\INCLUDE\\SDL2\\\n\n:: Headers:\nrobocopy C:\\INCLUDE\\sdl2.nuget\\build\\native\\include\\ C:\\INCLUDE\\SDL2\\\nrobocopy C:\\INCLUDE\\sdl2_image.nuget\\build\\native\\include\\ C:\\INCLUDE\\SDL2\\\nrobocopy C:\\INCLUDE\\sdl2_mixer.nuget\\build\\native\\include\\ C:\\INCLUDE\\SDL2\\\nrobocopy C:\\INCLUDE\\sdl2_ttf.nuget\\build\\native\\include\\ C:\\INCLUDE\\SDL2\\\n\n:: Libs:\nrobocopy C:\\INCLUDE\\sdl2.nuget\\build\\native\\lib\\x64\\ C:\\INCLUDE\\SDL2\\\nrobocopy C:\\INCLUDE\\sdl2_image.nuget\\build\\native\\lib\\x64\\ C:\\INCLUDE\\SDL2\\\nrobocopy C:\\INCLUDE\\sdl2_mixer.nuget\\build\\native\\lib\\x64\\ C:\\INCLUDE\\SDL2\\\nrobocopy C:\\INCLUDE\\sdl2_ttf.nuget\\build\\native\\lib\\x64\\ C:\\INCLUDE\\SDL2\\\n\n:: DLLs:\nrobocopy C:\\INCLUDE\\sdl2.nuget.redist\\build\\native\\bin\\x64\\ C:\\INCLUDE\\SDL2\\\nrobocopy C:\\INCLUDE\\sdl2_image.nuget.redist\\build\\native\\bin\\x64\\ C:\\INCLUDE\\SDL2\\\nrobocopy C:\\INCLUDE\\sdl2_mixer.nuget.redist\\build\\native\\bin\\x64\\ C:\\INCLUDE\\SDL2\\\nrobocopy C:\\INCLUDE\\sdl2_ttf.nuget.redist\\build\\native\\bin\\x64\\ C:\\INCLUDE\\SDL2\\\n```\n\n#### Cmd or Powershell as admin:\n\n```\n:: System DLLs:\nrobocopy C:\\INCLUDE\\sdl2.nuget.redist\\build\\native\\bin\\x64\\ C:\\Windows\\System32\\ *.dll\nrobocopy C:\\INCLUDE\\sdl2.nuget.redist\\build\\native\\bin\\x64\\ C:\\Windows\\SysWOW64\\ *.dll\n\nrobocopy C:\\INCLUDE\\sdl2_image.nuget.redist\\build\\native\\bin\\x64\\ C:\\Windows\\System32\\ *.dll\nrobocopy C:\\INCLUDE\\sdl2_image.nuget.redist\\build\\native\\bin\\x64\\ C:\\Windows\\SysWOW64\\ *.dll\n\nrobocopy C:\\INCLUDE\\sdl2_mixer.nuget.redist\\build\\native\\bin\\x64\\ C:\\Windows\\System32\\ *.dll\nrobocopy C:\\INCLUDE\\sdl2_mixer.nuget.redist\\build\\native\\bin\\x64\\ C:\\Windows\\SysWOW64\\ *.dll\n\nrobocopy C:\\INCLUDE\\sdl2_ttf.nuget.redist\\build\\native\\bin\\x64\\ C:\\Windows\\System32\\ *.dll\nrobocopy C:\\INCLUDE\\sdl2_ttf.nuget.redist\\build\\native\\bin\\x64\\ C:\\Windows\\SysWOW64\\ *.dll\n```\n\n##### Old school:\n\n1. Download the latest VC development files from: https://libsdl.org\n\n2. Place the entire contents of `include` and `lib` under `C:\\INCLUDE\\SDL2`.\n\n3. Copy all DLLs under `lib` to `C:\\Windows\\System32` and `C:\\Windows\\SysWOW64`.\n\n4. Repeat for _SDL2_image_, _SDL2_mixer_, and _SDL2_ttf_.\n\n5. Profit.\n\n---\n\n### Compiling:\n\n#### Linux \u0026 Mac:\n\n```\nmake\n```\n\n#### Windows:\n\n```\nnmake\n```\n\n---\n\n### Packaging:\n\nTo produce a zip containing the binary and all assets, run the below commands.\n\nThis should run on any system, as it includes SDL2 and the like,\nbut every system is different, so nothing is guaranteed.\n\n#### Linux:\n\n```\nmake \u0026\u0026 make --always-make linux\n```\n\n#### Mac:\n\n```\nmake \u0026\u0026 make --always-make mac\n```\n\n#### Windows:\n\n```\nnmake \u0026\u0026 nmake /a windows\n```\n\n#### WebAssembly (requires emsdk: https://github.com/emscripten-core/emsdk):\n\n```\nmake --always-make wasm\n```\n\n---\n\n### Running:\n\nAfter [compiling](#compiling) for your platform, you can launch with `./basque` (or `basque.exe` on Windows). Passing `-f` or `--fullscreen` will launch the app in fullscreen, rather than the resolution specified in [configuration.h](source/configuration.h).\n\n### Esoteric ports:\n\n**BSD**:\n\n![Basque on BSD](https://user-images.githubusercontent.com/772937/91080734-f26c7400-e5fa-11ea-91bd-a1b00f589326.jpg \"Basque on BSD\")\n\n**Pocketchip**:\n\n![Basque on a PocketCHIP](https://user-images.githubusercontent.com/772937/91081932-bf2ae480-e5fc-11ea-8f92-d393e08b007a.gif \"Basque on a PocketCHIP\")\n\n**Haiku**:\n\n![Basque on Haiku](https://user-images.githubusercontent.com/772937/93433807-26def300-f87c-11ea-8b75-166ba7297b4f.png)\n![Basque on Haiku](https://user-images.githubusercontent.com/772937/93433806-26465c80-f87c-11ea-824a-6afd19c35cc3.png)\n\n**AmigaOS 4.1**:\n\n![Basque on AmigaOS](https://user-images.githubusercontent.com/82057491/113767469-63deda00-9727-11eb-924d-49f895713ca8.png)\n\nThanks to [seventhwonder-amiga](https://github.com/seventhwonder-amiga)!\n\n**Nintendo Switch**:\n\n![Basque on Nintendo Switch](https://user-images.githubusercontent.com/88618327/131042085-efa210ad-d69b-4e9a-b1ae-56c5ba966a05.jpg)\n\nThanks to [fontire](https://github.com/fontire)!\n\n#### In progress:\n\n-   ReactOS\n-   Solaris\n-   TempleOS\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanpcmcquen%2Fbasque","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryanpcmcquen%2Fbasque","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanpcmcquen%2Fbasque/lists"}