AxFx
|
  |
| Joined: 14 Aug 2009 |
| Total Posts: 518 |
|
|
| 26 Jan 2016 06:12 PM |
I'm working on a full fledged racing game, and so far have 18 remote events and 5 remote functions. Is that bad?
I was wondering if there was a way I could combine these events somehow, some of them go to the same GUI's.
Any help/recommendations is appreciated.
|
|
|
| Report Abuse |
|
|
Aethex
|
  |
| Joined: 16 Oct 2011 |
| Total Posts: 2193 |
|
|
| 26 Jan 2016 06:16 PM |
there's probably a way to combine them, but you've given us no information on the different events/functions you have making it near impossible to help you
there's also a chance combining them makes your code too messy or unorganized depending on what you're trying to do |
|
|
| Report Abuse |
|
|
AxFx
|
  |
| Joined: 14 Aug 2009 |
| Total Posts: 518 |
|
|
| 26 Jan 2016 06:42 PM |
Yea.. I was expecting an answer like that.
I was thinking maybe you could forward a tag for the event or function to do a different thing, for example adjusting the visibility of different GUI pieces.
If I have this many events, will lag start to become an issue? None of them are being constantly activated, only once upon pressing a button or having a script issue another.
I'd imagine the "listening" function of 18 events might start to cause a lag related problem. Maybe I'm wrong?
|
|
|
| Report Abuse |
|
|
Aethex
|
  |
| Joined: 16 Oct 2011 |
| Total Posts: 2193 |
|
|
| 26 Jan 2016 06:46 PM |
| You could add extra parameters to your event/function that changes what it does, but it shouldn't cause any lag. It's also not like it's a while loop constantly checking for an event to fire, think of it as code that's inactive and only turns on or becomes noticeable once invoked or fired. |
|
|
| Report Abuse |
|
|
AxFx
|
  |
| Joined: 14 Aug 2009 |
| Total Posts: 518 |
|
|
| 26 Jan 2016 07:01 PM |
So it would be normal to have a high count of remote events for a game with a lot of function and complexity? I know optimization is part of that, but you can only go so far with optimizing without compromise of functions.
For example, I've got two buttons. One says Ready, the other says Not Ready. Each one has their own events that they fire, and their functions are obvious due to their names. Can't really do much there can I...
|
|
|
| Report Abuse |
|
|
Aethex
|
  |
| Joined: 16 Oct 2011 |
| Total Posts: 2193 |
|
|
| 26 Jan 2016 07:52 PM |
| That could easily be merged into one event by using a variable to declare which type it is. |
|
|
| Report Abuse |
|
|
AxFx
|
  |
| Joined: 14 Aug 2009 |
| Total Posts: 518 |
|
| |
|
Aethex
|
  |
| Joined: 16 Oct 2011 |
| Total Posts: 2193 |
|
|
| 26 Jan 2016 08:33 PM |
-- on client event:FireServer(btnType); -- btnType being a bool of whether it's ready or not
-- on server event.OnServerEvent:connect(function(player, btnType)
if btnType == "ready" then
print("ran code for btnType 'ready'");
else
print("ran code for btnType 'not ready'");
end
end) |
|
|
| Report Abuse |
|
|
AxFx
|
  |
| Joined: 14 Aug 2009 |
| Total Posts: 518 |
|
|
| 26 Jan 2016 08:56 PM |
Yea that's basically what I was asking for in my second post, if something like that were possible.
Thanks a bunch, that will help me a lot.
|
|
|
| Report Abuse |
|
|