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"

[Closed] Replicate an actor reference/pointer


I am implementing a selection system in a multiplayer game. The player can click on an actor (client-side), and I want to call a meyhod of this actor on the server.

Problem is : how can I transmit the actor's reference over the wire ? Obviously a pointer can't work, what should I do ?

Thanks !

Product Version: Not Selected
more ▼

asked Apr 03 '14 at 10:59 PM in C++ Programming

avatar image

594 55 64 133

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

The question has been closed Apr 28 '15 at 07:44 AM by StrangerGwenn for the following reason:

The question is answered, right answer was accepted

1 answer: sort voted first

You can actually refer to these as pointers over the wire :)

If this is a static actor (loaded with the level), it should just work. If the actor is dynamic (spawned during play), it will need to be a replicated actor, and relevant.

Assuming the actor is static or replicated, just refer to it as you normally would in RPC calls. If this is a property on an actor that refers to another actor, just mark that property as replicated.

Hope this helps!

more ▼

answered Apr 03 '14 at 11:08 PM

avatar image [Epic] John Pollard STAFF Apr 03 '14 at 11:18 PM

To clarify, if the actor you are referencing is dynamic but not relevant, you can still refer to it over the wire, it will just be sent as a NULL pointer to non relevant clients. This is normal behavior, and the client should be resilient to this.

In the case where a dynamic actor is not marked as replicated, but is being referred to, it will also be sent as NULL. This is a weird case though, and should be avoided, since it doesn't make much sense to refer to this type of actor over the wire (the engine won't crash, but this could be a misleading case for game code).

avatar image StrangerGwenn Apr 03 '14 at 11:22 PM

Thanks !

What about Pawns, Controllers, AIControllers, Weapons ? Those are primarily the ones I want to play with. Can I simply pass an AIController* parameter to a "server" method from a client, and expect the correct result ?

avatar image [Epic] John Pollard STAFF Apr 03 '14 at 11:24 PM

Yes, that should work.

avatar image StrangerGwenn Apr 03 '14 at 11:58 PM

Thank you so much. This is awesome !

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

Follow this question

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

Answers to this question