Announcement

Collapse
No announcement yet.

How do i code server rpc in 4.7 ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #31
    I would've run into this at some point, so I just wanted to say thanks for sharing this!
    Journeyman's Minimap - Available on Marketplace - Forum topic - Video

    Comment


      #32
      Originally posted by Elvince View Post
      Good to know. He will be part of the migration steps to 4.7

      I think most of the people here (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'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.
      https://github.com/iniside/ActionRPGGame - Action RPG Starter kit. Work in Progress. You can use it in whatever way you wish.

      Comment


        #33
        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 :-)

        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

        Comment


          #34
          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.

          Comment


            #35
            Hi Ryan,

            Thanks a lot, that clarifies everything :-)

            Cheers

            Cedric

            Comment


              #36
              Originally posted by Ryan Gerleve View Post
              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.
              To clarify, you only get the warning if you use GENERATED_BODY ?
              TTaM, Daekesh, Lumberjack. [Barrage] [Greenlight]
              Yes, the golden pigs fly at midnight - but do not listen to them, they speak only lies and treachery.

              Comment


                #37
                Originally posted by TTaM View Post
                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!

                Comment


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

                  Code:
                  UFUNCTION(Server, Reliable, WithValidation)
                  void ServerDoSomething();
                  void ServerDoSomething_Implementation();
                  bool ServerDoSomething_Validate();
                  Is the above syntax correct for defining these?

                  Comment


                    #39
                    Originally posted by Ryan Gerleve View Post
                    That's correct.

                    Of course the GENERATED_BODY also has to be in the same class as the RPC function!
                    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?

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

                    Code:
                    	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.
                    TTaM, Daekesh, Lumberjack. [Barrage] [Greenlight]
                    Yes, the golden pigs fly at midnight - but do not listen to them, they speak only lies and treachery.

                    Comment


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

                      Comment


                        #41
                        Hey guys,

                        You've got a working code in post #29 of this thread ;-)

                        Cheers

                        Cedric

                        Comment


                          #42
                          I'm also having the "member function already defined or declared" problem. I declared it on the header like this:

                          Code:
                          UFUNCTION(Server, Reliable, WithValidation, BlueprintCallable, Category = "Test")
                          void ServerTest(int32 Value);
                          
                          virtual bool ServerTest_Validation(int32 Value);
                          virtual void ServerTest_Implementation(int32 Value);
                          Error 1 error C2535: 'void ATest::ServerTest_Implementation(int32)' : member function already defined or declared

                          This is on the 4.7 release version that was made available today.
                          Last edited by xlar8or; 02-25-2015, 12:06 PM.

                          Comment


                            #43
                            Hi xlar8or,

                            You have "Validation" instead of "Validate", that might be a possible cause for your problem.

                            Cheers

                            Cedric

                            Comment


                              #44
                              That's why you should always copy from the cpp and not write it yourself :P The error was misleading indeed. Thank you

                              Comment


                                #45
                                Apparently my error was that I had virtual void function_Validate at some point instead of virtual bool, which led to a barrage of error messages.

                                There is also a nasty little pitfall where commenting out the _Validate and and _Implementation declarations will lead to the same errors (not warnings, errors). I guess the precompiler gets confused by this somehow. Comments breaking code is pretty unexpected to say the least.

                                Comment

                                Working...
                                X