How do i code server rpc in 4.7 ?

I don’t have any deprecation warrning 0o.

Did you tried to bounce your Thread in the 4.7preview thread so it get cought by the develloper that are watching the thread to fix bug of 4.7 preview?
I bet you will have a better feedback directly from Epic on this and we might get the bottom of it.

Ok I am sorry, I just did a test and the fix I suggested only works for BlueprintNativeEvent, not RPCs (both need an _Implementation method, that is why I thought this was the same solution). I also don’t get any warnings, like inside said.

Which preview build are you using? I am on preview 2
Otherwise you should go with Elvince suggestion and note it in the peview thread.

Yes, preview 2 as well for me.
All right, so i am probably doing something wrong.
I did post on the preview thread to draw the attention , let’s hope help will come :slight_smile:
Thank you very much !

The warnings are still there in 4.7 preview 3.

Hm I’m using source version and do not have warnings.

Interesting, i am using the launcher version.
Thanks !

I am very surprised that nobody else seems to have this problem.

I have started a brand new code (4.7p4 / c++ / basic code), just added an AActor derived class with this code


UFUNCTION(server, withvalidation, reliable)
	void ServerMove(FVector Velocity, bool bSweep);

-------------------------------------------------------------------------------------

bool ASpider::ServerMove_Validate(FVector Velocity, bool bSweep){ return true; }
void ASpider::ServerMove_Implementation(FVector Velocity, bool bSweep)
{
	AddActorWorldOffset(Velocity, bSweep);
}

Et voila:


1>C:\Users\cedric\Documents\Unreal Projects\SpiderTest\Source\SpiderTest\Spider/Spider.h(14)( : warning C4996: Function Spider::ServerMove needs native implementation by virtual void ServerMove_Implementation(FVector Velocity, bool bSweep) due to its properties. Currently ServerMove_Implementation declaration is autogenerated by UHT. Since next release you'll have to provide declaration on your own. Please update your code before upgrading to the next release, otherwise your project will no longer compile.

All this was made in 4.7 preview 4.

Cheers

Cedric

Finally got something working from this thread:

In case ayone comes , is the working code:


UFUNCTION(server, withvalidation, reliable)
	void ServerMove(FVector Velocity, bool bSweep); 
virtual bool ServerMove_Validate(FVector Velocity, bool bSweep);
virtual void ServerMove_Implementation(FVector Velocity, bool bSweep);

This seems awkward though, i am waiting for some official confirmation from staff that this is the normal way to declare rpc from now on.

Good to know. He will be part of the migration steps to 4.7

I think most of the people (in this forum part) are not on 4.7. This may explain or not why you don’t have a lot of answer.
More the warning that you have is now “clear enough” so we know that on 4.8 this warning will be an error ^^

Thanks for the tracking and keeping us updated!

I would’ve run into this at some point, so I just wanted to say thanks for sharing this!

I’m jumping at new version as soon as versioned release is on github.

But! I just haven’t seen this warring in 4.7. And I sitll don’t have it.

Hey Iniside,

From what i understood by testing, the warnings happen only when a header containing a server rpc declaration is parsed.

As long as you don’t modify one of those and only modify rpc-empty files, you won’t see the warnings when making a simple build.

If you force a complete rebuild or make a modification in a rpc declaring file, you should see them.

I had them even in a brand new 4.7p4 project, so i would be very surprised you don’t.

Well, if you don’t, that’s good for you :slight_smile:

After all, let’s not forget all this has not received any official confirmation yet, it might still be a problem with me only for some reason.

Cheers
Cedric

Hey everyone,

Sorry for the confusion about this. The automatic generation of _Implementation and _Validate function declarations has been deprecated in 4.7, and will likely be removed in 4.8, so you should update your RPCs and add these declarations.

Some of you may not be seeing the warning because it will only be emitted if the class containing the RPC function uses the GENERATED_BODY macro, and not if the class uses GENERATED_UCLASS_BODY.

Hi Ryan,

Thanks a lot, that clarifies everything :slight_smile:

Cheers

Cedric

To clarify, you only get the warning if you use GENERATED_BODY ?

That’s correct.

Of course the GENERATED_BODY also has to be in the same class as the RPC function! :slight_smile:

So, what does this mean… we have to type in all of the following now?



UFUNCTION(Server, Reliable, WithValidation)
void ServerDoSomething();
void ServerDoSomething_Implementation();
bool ServerDoSomething_Validate();


Is the above syntax correct for defining these?

The problem then occurs, when I add the _Implementation function, that the compiler says that it already exists. And it doesn’t warn me at all about the lacking _Validation function declaration, which it should be?


	UFUNCTION( Category = "Barrage | Game | Player Controller", Reliable, Server, WithValidation )
	virtual void SetTurretFireGroupServer( int8 iFireGroup );

Generates warning


	UFUNCTION( Category = "Barrage | Game | Player Controller", Reliable, Server, WithValidation )
	virtual void SetTurretFireGroupServer( int8 iFireGroup );
	virtual void SetTurretFireGroupServer_Implementation( int8 iFireGroup );

Generates error saying it already exists. “error C2535: ‘void ABCPlayerController::SetTurretFireGroupServer_Implementation(int8)’ : member function already defined or declared”

I have the latest code in the 4.7 branch of the engine repo.

Something is pretty broken… unless I’m misunderstanding what I should be doing? I’ve “fixed” this by just disabling the warning in the codegenerator.cpp file and not declaring the function.

I have the same issue as TTaM, with the release build of 4.7. It’s really confusing.