{"id":21230006,"url":"https://github.com/frklan/dodgethecreeps-cpp","last_synced_at":"2026-05-17T00:08:40.741Z","repository":{"id":178549482,"uuid":"176354971","full_name":"frklan/DodgeTheCreeps-cpp","owner":"frklan","description":"Source code for the \"Your first game\" tutorial at Godot Docs made in C++","archived":false,"fork":false,"pushed_at":"2019-05-31T18:52:46.000Z","size":5506,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-15T02:16:41.259Z","etag":null,"topics":["cpp","cpp17","game-development","godot","ios"],"latest_commit_sha":null,"homepage":null,"language":"C++","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/frklan.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":"2019-03-18T19:22:44.000Z","updated_at":"2023-08-08T10:54:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"6be4e13e-c6a5-4c12-a058-44dac6793f40","html_url":"https://github.com/frklan/DodgeTheCreeps-cpp","commit_stats":null,"previous_names":["frklan/dodgethecreeps-cpp"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/frklan/DodgeTheCreeps-cpp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frklan%2FDodgeTheCreeps-cpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frklan%2FDodgeTheCreeps-cpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frklan%2FDodgeTheCreeps-cpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frklan%2FDodgeTheCreeps-cpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/frklan","download_url":"https://codeload.github.com/frklan/DodgeTheCreeps-cpp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frklan%2FDodgeTheCreeps-cpp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002215,"owners_count":26083340,"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-10-09T02:00:07.460Z","response_time":59,"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":["cpp","cpp17","game-development","godot","ios"],"created_at":"2024-11-20T23:31:11.069Z","updated_at":"2025-10-09T23:03:15.600Z","avatar_url":"https://github.com/frklan.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dodge the Creeps\n\nMy second attempt at following \"Your first game\" tutorial over at [Godot Docs](https://docs.godotengine.org/en/3.1/getting_started/step_by_step/your_first_game.html). All source code converted to C++.\n\nIn my [first attemt](https://github.com/frklan/DodgeTheCreeps) following the tutorial, I used the GDScript; Since I prefer C++, I've converted the game to C++. Overall the C++ interface works very good, althou it's a bit annoying the the engine does not support try..catch, smart pointers and other \"modern\" additions to the language. The Godot documentation could also be improved wtih regards to C++.\n\nWhile, I'll continue to use C++ with Godot, it's most probably quite stupid to write a full game in C++; GDScript takes care of lot of stuff for you that you'll have to do manually in C++ and It's much quicker to code in. Still I prefer C++..\n\n**Note** commits after [bfddbd8](https://github.com/frklan/DodgeTheCreeps-cpp/tree/bfddbd81778774ae6d41dd8956ac3e667ca37010) adds features or functions not in the original Godot tutorial, i.e. commit [bfddbd8](https://github.com/frklan/DodgeTheCreeps-cpp/tree/bfddbd81778774ae6d41dd8956ac3e667ca37010) is pretty comparable to my [first attemt](https://github.com/frklan/DodgeTheCreeps).\n\n## Compiling for OSX\n\n(this will most probably work for Linux and possibly even for Windows)\n\nMake sure ```CXX``` and ```CC``` environment variables points to valid compilers.\n\nClone and init the repo like so:\n\n```bash\ngit clone https://github.com/frklan/DodgeTheCreeps-cpp.git\ncd DodgeTheCreeps-cpp\ngit submodule init\n```\n\n### Godot-cpp\n\nCompile the Godot C++ bindings for our platform,\n\n```bash\ncd src/godot-cpp\nscons platform=osx generate_bindings=yes\n```\n\nThis only needs to be done once.\n\n### Project C++ source\n\nThe C++ code compiles like so:\n\n```bash\nscons platform=osx target=debug\n```\n\nThis step needs to be repeated every time the code is updated.\n\n### Running the game\n\nWhen the C++ bidnings and project C++ code hase been compiled, we can run the scene from within Godot by hitting ⌘+R (or ⌘+B to run the full game).\n\n## Compiling for iOS\n\nCompiling for iOS is slightly more involved since we need to export the project to Xcode and run in from there, anyhow the following steps works for me.\n\n### Godot C++ bidnings\n\nBefore we compile the [Godot C++ bindings](https://github.com/GodotNativeTools/godot-cpp.git), the scons make file repo needs to be updated. Add the following function after the import statement on row 3:\n\n```python\ndef sys_exec(args):\n    proc = subprocess.Popen(args, stdout=subprocess.PIPE)\n    (out, err) = proc.communicate()\n    return out.rstrip(\"\\r\\n\").lstrip()\n```\n\n(source available [here](https://friendpaste.com/CrlWiNALwdX6lWJe72eI2))\n\niOS and the simulator needs to be added to the platform list, it's also a good idea to set ````bits```` to 64 as default, like so (row 25 - 27):\n\n```python\nopts.Add(EnumVariable('platform', 'Target platform', host_platform,\n                    allowed_values=('linux', 'osx', 'windows', 'ios', 'ios.simulator'),\n                    ignorecase=2))\nopts.Add(EnumVariable('bits', 'Target platform bits', '64', ('default', '32', '64')))\n```\n\nNext we need to define how to compile for iOS and the simulator (row 113\n\n```python\nelif env['platform'] == \"ios\":\n    env[\"CXX\"] = sys_exec([\"xcrun\", \"-sdk\", \"iphoneos\", \"-find\", \"clang++\"])\n    env[\"CC\"] = sys_exec([\"xcrun\", \"-sdk\", \"iphoneos\", \"-find\", \"clang\"])\n    IOS_PLATFORM_SDK = sys_exec([\"xcode-select\", \"-p\"]) + \"/Platforms\"\n    SDK_VERSION = sys_exec([\"xcodebuild\", \"-sdk\", \"iphoneos\", \"-version\", \"|\", \"grep\", \"SDKVersion\", \"|\", \"awk\", \"'{print$2}'])\"])\n    SDK_MIN_VERSION = \"10.3\"   \n\n    env.Append(CCFLAGS = ['-arch', 'arm64', '-arch', 'armv7', '-arch', 'armv7s', '-std=c++14', \n     '-isysroot', ('%s/iPhoneOS.platform/Developer/SDKs/iPhoneOS%s.sdk' % (IOS_PLATFORM_SDK, SDK_VERSION)),  \n     ('-miphoneos-version-min=%s' % SDK_MIN_VERSION)])\n\n    env.Append(LINKFLAGS = ['-arch', 'arm64', '-arch', 'armv7', '-arch', 'armv7s',\n    '-isysroot', '%s/iPhoneOS.platform/Developer/SDKs/iPhoneOS%s.sdk' % (IOS_PLATFORM_SDK, SDK_VERSION) , \n    '-miphoneos-version-min=%s' % SDK_MIN_VERSION])\n\n    if env['target'] in ('debug','d'):\n      env.Append(CCFLAGS = ['-g']) \n    else:\n      env.Append(CCFLAGS = ['-O3'])\n\nelif env['platform'] == \"ios.simulator\":\n    env[\"CXX\"] = sys_exec([\"xcrun\", \"-sdk\", \"iphoneos\", \"-find\", \"clang++\"])\n    env[\"CC\"] = sys_exec([\"xcrun\", \"-sdk\", \"iphoneos\", \"-find\", \"clang\"])\n    IOS_PLATFORM_SDK = sys_exec([\"xcode-select\", \"-p\"]) + \"/Platforms\"\n    SDK_VERSION = sys_exec([\"xcodebuild\", \"-sdk\", \"iphonesimulator\", \"-version\", \"|\", \"grep\", \"SDKVersion\", \"|\", \"awk\", \"'{print$2}'])\"])\n    SDK_MIN_VERSION = \"10.3\"   \n\n    env.Append(CCFLAGS = ['-arch', 'x86_64', '-std=c++14', \n     '-isysroot', ('%s/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator%s.sdk' % (IOS_PLATFORM_SDK, SDK_VERSION)),  \n     ('-miphoneos-version-min=%s' % SDK_MIN_VERSION)])\n\n    env.Append(LINKFLAGS = ['-arch', 'x86_64',\n    '-isysroot', '%s/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator%s.sdk' % (IOS_PLATFORM_SDK, SDK_VERSION) , \n    '-miphoneos-version-min=%s' % SDK_MIN_VERSION])\n\n    if env['target'] in ('debug','d'):\n      env.Append(CCFLAGS = ['-g']) \n    else:\n      env.Append(CCFLAGS = ['-O3'])\n```\n\n**Note** The iOS SDK is hard coded to 10.3 in this example.\n\nI also like to have my compilers defined in ````CC````and ````CXX```` hence I add these lines to SConstruct as well:\n\n```python\n# honour CC and CXX\nenv['CC'] = os.environ['CC']\nenv['CXX'] = os.environ['CXX']\n```\n\nThe full SConstruct file is available [here](https://gist.github.com/frklan/3c554ef7a787dad432b1c7f7f3d72953)\n\nNow we should be able to compile the Godot C++ bindings for iOS and the simulator\n\n```bash\ncd lib/godot-cpp\n\nscons platform=ios generate_bindings=yes -j8\nscons platform=ios.simulator generate_bindings=yes -j8\n```\n\nIt's possible to combine the libraries for all architectures into one file by executing:\n\n```bash\nlipo -create bin/libgodot-cpp.ios.debug.64.a bin/libgodot-cpp.ios.simulator.debug.64.a -output bin/libgodot-cpp.fat.ios.debug.64.a\n```\n\n(this require that ```godot_cpp_library``` in SConstruct in he next step points to the fat library)\n\n### Project C++ source\n\nNext we need to build the project source by executing the following in the root of the repo:\n\n```bash\nscons platform=ios target=debug static=yes -j8\nscons platform=ios.simulator target=debug static=yes -j8\n```\n\n### Exporting to Xcode\n\nFollow the official Godot iOS export guide [here](https://docs.godotengine.org/en/latest/getting_started/workflow/export/exporting_for_ios.html).\n\n**Note** that we need to add \"Feature\" \"x86_64\" in the export dialog  to get the simulator version exported.\n\nIn Xcode the following settings needs to be updated\n\n1. Update the valid architectures to reflect if we're runing in the simualtor (x86_64) or on a real device (arm64, armv7 etc.)\n2. add ```$(PROJECT_DIR)/DodegtheCreeps/lib/godot-cpp/bin``` and ```$(PROJECT_DIR)/DodgetheCreeps/build/lib/ios``` to the Library Search Paths\n3. Set development target to 10.3\n4. Add GameKit.frameworks to Linked Frameworks and Libraries\n5. Unless you have a paid Apple Developer license, push notification and gamecenter capabilites needs to be disabled.\n\nIf you follow the Active development considerations in the Godot documentation (which you probably should) the Library Search Paths shoule be set to ```$(PROJECT_DIR)/DodgetheCreeps/lib/godot-cpp/bin``` and ```[path to repo]/build/lib/ios```\n\n**Note that the full source code will be included in the app package doing this**\n\nIt seems that iOS/Xcode is pretty sensitive to having about a million icons and launch images, if the app starts with black bars above and below the game it can be resolved by using a storyboard as launch screen instead of an image set.\n\n## Debuging\n\n### osx\n\nAs long as we have compiled the C++ code with debug symbols (```` scons ... target=debug ````) we can attach to the process directly from e.g. Visual Code:\n\n1. Compile and run the game as described above\n2. Hit 'F5' or click 'Debug' in Visual Code\n3. Search for 'Godot' and select the entry that corresponds to the scene you're running \n\n### ios / ios simulator\n\nDebugging is done using Xcode, just navigate to the source file you're intereseted in, set a breakpoint and launch the app in the simulator (or on a connected iOS device).\n\n## TODO\n\n- [x] compile to iOS\n- [x] fix UI for ios\n- [x] add game controls for ios (took, like, forever to come up with something that works..)\n- [ ] migrate to godot 3.1.1\n- [ ] proper splash screen\n- [ ] start memu, possibly with a settings dialouge\n- [ ] hide/fade the touchpad when no touch input\n- [x] make player move when touch controller is keep stationary\n- [ ] high score list\n- [ ] proper mob ai\n\n## Contributing\n\n~~I don't expect to updated this project, still~~ contributions are always welcome!\n\nWhen contributing to this repository, please first discuss the change you wish to make via the issue tracker, email, or any other method with the owner of this repository before making a change.\n\nPlease note that we have a code of conduct, you are required to follow it in all your interactions with the project.\n\n## Versioning\n\nWe use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/frklan/GameEngine/tags).\n\n## Authors\n\n* **Fredrik Andersson** - *Initial work* - [frklan](https://github.com/frklan)\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrklan%2Fdodgethecreeps-cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrklan%2Fdodgethecreeps-cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrklan%2Fdodgethecreeps-cpp/lists"}