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 » Scripters
Home Search
 

Re: Flatline115's The More You Know.

Previous Thread :: Next Thread 
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
23 Jul 2015 06:04 PM
A topic dedicated to giving you information that you may not know.. w/e. I'll update this every now and then.

- Animations will always be choppy when done through remote events. However you can give each client instructions to run it at 60 frames a second.

- All pathinfinding methods present problems (even if running the fabled D*..) so you're better off creating a nav-mesh like script to handle it for you in the most realistic way possible.

- You can run a loop faster than "while" through exploiting Int-Values and "Spawn".

- There's no empirical difference between using anonymous functions and procedural coding. It's all a matter of taste.

- There's no difference in code execution-time if using a semi-colon or not (despite popular belief).

- 'next' and 'pairs' present no empirical difference and are copycat functions.
Report Abuse
BothAngles is not online. BothAngles
Joined: 01 Dec 2011
Total Posts: 9604
23 Jul 2015 06:20 PM
- You can run a loop faster than "while" through exploiting Int-Values and "Spawn".
Is the performance increase similar to next vs pairs?
Probably won't be used enough to make a difference anyway
Report Abuse
BothAngles is not online. BothAngles
Joined: 01 Dec 2011
Total Posts: 9604
23 Jul 2015 06:21 PM
Nice thread btw. The first one is really useful and also applies to a lot of other stuff
Report Abuse
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
23 Jul 2015 06:55 PM
Much faster; about twice as fast. Example code:
local b = Instance.new("IntValue", Workspace)
local looped = 0;
local stamp = tick();
local loop = function(times, f)
if not(looped == times) then
b.Value = b.Value + 1;
looped = looped + 1;
else
print(tick()-stamp);
end;
end;
b.Changed:connect(function()
spawn(function() loop(100) end);
end);
b.Value = b.Value + 1;
x = 100;

stamp2 = tick();
while wait() do
if x > 0 then
x = x - 1;
else
print(tick()-stamp2)
break;
end;
end;

Results:
0.3152711391449 (Spawn Loop)
4.2935144901276 (While Loop)
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
23 Jul 2015 07:01 PM
thats like 12 times faster O-O
Report Abuse
BothAngles is not online. BothAngles
Joined: 01 Dec 2011
Total Posts: 9604
23 Jul 2015 07:01 PM
while wait() do
I think you meant while true do

I'm also suprised this doesn't cause an endless loop
b.Value = b.Value + 1;
and
b.Changed:connect(function()
Report Abuse
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
23 Jul 2015 07:02 PM
I didn't because you risk crashes when doing while loops without yielding.
Report Abuse
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
23 Jul 2015 07:03 PM
Also that's because within the loop function, I included an 'else' to get out of it. Outside of the loop function I only declared that once.
Report Abuse
BothAngles is not online. BothAngles
Joined: 01 Dec 2011
Total Posts: 9604
23 Jul 2015 07:04 PM
You have a break
If you added a wait() in the loop function, they would probably take about the same time
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
23 Jul 2015 07:06 PM
I can't believe people still yield in the condition
Report Abuse
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
23 Jul 2015 07:06 PM
Nope.
Without the wait:
7.62939453125e-006 (while loop)
0.30729103088379 (Spawn function)
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
23 Jul 2015 07:08 PM
You know that e-7 means it's much smaller than the spawn right?
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
23 Jul 2015 07:11 PM
I have something to add.

Roblox's C-side functions and metamethod boundaries will flip out if you pass them a newproxy userdata when they're expecting a Roblox datatype.
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
23 Jul 2015 07:13 PM
"Roblox's C-side functions and metamethod boundaries will flip out if you pass them a newproxy userdata when they're expecting a Roblox datatype."
You're really enjoying this aren't you?

btw does anyone else think it's pretty ridiculous to put semi-colons on ends
Report Abuse
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
23 Jul 2015 07:15 PM
mm
7.62939453125 * (10 ^ -0.06) = 6.6449248501288
Unless I've my math wrong.
Report Abuse
mario55j is not online. mario55j
Joined: 13 Aug 2012
Total Posts: 143
23 Jul 2015 07:16 PM
Could you please tell me how to make the gui go left and up? like

(Play is the name of the gui)

Play.Position = Play.Position +UDim2.new(0.05,0,0,0) is go right and

Play.Position = Play.Position +UDim2.new(0,0,0.05,0) is to go down


please tell me how to make it go up and down

Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
23 Jul 2015 07:17 PM
I am really enjoying it I think it's great fun that the Roblox programming engineers were silly enough to introduce a bug like that.

Also I think putting semicolons on ends is not unreasonable except for with some ends
Report Abuse
theninjaguy987 is not online. theninjaguy987
Joined: 21 Jun 2013
Total Posts: 766
23 Jul 2015 07:18 PM
Mario just make the numbers negative
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
23 Jul 2015 07:18 PM
@TheHoIyOne
only a lua skid would think that's fine

@flatline115
except that actually represents
7.62939453125 * (10 ^ -6)
Report Abuse
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
23 Jul 2015 07:20 PM
My apologies I had it wrong then. The benefit of the Spawn loop is that you don't have to yield however, thus making it de-facto faster.
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
23 Jul 2015 07:21 PM
And a semicolon should indicate the end of a statement, as it does in languages that require them. I have no problem with semicolons with Lua, but it seems like too many people on here throw them around needlessly.
Report Abuse
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
23 Jul 2015 07:22 PM
The reason I threw that in there was that many people proclaim it affects the time of code execution. Even people who should know better (like Roblox Dev Members) when it doesn't.
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
23 Jul 2015 07:22 PM
There will be some, and multi-threading can't make up for the vast difference.
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
23 Jul 2015 07:23 PM
"like Roblox Dev Members"

"How to get into RbxDev:
pay someone to make you an obby"
-BothAngles
Report Abuse
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
23 Jul 2015 07:25 PM
"Even people that SHOULD"
Emphasis on should.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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