Skip to content

🚧Convert to structs #80

Closed
@CalvinWilkinson

Description

@CalvinWilkinson

Complete The Item Below

  • I have updated the title without removing the 🚧 emoji.

Description

Look into converting types into read-only record structs. This issue will be half research and investigating what is possible; the other half will be the work to convert what we can.

Also, convert all the time values for the ParticleEffect class to floating point numbers instead of an int. This is important for accurately changing of the values over time, which is important in particle engines.

We can also investigate the impact of using static abstract interface members to see if this can get us the restrictions we want for float vs. double data types. We could also use generic math to achieve what we want, a C# 11 feature.

If this is the case, maybe we can have ParticleF and Particle types where Particle will be for double and ParticleF will be for floats. Again, this is all theory but will require research.

Note

It might not be possible to convert the Particle type to a read-only record struct due to the current IParticle interface, which is needed, and the method implementations.

Warning

This will require further thought regarding how this might be used in other applications. One, in particular, will be Plazma Studio. Make sure to build the project into a local test nuget package and bring it into Plazma Studio to see the impact it will have

Reason:

This will improve ease of use and performance. Since this is a particle engine, we want to keep things fast. This means changing the engine to reduce memory pressure and GC collections.

Note

Take the time to do baseline performance testing and comparisons to ensure we increase performance. This is fine if this means creating some perf projects to add to the code base/solution.

Acceptance Criteria

### The items to complete to satisfy the Definition of Done.
- [x] All unit tests executed and passed locally after PR work is complete. _(Why? Refer to 'Additional Information' below.)_
- [x] Research complete
- [x] Performance testing complete
- [x] Impact analysis on Plazma Studio complete
- [x] All `ParticleEffect` time values converted to floating point numbers
- [x] `ParticleEffect` class changed from a class to a readonly record struct
- [x] Create performance tests for limited and unlimited spawn rates
- [x] Create tests to check for disposal exceptions in `ParticlePool` class
- [x] Increase code coverage

ToDo Items

### The items to complete to satisfy the Definition of Done.
- [x] Change type labels added to this issue.  Refer to the _**Change Type Labels**_ section below.
- [x] Priority label added to this issue.  Refer to the _**Priority Type Labels**_ section below.
- [x] Issue linked to the correct milestone _(if applicable)_.

Issue Dependencies

No response

Related Work

No response

Additional Information:

Unit Tests

Reasons for local unit test execution:

  • Unit tests might pass locally but not in the CI environment during the status check process or vice-versa.
  • Tests might pass on the developer's machine but not necessarily on the code reviewer's machine.
  • If you notice that the test status check has passed but the test failed locally, please notify a project maintainer!

💡Warning💡
If the unit tests pass remotely and are not executed locally, this means we could be letting a bug slip into production.
Though bugs will always exist in some capacity, we should all do our part to help prevent them from happening.

Change Type Labels

Change Type Label
Bug Fixes 🐛bug
Breaking Changes 🧨breaking changes
New Feature ✨new feature
CICD Changes ♻️cicd
Config Changes ⚙️config
Performance Improvements 🏎️performance
Code Doc Changes 🗒️documentation/code
Product Doc Changes 📝documentation/product

Priority Type Labels

Priority Type Label
Low Priority low priority
Medium Priority medium priority
High Priority high priority

Code of Conduct

  • I agree to follow this project's Code of Conduct.

Metadata

Metadata

Labels

Projects

Status

✅Done

Relationships

None yet

Development

No branches or pull requests

Issue actions