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: What would be optimal here?

Previous Thread :: Next Thread 
1waffle1 is not online. 1waffle1
Joined: 16 Oct 2007
Total Posts: 16381
10 Dec 2012 08:27 PM
I need to store hundreds of CFrames. How should I go about this?
tables
parsing strings
something else?
Report Abuse
AbsoluteLOL is not online. AbsoluteLOL
Joined: 01 Dec 2012
Total Posts: 3939
10 Dec 2012 09:06 PM
Tables. Don't use table.insert, as it's apparently "slower."

~ I like pudding ◕‿◕ ~
Report Abuse
AbsoluteLOL is not online. AbsoluteLOL
Joined: 01 Dec 2012
Total Posts: 3939
10 Dec 2012 09:12 PM
Elaboration:
table.insert(tab, item) is a good 50% slower than:
tab[#] = item

Example:
local tab = { }
var = 0

for a = 1, 10 do
tab[var+1] = math.random()
var = var + 1
end

~ I like pudding ◕‿◕ ~
Report Abuse
1waffle1 is not online. 1waffle1
Joined: 16 Oct 2007
Total Posts: 16381
10 Dec 2012 10:30 PM
Yes, I know. I didn't ask about that.
Report Abuse
TeamDman is not online. TeamDman
Joined: 04 Dec 2009
Total Posts: 897
11 Dec 2012 06:25 AM
Is there a better way to do what your doing?
Don't need to fix a problem if you can avoid it with a better method.

§TeamDman§ Anti-Jared
Report Abuse
cygorx is not online. cygorx
Joined: 09 Nov 2012
Total Posts: 668
11 Dec 2012 07:33 AM
I recommend using a potato.
Potatoes are efficient, easy to store information in and easy to bake. Most simply, you write down your CFrame values, smack them into the potato, and hooray, you have stored information in your potato!
Report Abuse
RA2lover is not online. RA2lover
Joined: 09 Nov 2008
Total Posts: 1254
11 Dec 2012 08:09 AM
PotaDOS disagrees.
Report Abuse
1waffle1 is not online. 1waffle1
Joined: 16 Oct 2007
Total Posts: 16381
11 Dec 2012 09:23 AM
I bet storing all of the data locally would solve the problem. So then there's a new problem. How do I stop the local data from being erased every time your character loads?
Report Abuse
belial52 is not online. belial52
Joined: 10 Oct 2009
Total Posts: 8074
11 Dec 2012 09:36 AM
Use CFrameValues that are put in a model right inside the player object.
Report Abuse
1waffle1 is not online. 1waffle1
Joined: 16 Oct 2007
Total Posts: 16381
11 Dec 2012 09:41 AM
Objects inside the player are replicated to other players. That wouldn't help at all. If anything, that would lag exponentially more than it does now.
Report Abuse
RA2lover is not online. RA2lover
Joined: 09 Nov 2008
Total Posts: 1254
11 Dec 2012 10:31 AM
store them on a localscript. if localscript sources replicate to all players, roblox is doing a stupid job.
Report Abuse
SCARFACIAL is not online. SCARFACIAL
Joined: 28 Jan 2010
Total Posts: 7970
11 Dec 2012 12:48 PM
"How do I stop the local data from being erased every time your character loads?"

_G

or script.Parent = nil -- Ugly hack
Report Abuse
1waffle1 is not online. 1waffle1
Joined: 16 Oct 2007
Total Posts: 16381
11 Dec 2012 03:16 PM
Is there a local _G? That would certainly work.
Report Abuse
belial52 is not online. belial52
Joined: 10 Oct 2009
Total Posts: 8074
11 Dec 2012 03:19 PM
Yes, there is a local _G.
Report Abuse
Anaminus is not online. Anaminus
Top 100 Poster
Joined: 29 Nov 2006
Total Posts: 5945
11 Dec 2012 03:23 PM
You're not already running it locally? The "lag" you're seeing is probably due to the rate at which parts are replicated, which is rather small, like 10 times per second. This doesn't mean you have to use local parts; they can be anywhere you need them to be. You just have to update them on the client so that the user sees the changes instantly.
Report Abuse
1waffle1 is not online. 1waffle1
Joined: 16 Oct 2007
Total Posts: 16381
11 Dec 2012 03:33 PM
The parts aren't slowing anything down. From what I've tested, I could have hundreds of parts out simultaneously being CFramed at 10 FPS and the server is no slower than it was before. But if I just stored all of the data locally, I could have those hundred parts running at twice the FPS because I wouldn't have to worry about storage slowing down the server.
Report Abuse
1waffle1 is not online. 1waffle1
Joined: 16 Oct 2007
Total Posts: 16381
11 Dec 2012 06:50 PM
When I tried switching it to a LocalScript after I finished making the system run from the player and not the game script, it didn't work, so I decided to just have a regular script instead of a local script. The script is put into the character, then is parented to nil after it has loaded. Is it client-sided?
Report Abuse
VisualCSharp is not online. VisualCSharp
Joined: 23 Nov 2012
Total Posts: 225
11 Dec 2012 07:38 PM
@1waffle1:
_G in localscripts doesn't replicate to server-side _Gs.
Report Abuse
VisualCSharp is not online. VisualCSharp
Joined: 23 Nov 2012
Total Posts: 225
11 Dec 2012 07:40 PM
Example:
LocalScript:
_G.Hi = "Hi"
Script:
print(_G.Hi)-->nil
LocalScript:
print(_G.Hi)-->Hi
Report Abuse
1waffle1 is not online. 1waffle1
Joined: 16 Oct 2007
Total Posts: 16381
11 Dec 2012 07:54 PM
I'm not using globals. I'm putting the script into the character, disabling, it sets its parent to nil and controls the player's client from there. But is the script running client-sided?
Report Abuse
VisualCSharp is not online. VisualCSharp
Joined: 23 Nov 2012
Total Posts: 225
11 Dec 2012 08:01 PM
@1waffle1:
As long as it's a localscript and follows one of these:
1. It is in a player's Backpack (can be indirectly, through a Tool or HopperBin)
2. it is in a player's character model
3. it is in a player's PlayerGui
Report Abuse
1waffle1 is not online. 1waffle1
Joined: 16 Oct 2007
Total Posts: 16381
11 Dec 2012 08:21 PM
It isn't a local script.
Report Abuse
VisualCSharp is not online. VisualCSharp
Joined: 23 Nov 2012
Total Posts: 225
12 Dec 2012 06:25 AM
Then it isn't client-side.
Report Abuse
Radioaktiivinen is not online. Radioaktiivinen
Joined: 25 Apr 2009
Total Posts: 18629
12 Dec 2012 07:32 AM
U shud decompose the cframes and store them as quaternion+position converted into an optimal string in a table k.
Report Abuse
HotThoth is not online. HotThoth
Forum Moderator
Joined: 24 Aug 2010
Total Posts: 1176
12 Dec 2012 12:52 PM
If you're talking storage space, then yes, Radiokitten has the right idea for saving lots of space (quaternions ftw).

However, it sounds like that isn't exactly the problem you're trying to solve, but rather one involving CFrame-setting or getting, perhaps for some sort of CFrame animation thingy? Doing things client-side would be the next logical thing to suggest for optimization, but you stated that this does not work. Without knowing the actual problem, I think it will be hard to give better advice than that...

- HotThoth

~ I Thoth so ~
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