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
 

Game is slowly "bleeding out" rendering speed?

Previous Thread :: Next Thread 
SonyController is not online. SonyController
Joined: 10 Jan 2011
Total Posts: 176
18 Dec 2015 10:58 PM
I'm making a tower defense. I have the projectile delete when it either hits the target or exists for longer than 1.5 seconds. However, even though the projectiles are definitely deleting, I am finding that my rendering fps drops dramatically. I have opened script performance, but everything looks fine. Once my rendering fps gets really low, I get the following in diagnostics:

FPS: 2.4/s
Physics: 59.4/s
Render: 2.4/s (Highlighted Red)

----- Rendering -----
Video Memory 268MB
FRM Auto Quality ?
FRM Quality 0
FRM Visible 94
Particles 0
Scheduler Render 2.4/s
Present time 0.724
Draw (total) 35
Draw (scene) 18
Draw (shadow) 0
Draw (UI) 7
Draw (3D Adoms) 10

I have literally no idea what in the above menu is the cause of my rapidly deteriorating render performance. Does any of this stand out to you guys?
Report Abuse
cntkillme123 is not online. cntkillme123
Joined: 10 Feb 2013
Total Posts: 539
18 Dec 2015 11:01 PM
Probably a memory leak or something
Report Abuse
DrHaximus is not online. DrHaximus
Joined: 22 Nov 2011
Total Posts: 8410
18 Dec 2015 11:02 PM
does the memory or CPU usage gradually hike?
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
18 Dec 2015 11:06 PM
If it is a memory leak, try using local variables instead of global, and use Part:Destroy() instead of Part:remove().
Report Abuse
SonyController is not online. SonyController
Joined: 10 Jan 2011
Total Posts: 176
18 Dec 2015 11:08 PM
Okay, I will try to convert to local, but I used local just out of habit for like 70% of them... This has caused my studio to crash though. I am using Part:Destroy()...
Report Abuse
DrHaximus is not online. DrHaximus
Joined: 22 Nov 2011
Total Posts: 8410
18 Dec 2015 11:09 PM
post the code!
Report Abuse
Alkan is not online. Alkan
Joined: 04 Dec 2008
Total Posts: 907
18 Dec 2015 11:09 PM
How is the thread counter under diagnostics? If you disable all scripts and re-enable, does the lag remain?
Report Abuse
cntkillme123 is not online. cntkillme123
Joined: 10 Feb 2013
Total Posts: 539
18 Dec 2015 11:10 PM
I highly doubt it has anything to do with global variables. It's not like he's creating them randomly with random names./
Report Abuse
SonyController is not online. SonyController
Joined: 10 Jan 2011
Total Posts: 176
18 Dec 2015 11:15 PM
It seems like my projectiles are causing the lag; I am using parts, not rayCast or anything. If they are destroyed because they came in contact with the 'enemy' then it seems to be fine. If it is destroyed due to not hitting anything for a few seconds, it causes lag. I had a script in game.Workspace (that I deleted in attempting to fix this haha,) that checked the name of a part when it was added to workspace. If it;s name was projectile, it waited 2 seconds, they Destroyed. I deleted that, and put the following code in lighting:

wait(1.5)
script.Parent:Destroy()

(It was disabled.)

I cloned it, put it in the projectile, and enabled it, but I still had the same issue. After testing again, my Mac reported that ROBLOX was using 105% of the CPU, lol... I would post the code, but there's like 6 different scripts in play here.
Report Abuse
SonyController is not online. SonyController
Joined: 10 Jan 2011
Total Posts: 176
18 Dec 2015 11:17 PM
@Alkan no, but that's probably because I think it's the projectiles that are causing the lag. With the script that creates them being disabled, it lags out...
Report Abuse
SonyController is not online. SonyController
Joined: 10 Jan 2011
Total Posts: 176
18 Dec 2015 11:18 PM
Really appreciate how fast the response has been, especially from some fairly experienced scripters! :D
Report Abuse
cntkillme123 is not online. cntkillme123
Joined: 10 Feb 2013
Total Posts: 539
18 Dec 2015 11:19 PM
Why not just do
game.Debris:AddItem(bullet, 2)

