{"id":13418880,"url":"https://github.com/iboB/dynamix","last_synced_at":"2025-03-15T04:30:58.867Z","repository":{"id":44725755,"uuid":"61472488","full_name":"iboB/dynamix","owner":"iboB","description":":fish_cake: A new take on polymorphism","archived":false,"fork":false,"pushed_at":"2024-10-29T14:59:16.000Z","size":2070,"stargazers_count":676,"open_issues_count":29,"forks_count":46,"subscribers_count":38,"default_branch":"master","last_synced_at":"2025-03-08T06:49:02.992Z","etag":null,"topics":["cpp","library","mixins","oop","polymorphism"],"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/iboB.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},"funding":{"github":"iboB"}},"created_at":"2016-06-19T09:11:56.000Z","updated_at":"2025-01-23T07:05:19.000Z","dependencies_parsed_at":"2022-09-21T02:01:41.434Z","dependency_job_id":"bd5193f5-e95d-4183-b720-7ee7843abd5e","html_url":"https://github.com/iboB/dynamix","commit_stats":{"total_commits":576,"total_committers":5,"mean_commits":115.2,"dds":0.01909722222222221,"last_synced_commit":"bc9e24f4ae2732d6c1c0d281de24f69ace482866"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iboB%2Fdynamix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iboB%2Fdynamix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iboB%2Fdynamix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iboB%2Fdynamix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iboB","download_url":"https://codeload.github.com/iboB/dynamix/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243685506,"owners_count":20330980,"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":["cpp","library","mixins","oop","polymorphism"],"created_at":"2024-07-30T22:01:08.309Z","updated_at":"2025-03-15T04:30:58.564Z","avatar_url":"https://github.com/iboB.png","language":"C++","readme":"# [![DynaMix](https://s22.postimg.cc/u1sqhb7jl/README.jpg)](https://ibob.github.io/dynamix/)\n\n[![Language](https://img.shields.io/badge/language-C++-blue.svg)](https://isocpp.org/) [![Standard](https://img.shields.io/badge/C%2B%2B-17-blue.svg)](https://en.wikipedia.org/wiki/C%2B%2B#Standardization) [![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT) [![Build](https://github.com/iboB/dynamix/actions/workflows/unit-test.yml/badge.svg)](https://github.com/iboB/dynamix/actions/workflows/unit-test.yml)\n\n\u003e *IMPORTANT* v2 is here. It is a big change. The last v1 release was [v1.4.0](https://github.com/iboB/dynamix/releases/tag/v1.4.0)\n\nDynaMix (*Dynamic Mixins*) is an alternative take on object oriented programming and dynamic polymorphism. It lets users compose and modify polymorphic objects at run time. The main target language is C++, but C is also supported.\n\nThe library is a means to create a project's **architecture** rather than achieve its purpose. It helps with *extensibility*, *readability*, *scalability* and *interoperability*. It focuses on **maximal performance** and **minimal memory overhead**.\n\nDynaMix is applicable for the software architecture of systems with complex objects including, but not limited to:\n\n* Games (especially role-playing ones or strategies)\n* CAD systems\n* Enterprise systems\n\nThe library uses the type `dynamix::object` as a placeholder, whose instances can be extended with existing classes (mixins), thus providing a particular instance with the *mixin features* of all those types. Likely the most important types of *mixin features* are messages: functional objects which in C++-OOP terms can be thought of as methods. Mixin features are overridable and use late binding and singular dispatch. Unicasts and multicasts are possible.\n\nHere is a small example of what code may look like using the library:\n\n```c++\n    // assuming my_objects.get_ally(0); is a way to get an ally to the\n    // main character in a game\n    dynamix::object\u0026 obj = my_objects.get_ally(0);\n\n    // now let's make the object think some positive thoughts about the\n    // main character\n\n    think(obj); // C++ doesn't allow us to have obj.think().\n                // DynaMix's messages are like standalone functions\n\n    // composition\n    mutate(obj, dynamix::add\u003cflying_creature\u003e());\n\n    // object can now respond to fly()\n\n    fly(obj); // ...instead of obj.fly()\n\n    // mutation\n    mutate(obj\n        , dynamix::remove\u003cally\u003e()\n        , dynamix::add\u003cenemy\u003e()\n    );\n\n    think(obj); // the same object now thinks negative thoughts about the main\n                // character, since it's no longer an ally, but an enemy\n```\n\nHere are some of the key features of the library:\n\n* Compose objects from mixins at run time\n* Physically separate interface and implementation\n* Non-intrusive \u0026ndash; mixins don't need to have a common parent or any special code inside\n* Mutate \"live\" objects by changing their composition at run time\n* Use `std::polymorphic_allocator` to allow fine-tuning allocations and achieving cache locality in critical parts of the code\n* Create shared libraries and plugins which can enrich or modify objects, without modifying (or even rebuilding) the executable.\n* Add \"hotswap\" to a project while developing\n* Have complete runtime reflection by symbols or strings\n* Messages:\n    * Fast polymorphic calls \u0026ndash; comparable to `std::function`\n    * Have multicast messages, which are handled by many mixins within an object\n    * Thread safe message calls \u0026ndash; as thread safe as the underlying methods.\n\n## Created with DynaMix\n\nThe following projects are known to use DynaMix as a key piece of their software architecture:\n\n* [A3I](https://ibob.bg/blog/2022/01/25/what-we-do-at-viewray/) by ViewRay (Released 2022) - A medical system for cancer treatment. Uses v2\n* [huse](https://github.com/iboB/huse) - a polymorphic serialization library. Uses v2\n* [Heroes of the Dark](https://www.gameloft.com/game/heroes-of-the-dark) by Gameloft (Released 2021) - An RPG for Android, iOS, and Windows. Uses v1\n* [War Planet Online: Global Conquest](http://warplanetonline.com/) by Gameloft (Released 2017) - An MMORTS for mobile devices and PCs. Uses v1\n* [Blitz Brigade: Rival Tactics](http://www.rival-tactics.com/) by Gameloft (Released 2017) - A multiplayer RTS for Android, iOS, and Windows. Uses v1\n* [Swords \u0026 Crossbones: An Epic Pirate Story](http://store.steampowered.com/app/383720/Swords__Crossbones_An_Epic_Pirate_Story/) by Epic Devs LLC (Released 2014) - A strategy/exploration game for Android, iOS, and PC. Uses v1\n* [Earthrise](https://web.archive.org/web/20160730224855/http://play-earthrise.com/) by Masthead Studios (Released 2011) - An MMORPG (no longer supported). Uses an early proprietary prototype version of the library with a similar interface and a different implementation.\n\n## Documentation\n\nThe documentation is part of the repo in the [doc/](doc/README.md) directory.\n\n## Contributing\n\nContributions in the form of issues and pull requests are welcome.\n\n## License\n\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\nThis software is distributed under the MIT Software License.\n\nSee accompanying file LICENSE or copy [here](https://opensource.org/licenses/MIT).\n\nCopyright \u0026copy; 2013-2024 [Borislav Stanimirov](http://github.com/iboB), [Zahary Karadjov](http://github.com/zah)\n\n### Logo\n\n[![License: CC BY 4.0](https://licensebuttons.net/l/by/4.0/80x15.png)](https://creativecommons.org/licenses/by/4.0/).\n\nThe [DynaMix logo](https://github.com/iboB/dynamix/tree/master/doc/logos) is licensed under a Creative Commons Attribution 4.0 International License. Copyright \u0026copy; 2018 [area55git](https://github.com/area55git)\n\n## V1\n\nDynaMix v2 is a complete rewrite and though it has the same idea as v1, it is incompatible with it, and has a different interface, and different implementation for most features, and different terminology for some.\n\nThe last release of DynaMix v1 was [v1.4.0](https://github.com/iboB/dynamix/releases/tag/v1.4.0). The documentation is available [here](https://ibob.bg/dynamix/v1/index.html)\n\nA list of the most notable differences between v1 and v2 can be found [here](doc/misc/v2-vs-v1.md).\n\n## Boost.Mixin\n\nDynaMix was initially developed as [Boost.Mixin](https://github.com/iboB/boost.mixin) but is now a separate library that doesn't depend on the Boost libraries Collection.\n\n![Footer](https://s22.postimg.cc/gkvrylx9t/README_2.jpg)\n","funding_links":["https://github.com/sponsors/iboB"],"categories":["TODO scan for Android support in followings","Miscellaneous","排序","GameProgramming"],"sub_categories":["多项混杂"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FiboB%2Fdynamix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FiboB%2Fdynamix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FiboB%2Fdynamix/lists"}