{"id":13490387,"url":"https://github.com/cybersurferllc/AdaptiveBPM","last_synced_at":"2025-03-28T06:31:14.599Z","repository":{"id":205543431,"uuid":"713461405","full_name":"cybersurferllc/AdaptiveBPM","owner":"cybersurferllc","description":"Dynamic Game Difficulty based on Player Heart Rate","archived":false,"fork":false,"pushed_at":"2024-09-12T23:30:52.000Z","size":2937,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-31T04:34:18.467Z","etag":null,"topics":["bpm","game-development","heart-rate","hyperate","machine-learning","ml","mlnet","unity"],"latest_commit_sha":null,"homepage":"","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/cybersurferllc.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":"2023-11-02T15:09:41.000Z","updated_at":"2024-02-24T04:04:17.000Z","dependencies_parsed_at":"2024-01-16T09:05:40.548Z","dependency_job_id":"32e75ff8-1908-4167-91c0-c65ac58d720b","html_url":"https://github.com/cybersurferllc/AdaptiveBPM","commit_stats":null,"previous_names":["calebvaccaro/adaptivebpm","cybersurferllc/adaptivebpm"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cybersurferllc%2FAdaptiveBPM","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cybersurferllc%2FAdaptiveBPM/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cybersurferllc%2FAdaptiveBPM/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cybersurferllc%2FAdaptiveBPM/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cybersurferllc","download_url":"https://codeload.github.com/cybersurferllc/AdaptiveBPM/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245984422,"owners_count":20704791,"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":["bpm","game-development","heart-rate","hyperate","machine-learning","ml","mlnet","unity"],"created_at":"2024-07-31T19:00:45.935Z","updated_at":"2025-03-28T06:31:11.631Z","avatar_url":"https://github.com/cybersurferllc.png","language":"C#","funding_links":[],"categories":["C# #"],"sub_categories":[],"readme":"# Adaptive Intensity System with Hyperate Integration\n\nWelcome to our Adaptive Intensity System with real-time integration to the Hyperate API. This system is designed to adjust game or simulation intensity based on real-time heart rate data, providing an immersive experience for the user.\n\n## Prerequisites\n- [Unity 2019.4.18f1](https://unity.com/releases/editor/archive) or higher.\n- [Microsoft.ML](https://dotnet.microsoft.com/en-us/apps/machinelearning-ai/ml-dotnet) 1.5.5 or higher.\n- Hyperate WebSocket Token. [Get it here](https://www.hyperate.io/api).\n\n## `AdaptiveBPM.ML` and `AdaptiveBPM.Unity` Projects\nWe have two different projects:\n\n### 1. `AdaptiveBPM.ML`:\nThis project generates machine learning models and tests them in isolation. It focuses on data analysis and model training.\n\n**Key Aspects**:\n- **Model Generation**: Responsible for generating machine learning models using historical heart rate data.\n- **Model Testing**: Provides a controlled environment to test the accuracy of these models.\n\n### 2. `AdaptiveBPM.Unity`:\nThe Unity project that writes data to the data file and uses the new model for the next prediction of intensity. It's the front-end that integrates with Hyperate and adapts game intensity based on real-time heart rate data.\n\n**Key Aspects**:\n- **Integration with Hyperate**: Establishes a WebSocket connection with Hyperate to receive real-time heart rate data.\n- **Intensity Adjustment**: Uses the machine learning models generated by `AdaptiveBPM.ML` to adjust game intensity in real-time.\n- **Hyperate Data Logging**: Writes heart rate data to a file for future use in `AdaptiveBPM.ML`.\n\n## Getting Started\n\n### Running the ML Project\n- Ensure you have Microsoft.ML installed as a nuget package.\n- Run the project. It will generate a new model from csv data and save it to the `Models` folder.\n```csharp\nvoid RunModel()\n{\n    // Create a reference to the model\n    AdaptiveBpmMLModel mlModel = new AdaptiveBpmMLModel();\n    // transfrom and classify the data, save the model\n    mlModel.LoadModel();\n    // make a prediction\n    mlModel.Predict();\n}\n```\n\n### Running the Unity Simulation and Adding Data\n- Ensure you have a WebSocket token from Hyperate and plug it into the `hyperateSocket` component.\n- Attach the `AdaptiveBPM` script to a GameObject. This object will handle the intensity adjustments.\n- Attach the `hyperateSocket` script to a separate GameObject and reference the `AdaptiveBPM` object.\n- Configure parameters like max/min BPM, history length, etc., according to your requirements.\n- Run the simulation or game. Heart rate updates will be received from Hyperate, and intensity adjustments will be made accordingly.\n- Add data to the model for prediction refinement\n```csharp\nvoid AddDataToModel()\n{\n    // Game captured BPM data\n    var gameCaptureBPMData = new AdaptiveBpmMLTrainingModel.ModelSerialized { Intensity = 1, BPM = 99, TargetBPM = 110, BPMDifference = 10, Label = 1 };\n    // Create a reference to the model\n    AdaptiveBpmMLModel model = new AdaptiveBpmMLModel();\n    // Append the data to the CSV file\n    model.AppendDataToCSV(gameCaptureBPMData);\n}\n```\n\n## Authors\n- [Caleb Vaccaro](https://www.github.com/calebvaccaro)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcybersurferllc%2FAdaptiveBPM","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcybersurferllc%2FAdaptiveBPM","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcybersurferllc%2FAdaptiveBPM/lists"}