[solved] Particle System freezing
Posted: Sun Mar 11, 2012 11:09 am
I've been fiddling with particles systems to try to make a "water-spray" effect, but I've run into a problem.
The particle system I am using seems to freeze up momentarily every few seconds - I don't know whether it freezes the whole game or not, but I'm assuming that to be the case. EDIT: It seems to stop rendering, and the particle emitter stops emitting, but when it unfreezes, the particles that have already been emitted had continued moving - which seems to suggest that it's updating particles that have been emitted, but not emitting any new ones. The window still shows the last rendered frame, not blankness.
If people could please see if they get the same problem, and whether they know what could cause it, it would be very useful.
The code from my main.lua file:
The love file:
If it has something to do with my computer's abilities to handle the (not all that large) number of particles in use, my specs are:
CPU: AMD Athlon II X2 245 2.9Ghz
RAM: 2Gbs DDR2-800
Graphics: ATI Radeon HD 4670
The particle system I am using seems to freeze up momentarily every few seconds - I don't know whether it freezes the whole game or not, but I'm assuming that to be the case. EDIT: It seems to stop rendering, and the particle emitter stops emitting, but when it unfreezes, the particles that have already been emitted had continued moving - which seems to suggest that it's updating particles that have been emitted, but not emitting any new ones. The window still shows the last rendered frame, not blankness.
If people could please see if they get the same problem, and whether they know what could cause it, it would be very useful.
The code from my main.lua file:
Code: Select all
function love.load()
drp = love.graphics.newImage("droplet.png")
sys = love.graphics.newParticleSystem(drp,1000)
sys:setPosition(400,300)
sys:setGravity(100,150)
sys:setSpread(math.rad(30))
sys:setEmissionRate(100) --this may be causing problems, try increasing it if you don't get the wierd freezing
sys:setLifetime(-1)
sys:setParticleLife(4,5) --this too
sys:setSpeed(200,300)
sys:start()
end
function love.update(dt)
sys:setSize(math.random())
sys:setRotation(math.random())
sys:setDirection(math.atan2(love.mouse.getY()-300,love.mouse.getX()-400))
sys:update(dt)
end
function love.draw()
love.graphics.draw(sys)
end
CPU: AMD Athlon II X2 245 2.9Ghz
RAM: 2Gbs DDR2-800
Graphics: ATI Radeon HD 4670