generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Game Design
Home Search
 

Re: Moving 100 objects while wait() do without lag

Previous Thread :: Next Thread 
TheCoderOfLua is not online. TheCoderOfLua
Joined: 12 Apr 2016
Total Posts: 1599
16 Jul 2016 02:16 AM
Yes how would this be done because right now it lags the server the crap.
Thanks :P

Current method:


while wait() do
for i,a in pairs(bleh:GetChildren()) do
a.CFrame = pos
end
end
Report Abuse
cfiredog is not online. cfiredog
Joined: 30 May 2008
Total Posts: 228
16 Jul 2016 02:17 AM
I would suggest trying to use :MoveTo in order to move the bricks.
http://wiki.roblox.com/index.php?title=API:Class/Model/MoveTo
Report Abuse
TheCoderOfLua is not online. TheCoderOfLua
Joined: 12 Apr 2016
Total Posts: 1599
16 Jul 2016 02:27 AM
oh hey,


The bricks move seperately using a complicated iterating system, so moving the whole model wouldnt help.
Report Abuse
cfiredog is not online. cfiredog
Joined: 30 May 2008
Total Posts: 228
16 Jul 2016 02:28 AM
Oh, so you are trying to move each part separately at different time periods?
Report Abuse
TheCoderOfLua is not online. TheCoderOfLua
Joined: 12 Apr 2016
Total Posts: 1599
16 Jul 2016 02:29 AM
Exactly.
Report Abuse
pidgey is not online. pidgey
Joined: 16 Jan 2008
Total Posts: 2739
16 Jul 2016 02:30 AM
WHY ARE YOU MAKING A LOOP TO KEEP PUTTING A BUNCH OF OBJECTS IN THE SAME PLACE


pidgey is my name sh##posting is my game
Report Abuse
TheCoderOfLua is not online. TheCoderOfLua
Joined: 12 Apr 2016
Total Posts: 1599
16 Jul 2016 02:31 AM
Well my code is complex but it is differnet.
Report Abuse
pidgey is not online. pidgey
Joined: 16 Jan 2008
Total Posts: 2739
16 Jul 2016 02:32 AM
tell me why you're doing it and i might be able to help?????


pidgey is my name sh##posting is my game
Report Abuse
cfiredog is not online. cfiredog
Joined: 30 May 2008
Total Posts: 228
16 Jul 2016 02:33 AM
Then I would use this method:

for _,v in pairs(game.Selection:Get()) do
v.CFrame = v.CFrame * CFrame.new(0, 0, 0)
end


via ROBLOX Wiki: http://wiki.roblox.com/index.php?title=CFrame
Report Abuse
TheCoderOfLua is not online. TheCoderOfLua
Joined: 12 Apr 2016
Total Posts: 1599
16 Jul 2016 02:35 AM
well.


There is a main part, which goes in the lookVector of itself, which can be changed with the arrow keys.




Now, theres 100 parts behind following it, with a delay as it goes further down.

So how would I make this not as laggy :P

Report Abuse
pidgey is not online. pidgey
Joined: 16 Jan 2008
Total Posts: 2739
16 Jul 2016 02:38 AM
one at a time, not all at a time like the script you posted

make a wait time in the pairs function and in the wait function

but if you're trying to move tons of parts at once like that it will lag a lot more no matter what


pidgey is my name sh##posting is my game
Report Abuse
pidgey is not online. pidgey
Joined: 16 Jan 2008
Total Posts: 2739
16 Jul 2016 02:39 AM
yeah i cant help but ill take that +1 post


pidgey is my name sh##posting is my game
Report Abuse
dearjournal is not online. dearjournal
Joined: 04 Nov 2012
Total Posts: 2289
16 Jul 2016 02:44 AM
use RunService functions.

i would never use wait() for what it sounds like you're doing.

describe what your goal is, in a little more detail, and we will try to come up with an efficient solution.
Report Abuse
dearjournal is not online. dearjournal
Joined: 04 Nov 2012
Total Posts: 2289
16 Jul 2016 02:47 AM
"make a wait time in the pairs function and in the wait function"


i don't know about roblox lua, but in the "normal" implementation of lua, you wouldn't want to use wait() like that. calling wait() for every object adds a lot of overhead in the backend i think because of C lua_yield and lua_resume functions being called. doing that would increase lag i am guessing.

just go over all of them at once.
Report Abuse
TheCoderOfLua is not online. TheCoderOfLua
Joined: 12 Apr 2016
Total Posts: 1599
16 Jul 2016 02:48 AM
Thanks dearjournal.

Right now, (sry I forgot) Im using game:GetService("RunService").Heartbeat:wait()



Anyways, I'm making a 3d slither.io game. I used to have local movement and it worked fine, but when other plays moved around it only worked like 5fps for them.

So i decided to make it server side.

That means the server code is loading with remote events telling it what to do, maybe 5 models, with 20 parts inside each.

I cant use bodyforces since the little balls that make it up are anchored (for a reason)

Anyways should I make it generate a script for each model so one script isnt overloaded?

Tell me if i need to explain
Report Abuse
TheCoderOfLua is not online. TheCoderOfLua
Joined: 12 Apr 2016
Total Posts: 1599
16 Jul 2016 02:59 AM
aaaaaaaaaaaaaa
Report Abuse
dearjournal is not online. dearjournal
Joined: 04 Nov 2012
Total Posts: 2289
16 Jul 2016 02:59 AM
you shouldn't have to worry about a script being overloaded. it'd be more for design principles and readability, but each script body is essentially just an alias for a coroutine function anyways. doesn't matter if all your game is running from one server script and one local script, or 1,000.

i would definitely go back and try to re-implement it with FE. send only vital info to the server like what direction the player is choosing to go in.

some vital questions to ask:

-if you're using RemoteFunctions, are you sending entire Instances as arguments, or just vital information like a Vector3 telling where to move to next, etc.

I'm not too sure what your scripts setup is so I can't give you specific advice, sorry.

" server code is loading with remote events telling it what to do, maybe 5 models, with 20 parts inside each."

are you passing these Model Instances and Part Instances as arguments in a looped wait() function? this might be the cause of the lag and I would suggest doing a redesign based on sending only user input to the server.

there will be a delay but you can compensate by moving the players snake on the client with a localscript while you wait for the server to send back feedback on the users movement input.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Game Design
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image