in the script that creates the projectiles?
Report Abuse
DrHaximus is not online. DrHaximus
Joined: 22 Nov 2011
Total Posts: 8410
18 Dec 2015 11:19 PM
how many parts are we talking about?
how many per second?

the only thing I can think of is that you might be applying this in a pretty grand scale, running lots of different scripts is probably less efficient than running the same event script (onTouch for the enemies).
Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
18 Dec 2015 11:20 PM
How is the projectile movement handled?
Report Abuse
SonyController is not online. SonyController
Joined: 10 Jan 2011
Total Posts: 176
18 Dec 2015 11:22 PM
TBH I have never even heard of the Debris class ^.^ Here's the code for the creation of the projectile itself...
(Keep in mind this is the first game I have ever created... C:

local enemy = game.Workspace.Enemy

local barrel1 = script.Parent.TowerHead.Barrel1
local barrel2 = script.Parent.TowerHead.Barrel2
local barrel3 = script.Parent.TowerHead.Barrel3
local barrel4 = script.Parent.TowerHead.Barrel4
local barrel5 = script.Parent.TowerHead.Barrel5
local barrel6 = script.Parent.TowerHead.Barrel6

local lastBarrel = 6

while wait(script.Parent.ReloadTime.Value) do
local missile = Instance.new("Part")
missile.Name = "Missile"
missile.Parent = game.Workspace
missile.Rotation = barrel1.Rotation
missile.FormFactor = "Custom"
missile.Size = Vector3.new(1, 1, 4)
missile.Shape = "Block"
missile.BrickColor = BrickColor.new("Really red")
missile.Position = script.Parent.TowerBase.Position
missile.CanCollide = false

local missileForce = Instance.new("RocketPropulsion")
missileForce.Name = "missileForce"
missileForce.Parent = missile
missileForce.Target = enemy
missileForce.CartoonFactor = 0.95
missileForce.MaxSpeed = 100

local missileDamage = Instance.new("NumberValue")
missileDamage.Name = "Damage"
missileDamage.Parent = missile
missileDamage.Value = script.Parent.Damage.Value

local missileDel = game.Lighting.MissileDelete:Clone()
missileDel.Parent = missile
missileDel.Disabled = false

if lastBarrel == 1 then
missile.Position = barrel2.Position
lastBarrel = 2
elseif lastBarrel == 2 then
missile.Position = barrel3.Position
lastBarrel = 3
elseif lastBarrel == 3 then
missile.Position = barrel4.Position
lastBarrel = 4
elseif lastBarrel == 4 then
missile.Position = barrel5.Position
lastBarrel = 5
elseif lastBarrel == 5 then
missile.Position = barrel6.Position
lastBarrel = 6
elseif lastBarrel == 6 then
missile.Position = barrel1.Position
lastBarrel = 1
end

missileForce:fire()
end
Report Abuse
SonyController is not online. SonyController
Joined: 10 Jan 2011
Total Posts: 176
18 Dec 2015 11:23 PM
On a side note, I guess I should mention that the missile fires out of the barrels in the opposite order of what I was hoping for (hah), but I was going to go back and review that later. I guess I could just clone the missile, yeah?
Report Abuse
SonyController is not online. SonyController
Joined: 10 Jan 2011
Total Posts: 176
18 Dec 2015 11:25 PM
Man, also noticed I'm assigning the missile twice in that. Man, how obvious the errors are AFTER you post them on the forums. ^.^
Report Abuse
SonyController is not online. SonyController
Joined: 10 Jan 2011
Total Posts: 176
18 Dec 2015 11:48 PM
So, if it IS a memory leak, what are the possible causes? I am using local variables, as well as the Destroy()...
Report Abuse
Alkan is not online. Alkan
Joined: 04 Dec 2008
Total Posts: 907
18 Dec 2015 11:57 PM
I can't spot the problem, but welcome to scripting. Try debugging everything. Remove Rocket Propulsion and see how the game plays after x amount of time. Remove stuff until the lag stops and you'll have your problem causer.
Report Abuse
SonyController is not online. SonyController
Joined: 10 Jan 2011
Total Posts: 176
18 Dec 2015 11:59 PM
Well, thanks for trying anyways, Alkan. I tried using a different turret w/o rocketPropulsion, but it has the same issue (although at a much slower rate...) This is really making me mad haha.
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