Updating physics on object in

How else is something going to change each frame if it doesn't get updated?

It's strange that you worry about a couple of simple operations for each of a few thousand particles when 30 times a second your game will be calculating individual values for each of 2 million pixels.

It's not uncommon - when you animate a mesh, it has to loop through each vertex and update it's position.

Yes, a lot of this work can be shunted off to the GPU, but it's doing exactly the same thing.

Currently I just store everything as objects in various arrays and then during an update I will loop through all these arrays and their contents and call update on the objects. I only draw what is on screen but the objects still need to update off screen so I can't think of a way to lower the performance hit.

The loop isn't the problem, how the particles are stored is the problem.If you use a garbage collected language (like C# or Java) and store every single particle in one object, you are generating lots of unnecessary work for the garbage collector.When you use one object per particle, have quickly dying particles and simply use a new object for every new particle, memory use will skyrocket and garbage collection will bring your game to a halt.It really depends on the kind of game you're making and the number of objects you're talking about.Open world games are the masters of LOD, the entire world is sneakily being stripped away and regenerated behind your back as the player.

Leave a Reply