Megafunk / MassSample

My understanding of Unreal Engine 5's experimental ECS plugin with a small sample project.
MIT License
681 stars 112 forks source link

Unit Formations Example #37

Closed Ji-Rath closed 1 year ago

Ji-Rath commented 1 year ago

Early example of simple unit formations. There is still a lot of cleanup to be done but the core functionality is there.

image

https://user-images.githubusercontent.com/1747157/178162858-c0dace7c-4474-4719-8cee-82d1a091d3d5.mp4

https://user-images.githubusercontent.com/1747157/178162889-841d7e2e-a90d-4d9f-816f-83684432b1e7.mp4

https://user-images.githubusercontent.com/1747157/178162918-2471bb9d-351c-4b40-bf5b-9be2541f01a0.mp4

Known issues

Megafunk commented 1 year ago

When spawning a large amount of entities (>100) actor visualization appears to stop functioning. May be unrelated to my code.

The visual quantity limit is probably the in the LOD parameter config. I'll definitely look at this soon, still shoveling the rest of the project into plugins.

Ji-Rath commented 1 year ago

I finally tackled performance and gave into using arrays for formations.

With 5000 entities Before

After

Kind of embarrassing looking at the original stats but still progress! I have ideas to make the update faster (currently only runs when an entity needs a new position), but I think it is 'good enough' for now.

https://user-images.githubusercontent.com/1747157/178365202-8f175609-96d8-4a98-a3f2-1ab6dc133e80.mp4

Ji-Rath commented 1 year ago

Multiple unit support! Units now automatically rotate when moving to a new position too. I'm thinking about wrapping it up soon, so any suggestions are greatly appreciated. To be honest, this isn't groundbreaking work but maybe this example will inspire someone to create a better real-time 'Total War' game lol.

https://user-images.githubusercontent.com/1747157/179020559-93f2f072-e4d2-4085-9f1c-aeb21c54b4ff.mp4

My only gripe is that this plugin depends on the MassCommunitySample plugin too. This is so entities can be destroyed with the sample projectile. One solution would be to either remove the functionality or implement it maybe in the project/plugin?

Oh and these too lol

Ji-Rath commented 1 year ago

This is gonna be just a little messy, I made the mistake of creating this plugin in main, so Im just going to create a new PR with the new branch so I can do some more work