|
| 05 Jul 2016 05:26 PM |
| I've been doing basically all random number generation serverside so people can't exploit the rng seed to predict the randomization, but then I remembered there's stuff that should be handled by the client with server authority. Would it be better to do rng serverside and then send it to the client, or should I do it clientside and risk the slight vulnerability to clear up network traffic? |
|
|
| Report Abuse |
|
|
AxonMega
|
  |
| Joined: 29 Aug 2014 |
| Total Posts: 2403 |
|
|
| 05 Jul 2016 05:44 PM |
| Use a RNG to determine the answer to your request, and all will be well. |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2016 06:28 PM |
In most cases I would say clientside, but it depends on what you're doing. If you're even thinking of handling it serverside, you probably have a good reason for it.
What are you trying to do, exactly? If this is something sensitive it shouldn't be handled on the client in the first place; remember, the client should only serve as a way for you to gather input and provide feedback (e.g interfaces). |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2016 06:29 PM |
| For example, if you're handling a daily login reward and want to pick a random award using a random number, you should be handling that entirely on the server and only notifying the client of the reward so that they can, for example, display the reward in an interface. |
|
|
| Report Abuse |
|
|
iJava
|
  |
| Joined: 06 Mar 2011 |
| Total Posts: 29914 |
|
|
| 05 Jul 2016 06:34 PM |
math.randomseed(os.time()%16)
-Widths |
|
|
| Report Abuse |
|
|
|
| 06 Jul 2016 12:29 AM |
| The issue, I mean, is that doing rng clientside allows the player to see the seed used. Many cheat programs for games are able to use the seed to accurately predict the random number. |
|
|
| Report Abuse |
|
|
iJava
|
  |
| Joined: 06 Mar 2011 |
| Total Posts: 29914 |
|
|
| 06 Jul 2016 12:29 AM |
ok, then just use math.randomseed(os.time()%16)
-Widths |
|
|
| Report Abuse |
|
|
|
| 06 Jul 2016 12:43 AM |
| That is not at all what I'm asking. |
|
|
| Report Abuse |
|
|
DevVince
|
  |
| Joined: 08 Nov 2008 |
| Total Posts: 9245 |
|
|
| 06 Jul 2016 12:47 AM |
Get it on the server, then return it to the client. :p
|
|
|
| Report Abuse |
|
|
iJava
|
  |
| Joined: 06 Mar 2011 |
| Total Posts: 29914 |
|
|
| 06 Jul 2016 01:43 AM |
if you use os.time() (serverside time) as the seed for math.random(), then they can't manipulate it on the client because it would no longer be based off of tick() (client time)
-Widths |
|
|
| Report Abuse |
|
|
| |
|
DevVince
|
  |
| Joined: 08 Nov 2008 |
| Total Posts: 9245 |
|
|
| 06 Jul 2016 01:45 AM |
*edits computer time in settings* Muahahah!! I do this on my phone on games that want me to wait a day for a building to build and I just edit my settings. lololol
So no that won't work and is a bad idea. XD
|
|
|
| Report Abuse |
|
|