{"id":50057502,"url":"https://github.com/tabularelf/SimThreads","last_synced_at":"2026-06-07T06:00:31.683Z","repository":{"id":38248170,"uuid":"497422457","full_name":"tabularelf/SimThreads","owner":"tabularelf","description":"Parallel Execution in GameMaker","archived":false,"fork":false,"pushed_at":"2024-05-07T00:56:34.000Z","size":98,"stargazers_count":15,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-06T23:57:40.776Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Game Maker Language","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/tabularelf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"ko_fi":"tabularelf"}},"created_at":"2022-05-28T20:35:12.000Z","updated_at":"2025-10-26T09:07:27.000Z","dependencies_parsed_at":"2023-02-09T10:00:17.850Z","dependency_job_id":null,"html_url":"https://github.com/tabularelf/SimThreads","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/tabularelf/SimThreads","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tabularelf%2FSimThreads","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tabularelf%2FSimThreads/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tabularelf%2FSimThreads/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tabularelf%2FSimThreads/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tabularelf","download_url":"https://codeload.github.com/tabularelf/SimThreads/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tabularelf%2FSimThreads/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34010556,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-07T02:00:07.652Z","response_time":124,"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":[],"created_at":"2026-05-21T15:00:43.429Z","updated_at":"2026-06-07T06:00:31.648Z","avatar_url":"https://github.com/tabularelf.png","language":"Game Maker Language","funding_links":["https://ko-fi.com/tabularelf"],"categories":["Async"],"sub_categories":["Recommendations"],"readme":"# SimThreads v1.1.0\nParallel Execution for GameMaker 2022.5+\n\n### Quick Disclaimer!\nThis is not \"true multithreading\". This is merely allowing code to be broken down and spread across several of frames, as oppose to having a massive for loop and manipulating lots of data all within a step.\n\nIf you need any assistance, I'd recommend that you join [My Discord Server, TabularElf's Treehouse](https://discord.gg/ThW5exp6r4) under `💻│gamemaker-libraries`.\u003cbr\u003e\nOr if you're in [GameMaker Kitchen](https://discord.gg/8krYCqr), check out `your_libraries🧶` for the thread discussion!\n\nAllows multiple execution of functions/methods or block of codes, with arguments provided optionally! This is done by having a handy dandy time_source implementation and custom function to execute functions with arguments (as `script_execute_ext` only works for GML functions and methods, not runtime functions.)\nSimThreads has two major kinds of support: Direct calling a method and passing in a function/method with arguments.\n\nThe use cases for SimThreads allows one to basically push any sort of function/functions and process each set of functions over the next couple of frames.\n\nThis can be applied to concepts such as:\n\n-Reading/Writing from data structures/buffers/arrays\u003cbr\u003e\n-World Gen\u003cbr\u003e\n-Saving/Loading (within reason)\u003cbr\u003e\n-Anything that could be processed over the course of a couple frames.\u003cbr\u003e\n\nUes case:\n\n`thread = new SimThread([MaxExecutions]);`\n\nBy default, SimThreads has a MaxExecution of `infinity` and will process every function/method in its queue until it hits the max thread time (as set by `.SetMaxTime(percent)`, which is default to `100%`, or `1`).\n\nSimThreads can have a function, method or struct passed as a valid argument for both `.Push()` and `.Insert()` (see down below more for the arguments on those functions)\n\nTo push a function to a SimThread, you can do.\n```gml\nthread.Push(myGMLFunction);\n```\n\nTo push a method to a SimThread, you can do.\n```gml\nthread.Push(myMethod);\n\n// Or\n\nthread.Push(method(self, myGMLFunction));\n\n// Or\n\nthread.Push(function() {\n  show_debug_message(\"Hello World from \" + string(self)));\n});\n```\n\nTo push a function/method to a SimThread with arguments, you provide:\n\n```gml\nthread.push({\n  callback: myGMLFunction\n  args: [\"Hello World!\"]\n});\n```\n\nGiving you the ultimate flexibility in however you want to handle your games logic!\n\n\n# Example:\n```gml\n// Create Event\nthread = new SimThread();\nthread.SetMaxTime(.005);\nentriesList = array_create(10000, \"the pug is never the end \");\nbuffer = buffer_create(1, buffer_grow, 1);\n// Write a bunch of data to said buffer\nvar _len = array_length(entriesList);\nvar _i = 0;\nrepeat(_len) {\n  thread.Push({\n   callback: buffer_write,\n   args: [buffer, buffer_text, entriesList[_i++]]\n  });\n}\n\nthread.Push(function() {\n  buffer_save(buffer, \"mytext.txt\");\n  show_debug_message(\"Buffer saved!\");\n  buffer_delete(buffer);\n});\n```\n\n```gml\n// Game End Event\nthread.Flush();\nthread.Destroy();\n```\n\n# Methods:\n\n## `.Pause()`\n\nPauses the SimThread execution.\n\n## `.Resume()`\n\nResumes the SimThread execution.\n\n## `.SetMaxTime(percent)`\n\nSets the max time a given SimThread can execute (with `percent` being a value between `0` to `1`) per step.\n\n## `.SetMaxExecution(number)`\n\nSets the max amount of executions per step. `infinity` is set by default. Any number above `0` will limit the SimThread to that number of function executions.\n\n## `.Insert(position, entry)`\n\nInserts a function/method or struct to a set position within the SimThread.\n\n## `.Push(entry, [entry], [...])`\n\nPushes one or multiple functions/methods or structs, adding at the end of the queue.\n\n## `.Clear()`\n\nClears the SimThread queue.\n\n## `.Destroy()`\n\nFrees the SimThread queue.\n\n## `.GetQueueLength()`\n\nGets the length of the SimThread queue.\n\n## `.Flush()`\n\nFlushes all functions (aka executes all functions/methods) within the queue, regardless of the settings of `.SetMaxTime()` and `.SetMaxExecutions()`, and regardless if it's paused or not.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftabularelf%2FSimThreads","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftabularelf%2FSimThreads","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftabularelf%2FSimThreads/lists"}