Updating physics on object in


21-Apr-2020 13:17

Unless you start hitting performance issues what you are doing is fine.In the event you need something else, quad trees are pretty common for breaking up things like collision detection.Generally, that is a more appropriate technique for Games than pure Object Orientation, and for particle systems it's a must. If all your objects need the same kind of updates there's no other way than to update each one individually.That unless you can find a way to share data between those object. Why do you have so many objects in the first place? I use a totally different approach with some games- I have a central 'task queue', and every single object adds an 'update me' task to that queue when it's created, specifying when it should happen.Other things can influence the queue- some objects can exist without an task on the queue, but an 'activate' action somewhere can prompt it to add one, or objects can remove themselves from the queue if they get destroyed.Because tasks are stored in a priority queue (prioritized on when they're due), the central game loop only ever needs to check which task's due next, it doesn't have to check a few thousand objects to determine if they need updating.This is called Data Oriented Design (as opposed to Object Oriented) and gives better run time because of improved data locality which improves cache performance.

I believe skyrims NPC/etc are motionless or not even spawned until you get within a certain distance of them.

Otherwise when the frame rate of the game changes, the speed of the objects will also change!