x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Character movement not replicating

Hello,

I'm trying to setup a coop 2D game and i'm having issues getting the character movement to replicate to clients. My actors appear to be setup correctly, and I'm not sure where the issue lies.

I have my Character class that was pregenerated by the 2D Platformer template in C++. I've made changes to insert animations and basic logic etc for moving. Didn't touch anything code wise on the networking side. I created blueprints based off each class so my designer can add functionality if needed and whatever. The actors in the Blueprints are set to replicate, and movement is set to replicate.

The server replicates the animations, and shows the correct animations and rotation for the actor on the client. But no movement shows from the servers actor on the client. So you see the actor turn, and the animations for crouching happen. But it all happens in the initial position. Nothing from the client replicates to the server either.

None of the movement ever makes it to the client, so doubt its lag. Especially since the animation changes are instant.

Also, for whatever reason, the clients pawn floats in midair at the spawn and has no physics. This is on the client as well as the server. It also does not allow me any movement. My level has 2 player starts and the server correctly spawns the players at both randomly.

I have a C++ GameState, GameMode, and PC class but all have no code other than what the editor generates. I plan to add more code later, but mentioning here anyways. All have Blueprints generated from them that will be actually used. All C++ classes in this project are base classes and blueprints will be based off them for actual use now that i think about it.

I feel like Im missing something in my code to tell the server to replicate things, but at the same time since half is replicating and not, Im not sure. Not to mention I generated the same C++ 2d template and ran it and the networking was fine. All ive changed is logic for animations (Based off variables that are replicated) and added in a half-height change on the capsule component when the character ducks. Ive looked through all of Epics documentation on networking, but it just seems like the replicate movement checkbox and replicates checkbox should do the logic for the particular bug im having.

Product Version: Not Selected
Tags:
more ▼

asked Apr 02 '15 at 05:12 AM in C++ Programming

avatar image

shigan5
158 7 8 76

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Ah, I fixed my own issue. I forgot to call the Super function in my void ASideOpCharacter::GetLifetimeReplicatedProps(TArray< FLifetimeProperty > & OutLifetimeProps) const { }

adding

Super::GetLifetimeReplicatedProps(OutLifetimeProps);

to the function body solved the issue.

more ▼

answered Apr 02 '15 at 05:29 AM

avatar image

shigan5
158 7 8 76

avatar image Traxdata Feb 11 '16 at 04:11 PM

Man you saved my life :D

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question