npruehs / ue4-rts

Real-time strategy plugin and showcase for Unreal Engine 4.
MIT License
747 stars 151 forks source link

Character only moving a small amount before getting stuck #149

Closed DomDom3333 closed 3 years ago

DomDom3333 commented 3 years ago

Hey, I don't know if this is the right place for this but I'm having issues making characters move properly. I have one moving but it only moves a few centimeters and the stops and doesn't move again. It seems to always be in the same direction as well. I followed the documentation word for word but since I'm a bit new to Unreal, I suspect that I did something wrong.

Thanks for any help.

Zimbo1786 commented 3 years ago

Hi @DomDom3333,

With your map, have you added a NavMeshBoundsVolume and if so, have you adjusted the Brush settings (it defaults to 200, 200, 200 on the X, Y and Z-axes)?

DomDom3333 commented 3 years ago

Yup. Just testing things on a flat test map and everything is green when i press P, with small cutouts around each thing place, like its meant to be.

coolyoshi commented 3 years ago

When setting up gameplay tags, did you import the file DT_RTSGameplayTags? (you shouldn't create a new tag called "DT_RTSGameplayTags", but should import the actual file)

DomDom3333 commented 3 years ago

No i believe i just created them in the project settings. Where is the file i need to import? How do add the file? It only has a name field. image

coolyoshi commented 3 years ago

In the content browser, there's a tiny button called "View Options". Click that and hit "Show Plugin Content". Then you'll see the file is in "RealTimeStrategy Content"->"Data" folder.

For adding the file, should be an option under "Gameplay Tag Table List". Might need to add a new list item by clicking the + button.

DomDom3333 commented 3 years ago

Alright, I've done that. It added successfully. image

However the problem is still present. the unit moves a small amount and then gets stuck there. The Fog of war and everything updates but the unit just stops there. Always in the same pattern as well, regardless of where I send it to.

Zimbo1786 commented 3 years ago

Hi @DomDom3333,

With the blackboard or behaviour tree, have you made any modifications?

DomDom3333 commented 3 years ago

None whatsoever. I just followed the Step by step guide up to the Units. Basically everything to make a Unit move afaik.

coolyoshi commented 3 years ago

When orders are issued, it actually issues an order on the first actor hit. I suspect maybe it's hitting either the minimap or vision volume? To fix it you can update the code to ignore those volumes by doing the following:

In RTSPlayerController add the following lines near the top:

include "UI/RTSMinimapVolume.h"

include "Vision/RTSVisionVolume.h"

Then find this line: "DefaultOrderIgnoreTargetClasses.Add(ARTSCameraBoundsVolume::StaticClass());". Underneath that line add the following lines: DefaultOrderIgnoreTargetClasses.Add(ARTSVisionVolume::StaticClass()); DefaultOrderIgnoreTargetClasses.Add(ARTSMinimapVolume::StaticClass());

DomDom3333 commented 3 years ago

@coolyoshi As im still pretty new in Unreal, im using blueprint mode. Is there a way to do it using Blueprints too or does that only work in the C++ projects?

DomDom3333 commented 3 years ago

Update: So I just booted the project file and it works. Didn't change a thing. No idea why it didn't work before. Its now moving normal but only ~90% of the distance. There's always a little left to go. Any reason why it would do that?

Edit: And the model seems to glitch out for a single frame at the start of the movement. Have no image to verify but it looks like the model distorts wildly. Since I'm using a basic cone as a placeholder and nothing else, I don't think it's the model causing it.

Edit 2: And the vision cone doesn't stick to the unit being moved. It kinda moves along but if the unit moves far enough waya, it will actually leave the field of view all together and move into the fog of war where it is no longer visible. Should i raise a separate issue for this?

image

Zimbo1786 commented 3 years ago

Hi @DomDom3333,

On the update (Point 1): This looks to me like your settings on your NavMeshVolume - can you increase the box settings on this and see what it does?

On Edit 1 (Point 2): Not sure about that - may be linked to an earlier open case about moving the unit.

On Edit 2 (Point 3): This looks like the settings in the RTSMinimapVolume and RTSVisionVolume. I have mine set to be slightly larger than the rest of my settings (FogofWarPostProcessing, RTSCameraBounds and NavMeshBounds)and that keeps everything in line with what you would expect to see in an RTS with units vision and reaching the end of a map.

DomDom3333 commented 3 years ago

Hey @Zimbo1786 Thanks a lot for the suggestions.

The Unit not moving the entire distance is still present after increasing the NavMeshBoundsVolume

The moving of the unit to the edge of the fog of war is resuced a lot by increasing the size of the Minimap volume and the Vision Volume. It doesnt't remove the issue though.

npruehs commented 3 years ago

Units not moving the entire distance could happen due to the "Acceptance Radius" that's specified for the MoveTo nodes in the behavior tree. This is required for preventing units from trying to reach their destination indefinitely, especially when ordering multiple units (with collision) to move the same location. Unfortunately, that's a pretty hard problem to solve, as we learned the hard way with A Year Of Rain. The problem becomes more important to you in case you've got melee units. You might want to take a look around for solving "path following" (in contrast to path finding). Until now, that has been out-of-scope for this plugin.