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"

How to get a server created timer information from a client ?

Sooo say I created a timer on authority only and wanted to retrieve the "remaining time by handle" from a client, how would I go about doing that ?

I'm using the remaining time and the initial timer length to feed into a progress bar on a UMG widget in order to show a powerup's remaining time to a player.

As an example I took the networking content example and tried to implement the following which returns a big fat zero on the client. I thought the value would show up on the client since I'm replicating the "float value" and the server definitely knows about the "timehandle" variable.

Any thoughts on how to retrieve timer info from a client's perspective and feed that into an UMG widget ?

alt text

Product Version: UE 4.11
Tags:
more ▼

asked May 09 '16 at 04:11 AM in Blueprint Scripting

avatar image

SuperDuperYeah
118 5 9 12

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

3 answers: sort voted first

The are timeline component, which have built networking functionality, besides that i can't think of efficient way to do so.

more ▼

answered May 09 '16 at 09:45 AM

avatar image

CriErr
1.2k 57 21 57

avatar image SuperDuperYeah May 10 '16 at 04:48 AM

Ahhh yes haven't thought about that. I'll try with a replicated timeline.

Any downsides to using a timeline versus a timer though ?

But one thing that puzzles me a bit is... Say I create a timer on authority and I set the timer handle to be replicated... Should't the client be able to snatch it and get values from it (remaining and elapsed time for example?).

avatar image CriErr May 10 '16 at 05:44 AM

Timeline is bigger, quite literally, its component. If you don't need thousands of them it would be ok.

You can test those timer questions, but i highly doubt its how timer work. I didnt dig the source, but i imagine timer is actually some sort of component in engine, which keep track of time and call functions by pointer from its library.

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

Your timer does need to be replicated (you can tell it isn't because it doesnt have those two bubbles on it) alternatively you'd have to build functions that retrieve the value as client call.

more ▼

answered May 10 '16 at 08:46 AM

avatar image

Mopperl
263 9 6 16

avatar image SuperDuperYeah May 14 '16 at 08:01 PM

So I tried before with a replicated timer handle variable before but without any luck. I've linked a picture of my attempt : alt text

Would it be a thing to do the following for an armor pickup (just using the armor pickup thing as an example) :

  • Client collides with a pickup trigger.

  • Only on authority, spawn an actor called "effect" with owner set to the client.

  • On "effect" begin play check if authority.

  • If authority, call a run on owning client function that sets a timer and that also calls a multicast to apply the armor boost effect.

  • Once the timer (created on client from server) is over call a run on server function asking the server to remove the armor boost.

I was thinking of doing this since I can only create an UMG widget on a local player... that way I can pass the timer into the create widget function and have a sort of "correct cooldown feedback" with a progress bar.

But yeah... my understanding of networking principles only go so far right now.

timerthing.png (815.0 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

From my point of view replicating timers is bad practice... I would suggest you going in different direction. There is no sense in replicating timer statuses. Since you know their time on both sides - you can start them on both sides:

  • on client side you will only use it to show progress on user interface (even every frame).

  • on server side it would take care of your gameplay logic.

If you need reliable acknowledge after timer elapsed, set replicated status variable on server side or fire multicast event. ex: Dota2 Skill cooldown progress does not have to be replicated every tick or every 0.1s. User interface can run it's own timer locally. After cooldown time timer on server side will change skill replicates status to "ReadyToUse".

btw. Handles are not replicated because "timer" is a local resource... or entry in delegate list somewhere in engine main loop.

more ▼

answered May 15 '16 at 01:46 AM

avatar image

mpo
578 23 15 48

(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