i know that this thread might not be right to be here since it’s a smartfox question, i asked them for help about doing a countdown timer and they keep putting me on the manual about using a taskscheduler which all it does is just start a new thread and i implemented it verbatim by the manual but no luck.
pretty much i’m trying to make it so i’m able to have the server do a countdown time for the clients like once all users are in the lobby countdown to start the game.
so far i been researching about the java classes and i don’t mean javascript by the way for those who don’t know the difference.
java.util.Timer;
java.util.timertask;
java.util.date;
using the date it’s weird because of the format i’m just trying to do something similar as saying
public float timer = 30;
timer -= Time.deltatime;
but on the smartfox server, anyone here knowledgable with java that could guide me about it?
Your lobby is a room in the server, check the amount of users when one joins the room and when it’s full start the task scheduler.
There is a thread somewhere in the SFS forum that has a working example i think.
Or at least to get you on the way. I used it once but i don’t have the code anymore.
But I remember it’s not that hard to get it to work.
Also you can post your code for the scheduler on SFS forums and someone will help you.
i’m having lots of problems with the task scheduler, i did it the same way the manual does it.
it seems to only run once: for example if i use the start function to send an extension response to the server it does runs the task scheduler and it runs but i can’t get a variable to return back to the clients that updates at runtime. if i send the extension response using the update or fixed update functions it just restarts the task shceduler making new threads causing unity to crash.
I would make it transparent to the client. The dumber the client the better.
Have the server count the players in the lobby as they enter, when full send a message to all clients to start the countdown.
That’s only a visual effect.
On the server use the task to push them into the game room.