AstroCode
|
  |
| Joined: 09 Oct 2009 |
| Total Posts: 1122 |
|
|
| 20 Aug 2015 08:47 PM |
| I'm working on a building game that uses filtering. I'm finding it very hard to make my tools compatible with filtering because there is irritating lag when communicating with the server. When you use the move tool, it fires a RemoteEvent that tells the server to move the part. The lag makes the tools unbearable to use. Is there a 0-lag method of communicating with the server, or possibly a work-around? Otherwise, do you think it would be best to just not use filtering? |
|
|
| Report Abuse |
|
|
lsp425
|
  |
| Joined: 10 Dec 2011 |
| Total Posts: 603 |
|
|
| 20 Aug 2015 08:49 PM |
| Do NOT use seperate RemoteEvents for everything. I have an engine that runs on FE with close to no lag. There is one server, one client, and one RemoteFunction. The arguments of the RemoteEvent change what the remoteevent does instead of separate ones. |
|
|
| Report Abuse |
|
|
j1my3p1x
|
  |
| Joined: 16 Jan 2010 |
| Total Posts: 978 |
|
|
| 20 Aug 2015 08:52 PM |
| ^ your code is low quality then |
|
|
| Report Abuse |
|
|
AstroCode
|
  |
| Joined: 09 Oct 2009 |
| Total Posts: 1122 |
|
|
| 20 Aug 2015 08:56 PM |
1) I am only using 1 remote event
2) My code is efficient. It is as simple as:
Client: Event:FireServer("Move", part, cframe)
Server: Event.OnServerEvent:connect(function(plr, tool, ...) local tuple = {...} if tool == "Move" then tuple[1].CFrame = tuple[2] end end) |
|
|
| Report Abuse |
|
|
AstroCode
|
  |
| Joined: 09 Oct 2009 |
| Total Posts: 1122 |
|
|
| 20 Aug 2015 09:20 PM |
| Is there anything else that I can do? Should I still consider not using filtering? |
|
|
| Report Abuse |
|
|
ShungTzu
|
  |
| Joined: 14 Jun 2014 |
| Total Posts: 959 |
|
|
| 20 Aug 2015 09:23 PM |
| Are you talking about a tool that's welded to a character's arm? |
|
|
| Report Abuse |
|
|
LuaLlama
|
  |
| Joined: 25 Jan 2014 |
| Total Posts: 1123 |
|
|
| 20 Aug 2015 09:23 PM |
Organize it better..
your not using tab
EX:
function KILL(Player) if Player.Character then Player.Character.Humanoid.Health = 0 end end |
|
|
| Report Abuse |
|
|
AstroCode
|
  |
| Joined: 09 Oct 2009 |
| Total Posts: 1122 |
|
|
| 20 Aug 2015 09:28 PM |
@Shung, it's a module
@Lua I typed that in the forum, that's not copied from my script. Plus, tabbing doesn't make code more efficient, it just makes it more readable.
|
|
|
| Report Abuse |
|
|
ShungTzu
|
  |
| Joined: 14 Jun 2014 |
| Total Posts: 959 |
|
|
| 20 Aug 2015 09:31 PM |
| Why are you trying to use a RemoteEvent to move a tool? |
|
|
| Report Abuse |
|
|
|
| 20 Aug 2015 09:32 PM |
| He's not, this is a filtering enabled building tool |
|
|
| Report Abuse |
|
|
ShungTzu
|
  |
| Joined: 14 Jun 2014 |
| Total Posts: 959 |
|
|
| 20 Aug 2015 09:36 PM |
| Whatever. You don't need to be firing a RE every time a part moves. |
|
|
| Report Abuse |
|
|
AstroCode
|
  |
| Joined: 09 Oct 2009 |
| Total Posts: 1122 |
|
|
| 20 Aug 2015 09:37 PM |
How so?
When I move the part on the client, I need it to be moved on the server, too. To do this, I have to fire an event to communicate with the server. |
|
|
| Report Abuse |
|
|
|
| 20 Aug 2015 09:42 PM |
bruh, Phantom Forces uses Filtering.. so its your efficiency thats the problem :\
while true do the do |
|
|
| Report Abuse |
|
|
ShungTzu
|
  |
| Joined: 14 Jun 2014 |
| Total Posts: 959 |
|
|
| 20 Aug 2015 09:46 PM |
| I'm guessing the movement is prior to the placing of a part. Fire the server when you place it, with enough info to create and place the part. |
|
|
| Report Abuse |
|
|
AstroCode
|
  |
| Joined: 09 Oct 2009 |
| Total Posts: 1122 |
|
|
| 20 Aug 2015 09:47 PM |
| @morash Any tips for making things more efficient? |
|
|
| Report Abuse |
|
|
|
| 20 Aug 2015 09:50 PM |
| I take it your game has many things in it? |
|
|
| Report Abuse |
|
|
AstroCode
|
  |
| Joined: 09 Oct 2009 |
| Total Posts: 1122 |
|
|
| 20 Aug 2015 09:52 PM |
| What's that supposed to mean? |
|
|
| Report Abuse |
|
|
|
| 20 Aug 2015 09:55 PM |
| Is your game laggy already? |
|
|
| Report Abuse |
|
|
ShungTzu
|
  |
| Joined: 14 Jun 2014 |
| Total Posts: 959 |
|
|
| 20 Aug 2015 09:57 PM |
| Also, if your placing tool moves the part on a grid, you could, if you insist, fire the server every time the part moves, but my guess is that you're doing it every time the mouse moves, something you just won't be able to get away with. |
|
|
| Report Abuse |
|
|
AstroCode
|
  |
| Joined: 09 Oct 2009 |
| Total Posts: 1122 |
|
|
| 20 Aug 2015 10:12 PM |
@CLIM
No
@Shung
What alternative do you propose? |
|
|
| Report Abuse |
|
|
|
| 20 Aug 2015 10:20 PM |
Yes, there is a zero lag method. Simply connect your computer to the same network as the server. But you can't do that because the server is too far away, and it would take time to travel there. Data has to travel across the Internet as well, it can't just arrive instantly.
There are two things you can do to try to reduce the perception of lag: 1. Move the brick client side as well as server-side. 2. Make the brick local to the client that is placing it(this is assuming that nobody needs to see what another person is building). |
|
|
| Report Abuse |
|
|
ShungTzu
|
  |
| Joined: 14 Jun 2014 |
| Total Posts: 959 |
|
|
| 20 Aug 2015 10:23 PM |
| Fire the server when you place the part, with enough arguments for the server to create and place the part(eg, Size, Position, Rotation, BrickColor, Transparency, Surfaces,..), or, if there is a fixed number of parts the tool will place, keep a table of them on both ends and just communicate which part, its Position, and its Rotation(or CFrame(but a CFrame is bigger than those two)). |
|
|
| Report Abuse |
|
|
AstroCode
|
  |
| Joined: 09 Oct 2009 |
| Total Posts: 1122 |
|
|
| 20 Aug 2015 10:25 PM |
@Forever
1. Parts do move both on the client and server 2. This is a multi-player building game. |
|
|
| Report Abuse |
|
|
|
| 20 Aug 2015 10:25 PM |
^ I don't see how that is at all relevant to the question. |
|
|
| Report Abuse |
|
|
|
| 20 Aug 2015 10:25 PM |
@AstroCode If they moved on the client(in a localscript) you wouldn't notice that lag assuming you're doing it correctly. |
|
|
| Report Abuse |
|
|