Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTS Formations Example #39

Open
wants to merge 38 commits into
base: main
Choose a base branch
from
Open

Conversation

Ji-Rath
Copy link
Contributor

@Ji-Rath Ji-Rath commented Jul 14, 2022

Apologies in advance for the duplicate PR, just goofed up with my fork and made a PR in main
Basically, just a simple PR to add a formations example to MassSample. In my opinion, its not breaking any barriers, but I think it's a good example to see what is possible with Mass. It is all encapsulated in its own plugin too! Consider checking out #37 for more info.

MassSample-FormationV1.mp4

Ji-Rath added 23 commits July 14, 2022 14:24
Adjust entity position in formation to try and make it more seamless - WIP
…ously, it can use more work. Entities now go to location and choose a destination based on distance.
Optimize and cleanup rts subsystem for large-scale use
Still need to consider if its feasible to move some logic to a processor rather than the subsystem
Get units to move in formation...at least good enough
Adjust tolerance for reaching formation position
Add RTSUpdateEntityIndex to spread out logic cost when finding formation index
Fix bug where entities would stop moving when travelling to new destination
…culated every processor tick. This also allows me to implement different formations in one spot.
Move enum formation to FormationPresets to avoid circular dependency, should be moved to its own class in the future
Implement smooth rotation of unit when the angle is not extreme
… interpolation is already built-in

Temporarily remove optimizations for debugging
Add specific logic for smooth rotations at close angles while recalculating units index when making large turns
Remove LerpDegrees as it is no longer used
…better separate code chunks

Implement simple comments to core functions in RTSFormationSubsystem for my own sanity
Modify turn rotation on units so they turn about half as fast - should be a variable in the future
Add GameplayDebuggerCategory_RTSAgents
Add GameplayDebugger to dependency list
@Megafunk
Copy link
Owner

Megafunk commented Sep 2, 2022

Sorry about the lack of response, I'll get around to looking at this over the weekend!

@Ji-Rath
Copy link
Contributor Author

Ji-Rath commented Sep 5, 2022

No problem! I got a little carried away with some of the functionality (and some WIP features) so let me know if it is too complex or should be condensed to fit the MassSample.

@Megafunk
Copy link
Owner

Megafunk commented Sep 6, 2022

This is sweet because it's an often requested feature (RTS stuff!) It's even in a separate plugin which shows off the power of composition and saves people who don't need it some space.

However, I think I broke it?

UnrealEditor-Win64-DebugGame_2022-09-05_19-23-36.mp4

Did I miss something? I assume there is some setup I forgot or I may be using the wrong pawn. Do you have some content only stored in your project or something?

@Ji-Rath
Copy link
Contributor Author

Ji-Rath commented Sep 6, 2022

This is sweet because it's an often requested feature (RTS stuff!) It's even in a separate plugin which shows off the power of composition and saves people who don't need it some space.

However, I think I broke it?

UnrealEditor-Win64-DebugGame_2022-09-05_19-23-36.mp4
Did I miss something? I assume there is some setup I forgot or I may be using the wrong pawn. Do you have some content only stored in your project or something?

Ah shucks, Im going to take another look and get back to you on that. I think there might be some content I forgot to move over to the plugin.

…nal before calling

Fix units not updating their position correctly when setting a new preset or being spawned in-game
Move Hash grid processors to their own file
…t an observer working for the life of me - should be further investigated
Add BP_Pad for base class of interactables
…fault, will need to determine whether its worth it to create an LODCollectorProcessor or leave it out for simplicity
…g due to roadblock with observers - needs further investigation
@Ji-Rath
Copy link
Contributor Author

Ji-Rath commented Sep 8, 2022

The current version still has a few bugs to iron out (also I can definitely do better in terms of performance) but all my changes should be available. Let me know if for some reason the map is still not functional. The gamemode in the map should be BP_FormationGameMode if its not already set 👍

MassSample-RTSDestruction.mp4

@Megafunk
Copy link
Owner

The fixes worked! I can now make units that run around in formation!

As for the max of 100 issue mentioned in the original pr my assumption is it's just the LODMax count but I'm not seeing anything wacky happening so far.
image

I'm seeing some exceptions triggered from actor representation when clicking on actors at times but this is definitely good enough to include as "experimental" in my mind. Nice!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants