| Mirage Source http://www.miragesource.net/forums/ |
|
| Spodi, about Double Tick Count http://www.miragesource.net/forums/viewtopic.php?f=201&t=2977 |
Page 1 of 11 |
| Author: | William [ Sun Nov 04, 2007 5:52 pm ] |
| Post subject: | Spodi, about Double Tick Count |
You where talking about resolution, but I didn't full understand what you ment. I know that you dissliked the idea of doing it, could you tell me why? Cause I need to protect my game from speedhacks. |
|
| Author: | Rezeyu [ Sun Nov 04, 2007 6:47 pm ] |
| Post subject: | Re: Spodi, about Double Tick Count |
Couldn't you just control movement server side? |
|
| Author: | Spodi [ Sun Nov 04, 2007 7:33 pm ] |
| Post subject: | Re: Spodi, about Double Tick Count |
Rezeyu wrote: Couldn't you just control movement server side? Optimally, you'd control it both. General rule of thumb is the physics / math of the server and client are as identical as possible, so they can both simulate together. When the user moves, the client first checks if it is okay, then when the server gets it, it verifies it is okay. Skipping the server check allows hacking but reduces server load, and skipping the client check results in the server receiving an excessive amount of movement requests. Resolution, in this context, is just how accurate the timer is. For example, a millisecond resolution would look like: 1, 2, 3, 4, 5, 6... While a 30-millisecond resolution would look like: 1, 1, 1, 4, 4, 4, 7, 7, 7, 10... The reason I suggest again a lower-resolution timer is like I said above - the server and client should be replicating the physics as closely as possible. Lets say, for example, we have a platformer game with a nice physics engine. In the game, the user kicks a box, which falls off the cliff. If we had a lower resolution timer, we could end up skipping a few milliseconds worth of calculations since the timing would be rounded, and because the server and client are different computers, they will be rounded differently. The box could end up in two different positions or have two slightly different paths of flight. The server may end up seeing it smashing an ant, while the client sees it landing in front of the ant. But since the server saw it smash the ant, the client is told the ant is smashed, and the user is sitting there thinking, "wtf m8?". I know Mirage has nothing as extensive as that, but its just to give an example of how badly it can mess things up. Another is movement. Client rounds up, sees its okay to move, sever sees it not being okay, rejects the packet, client moves anyways, the client is now offset by one tile. Of course, that can and should be fixed with a server-side check, but then the server still has to waste time and bandwidth on that extra packet that is just dropped. |
|
| Author: | William [ Sun Nov 04, 2007 10:15 pm ] |
| Post subject: | Re: Spodi, about Double Tick Count |
Okay, I see what you mean. But still, the client and server is not dependent on each others tickcount. The client basicly sends it when his ready, and the server is always open to receive it. So even if it doesn't correlates together doesn't mean it will affect it. Are you sure it could mess things up? Cause it might be worth adding it since it helps against speed hacks. Although I'am considering adding a check serverside, that will check if more than for example 10 movement packets has been sent the last second or so. If so, kick or ban. |
|
| Author: | Spodi [ Mon Nov 05, 2007 12:02 am ] |
| Post subject: | Re: Spodi, about Double Tick Count |
Well if the timings aren't critical, which I guess they aren't, then theres no harm. |
|
| Author: | William [ Mon Nov 05, 2007 8:42 pm ] |
| Post subject: | Re: Spodi, about Double Tick Count |
Do you think that doing this to the tickcount will prevent speed hacks from having a affect? |
|
| Author: | Spodi [ Mon Nov 05, 2007 8:44 pm ] |
| Post subject: | Re: Spodi, about Double Tick Count |
Not sure, I haven't dealt much with speed-hacking. |
|
| Author: | Lea [ Mon Nov 05, 2007 9:03 pm ] |
| Post subject: | Re: Spodi, about Double Tick Count |
Send packet from server to client Both server and client start timer Send packet from server to client Both client and server stop timer Client sends server the deltaT compare with server's deltaT If it's significantly different, mark the client |
|
| Author: | supermatthew [ Thu Nov 08, 2007 6:52 am ] |
| Post subject: | Re: Spodi, about Double Tick Count |
to counter speed hacks, i would do something like this. Although i work with .net, which has threading support, and would make it easier. in some form of server loop(a seprate thread in vb.net, maby part of the server loop/another timer): 10 second delay, or even longer send request to all clients for time Client responce: it includes seconds and minutes, and hours maby? Do a check from last request to get difference, allowing for rollover, like 55 seconds, 2 min was last, and now its 25 sec, 3 min, a 30 second difference, now you take this difference, and something like TimeDifference = (CurrentReponceDiff / DelayTime) * 100 which would be 300% and lets say you want there to be a 150% maximum, for lag and such, anything higher and client would be banned. lot less work with server, cause your not checking everytime they move. |
|
| Author: | Matt [ Thu Nov 08, 2007 8:42 am ] |
| Post subject: | Re: Spodi, about Double Tick Count |
supermatthew wrote: to counter speed hacks, i would do something like this. Although i work with .net, which has threading support, and would make it easier. in some form of server loop(a seprate thread in vb.net, maby part of the server loop/another timer): 10 second delay, or even longer send request to all clients for time Client responce: it includes seconds and minutes, and hours maby? Do a check from last request to get difference, allowing for rollover, like 55 seconds, 2 min was last, and now its 25 sec, 3 min, a 30 second difference, now you take this difference, and something like TimeDifference = (CurrentReponceDiff / DelayTime) * 100 which would be 300% and lets say you want there to be a 150% maximum, for lag and such, anything higher and client would be banned. lot less work with server, cause your not checking everytime they move. No, but at a fixed time, you're sending a shit load of packets back and forth. Not very bright, imo. |
|
| Author: | Spodi [ Thu Nov 08, 2007 9:03 am ] |
| Post subject: | Re: Spodi, about Double Tick Count |
You could easily just do it once every minute or two. It doesn't have to be often. I have no idea how threading would help at all, unless you are using the thread in a completely stupid manner like spawning a new thread just to send the packet after an elapsed amount of time. |
|
| Author: | William [ Thu Nov 08, 2007 10:35 am ] |
| Post subject: | Re: Spodi, about Double Tick Count |
Dave wrote: Send packet from server to client Both server and client start timer Send packet from server to client Both client and server stop timer Client sends server the deltaT compare with server's deltaT If it's significantly different, mark the client Yeah, that's a very easy method indeed. |
|
| Author: | supermatthew [ Thu Nov 08, 2007 1:32 pm ] |
| Post subject: | Re: Spodi, about Double Tick Count |
Spodi wrote: You could easily just do it once every minute or two. It doesn't have to be often. I have no idea how threading would help at all, unless you are using the thread in a completely stupid manner like spawning a new thread just to send the packet after an elapsed amount of time. threads are not bad. in vb.net, you would do something like Code: dim T as Threading.Thread sub form1_Load(byval sender as object, byval e as system.eventArgs) handles form1.load T = new threading.thread(addressof CheckClientsSpeed) T.Priority = Priority.low t.Start end sub Code: sub CheckClientsSpeed() while true threading.thread.currentThread.sleep(40000) ' 40 seconds 'um using my engine as an example Dim myEnumerator As IDictionaryEnumerator = _USERS.GetEnumerator() While myEnumerator.MoveNext() If UserOnline(DirectCast(myEnumerator.Value, clsPlayer)) Then SendTo(DirectCast(myEnumerator.Value, clsPlayer), PTD.TimeRequest) End If End While end while end sub or if you were more oop Code: sub CheckClientsSpeed() while true threading.thread.currentThread.sleep(40000) ' 40 seconds 'um using my engine as an example SendToAll(PTD.TimeRequest) end while end sub threads reduce the strain on a program and can speed things up alot, but you run into lots of problems accessing forms with other threads and stuff. |
|
| Author: | Matt [ Thu Nov 08, 2007 2:04 pm ] |
| Post subject: | Re: Spodi, about Double Tick Count |
supermatthew wrote: Spodi wrote: You could easily just do it once every minute or two. It doesn't have to be often. I have no idea how threading would help at all, unless you are using the thread in a completely stupid manner like spawning a new thread just to send the packet after an elapsed amount of time. threads are not bad. in vb.net, you would do something like Code: dim T as Threading.Thread sub form1_Load(byval sender as object, byval e as system.eventArgs) handles form1.load T = new threading.thread(addressof CheckClientsSpeed) T.Priority = Priority.low t.Start end sub Code: sub CheckClientsSpeed() while true threading.thread.currentThread.sleep(40000) ' 40 seconds 'um using my engine as an example Dim myEnumerator As IDictionaryEnumerator = _USERS.GetEnumerator() While myEnumerator.MoveNext() If UserOnline(DirectCast(myEnumerator.Value, clsPlayer)) Then SendTo(DirectCast(myEnumerator.Value, clsPlayer), PTD.TimeRequest) End If End While end while end sub or if you were more oop Code: sub CheckClientsSpeed() while true threading.thread.currentThread.sleep(40000) ' 40 seconds 'um using my engine as an example SendToAll(PTD.TimeRequest) end while end sub threads reduce the strain on a program and can speed things up alot, but you run into lots of problems accessing forms with other threads and stuff. This is NOT VB.Net. So nobody cares what you can do or how you would do it in .Net. |
|
| Author: | Lea [ Thu Nov 08, 2007 4:53 pm ] |
| Post subject: | Re: Spodi, about Double Tick Count |
It's not vb .net, however the concept is the same. Shut up Matt. |
|
| Author: | Matt [ Thu Nov 08, 2007 5:06 pm ] |
| Post subject: | Re: Spodi, about Double Tick Count |
Dave wrote: It's not vb .net, however the concept is the same. Shut up Matt. Ban me. Mr. I don't give a fuck anymore cause Willam don't give a fuck and I can't figure out how to enforce rules because the owner of the site doesn't do it. |
|
| Author: | William [ Thu Nov 08, 2007 5:18 pm ] |
| Post subject: | Re: Spodi, about Double Tick Count |
Perfekt wrote: Dave wrote: It's not vb .net, however the concept is the same. Shut up Matt. Ban me. Mr. I don't give a [edit] anymore cause Willam don't give a [edit] and I can't figure out how to enforce rules because the owner of the site doesn't do it. What are you talking about? |
|
| Author: | Matt [ Thu Nov 08, 2007 5:21 pm ] |
| Post subject: | Re: Spodi, about Double Tick Count |
Ask Dave. |
|
| Author: | Robin [ Thu Nov 08, 2007 5:24 pm ] |
| Post subject: | Re: Spodi, about Double Tick Count |
Don't start going off-topic. If you've got something to say, keep it to Pms and Ims. |
|
| Author: | Matt [ Thu Nov 08, 2007 5:30 pm ] |
| Post subject: | Re: Spodi, about Double Tick Count |
Robin wrote: Don't start going off-topic. If you've got something to say, keep it to Pms and Ims. I assume that's directed to William as well, since he was the first to really go off topic. My post before his, which was to Dave, was about something said in the topic, which was on topic. |
|
| Author: | Spodi [ Thu Nov 08, 2007 8:15 pm ] |
| Post subject: | Re: Spodi, about Double Tick Count |
I didn't say threads are bad, I just was stating that spawning a thread for something that doesn't need a thread is bad. In this scenario, there is: - A global game loop - One event being raised from the thread before its destroyed - No heavy importance of time (you can afford waiting a frame) All of these point to single-threading. Just because you can use multithreading, doesn't mean you should. Multithreading is only faster if theres blocking operations being called (file I/O or socket I/O namely). Besides that, it is always slower than the single-threaded alternative, it just appears faster because they are in sync. The CPU has to take extra time to sort the threads and find which one needs to be updated. |
|
| Page 1 of 11 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|