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: Maximum repetitions without crashing

Previous Thread :: Next Thread 
darthpyro is not online. darthpyro
Joined: 18 Aug 2009
Total Posts: 3569
27 Feb 2016 08:18 AM
Is there a maximum amount of repetitions (without waits) before crashes occur? Is there a general guideline or a way to calculate said number?

e.g.

for i = 1, math.ceil(factor / 30) do
position = position + (velocity / factor)
velocity = velocity + Vector3.new(0, gravity / factor, 0)

local hit, hitPosition = game.Workspace:FindPartOnRayWithIgnoreList(Ray.new(position, velocity / factor), ignoreList)

if funct then
funct(hitPosition, position)
end

if hit then
return hit, hitPosition
end
end

wait()


This can cause crashes, but I would prefer not to wait every time I run the loop.
Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
27 Feb 2016 08:25 AM
That will never cause a crash.


while true do end

Doesn't cause a crash.


Report Abuse
HumanXerxes is not online. HumanXerxes
Joined: 17 Apr 2011
Total Posts: 1351
27 Feb 2016 08:27 AM
I'm not sure, it could depend on what is being looped. If you really want to know, perhaps guess and test?...

I'm not sure why you would want to though. What are you trying to accomplish?
Report Abuse
darthpyro is not online. darthpyro
Joined: 18 Aug 2009
Total Posts: 3569
27 Feb 2016 08:28 AM
I'm performing raycasting and calling passed functions hundreds or thousands of times a second. This causes ROBLOX to crash.

If you don't think this is the issue, I would welcome you to find the issue:
http://www.roblox.com/games/33516870/Gravity-Raycasting
Report Abuse
HumanXerxes is not online. HumanXerxes
Joined: 17 Apr 2011
Total Posts: 1351
27 Feb 2016 08:38 AM
So you are trying to finish the loop all in the same instant?
Report Abuse
darthpyro is not online. darthpyro
Joined: 18 Aug 2009
Total Posts: 3569
27 Feb 2016 08:42 AM
This script simulates raycasting with a gravity force acting upon it. As it stands, it seems casting a ray is a intensive enought that you can see animation in a part following the ray if you cast the ray multiple times between waiting. However, doing this for too long without waiting will cause ROBLOX to crash.

I'm not really sure how to improve the performance of this, short of scrapping the inner for loop and just letting the ray be inaccurate.
Report Abuse
darthpyro is not online. darthpyro
Joined: 18 Aug 2009
Total Posts: 3569
27 Feb 2016 09:01 AM
Is there some way to find the source of a crash?
Report Abuse
darthpyro is not online. darthpyro
Joined: 18 Aug 2009
Total Posts: 3569
27 Feb 2016 09:11 AM
I have concluded that the issue is drawing the tracers at the locations of the rays. Is this an inherent problem with creating tons of parts, or is there a way to make this more efficient?

Right now I'm calling this:

module.visualizeRay = function(startPoint, endPoint)
local dist = (endPoint - startPoint).magnitude
local brick = Instance.new("Part", game.Workspace)
brick.Anchored = true
brick.CanCollide = false
brick.Size = Vector3.new(0.2, 0.2, dist)
brick.CFrame = CFrame.new(startPoint, endPoint) * CFrame.new(0, 0, dist)
brick.Parent = module.getContainer()
return brick
end
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