{"id":28919394,"url":"https://github.com/derekgooding/takingturns","last_synced_at":"2025-07-15T11:05:19.613Z","repository":{"id":241624107,"uuid":"807272654","full_name":"DerekGooding/TakingTurns","owner":"DerekGooding","description":null,"archived":false,"fork":false,"pushed_at":"2024-05-30T13:25:41.000Z","size":128,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-22T03:06:48.174Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DerekGooding.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-05-28T19:34:20.000Z","updated_at":"2024-05-30T13:25:44.000Z","dependencies_parsed_at":"2024-05-29T10:44:51.732Z","dependency_job_id":null,"html_url":"https://github.com/DerekGooding/TakingTurns","commit_stats":null,"previous_names":["derekgooding/takingturns"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/DerekGooding/TakingTurns","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DerekGooding%2FTakingTurns","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DerekGooding%2FTakingTurns/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DerekGooding%2FTakingTurns/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DerekGooding%2FTakingTurns/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DerekGooding","download_url":"https://codeload.github.com/DerekGooding/TakingTurns/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DerekGooding%2FTakingTurns/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265430302,"owners_count":23763974,"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":[],"created_at":"2025-06-22T03:06:43.460Z","updated_at":"2025-07-15T11:05:19.591Z","avatar_url":"https://github.com/DerekGooding.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Description\nThis is an emulator for turn taking similar to Classic RPG games. Build in .Net8.\n\nUnits with a faster speed stat may lap slower units. \n\nIt is designed to be magnitude agnostic. Speed must be in positive intigers but can be any number up to int.MaxValue. \n\n### Example:\nSpeed 100 and 120 will function the same as Speed 1 million and 1.2 million. \nAs would 10 and 12. \nThe faster unit lapping every 5th turn.\n\n***The Engine.cs file is 50 lines of code. Has add, destroy and modify functionality. You can take that file and add it to any project you can think of just modifying what object it takes instead of my Unit.cs class.***\n\n# Console\nBuild and run TakingTurns to have things visualized with a console application. The core code is in here also for reference or copying.\n\n![alt text](https://github.com/DerekGooding/TakingTurns/blob/master/Console.png)\n\n# WPF\nBuild and run TakingTurns.WPF to have a window with general visuals and a application style menu. It uses the logic directly from the console application. \n\n![alt text](https://github.com/DerekGooding/TakingTurns/blob/master/WPF.png)\n\n# Math Explained\n*There are several ways of creating a turn order in games. I in no way claim to have things perfected. This is just how I've decided to do it.*\n\nEach character or Unit has a name and a speed stat. That speed can be any number from 1 to int.MaxValue (about 2 billion). \nWhen you create a new Engine object, it creates a tacker which is a list of Unit, int tuples. **List\u003c(Unit unit, int time)\u003e** \n\nAny new unit added to the Engine is added to the tracker with an initialized time value of zero. \n\nThe turn order prediction is created by simulated a number of turns in advance. It copies the current Engine tracker and steps through it a number of times. \n\nWhen you actually take a turn (step), the tracker itself steps forward. Any future simulations are run using that new tracker info. \n\n### Tick Value\nSome systems use a hard line value (100 or 1000) or divide 1 / speed value. Both run into problems as speed values approach excessive numbers. Might not matter for most games. Here, we're using the largest speed stat in the list as the tick value.  \n\n### Step\nWhen you take a step if no unit has a time at or over the tick value, we add each one's speed to the respective time value. Since our tick value is the fastest units speed, there will ALWAYS be one unit passing the tick line after a single calculation. (no while loop)\n\nThen we order decending by time, grab the highest time Unit, lower it's time by the tick value and return that Unit. If there is a tie, it'll use the order they were added to the list (index) as with any list ordering. \n\nIt's that simple. If more than one unit crosses the finish line (tick), the Step won't calculate the next time it's called, just grab the highest and process it. \n\n# Roadmap\n\n- ~~Unit testing~~\n- ~~WPF visualization~~\n- Unity package with UI support\n- Any suggestions are welcome\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fderekgooding%2Ftakingturns","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fderekgooding%2Ftakingturns","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fderekgooding%2Ftakingturns/lists"}