Still got all your tools handy? Good, cause we'll be continuing our look under the hood of our favorite space shooter.
There are a fair few problems one can run into with physics and collision detection in games. Among the more prominent ones are performance issues. Having to calculate every aspect of games world-rules can put quite a strain on a computer and naturally, we want as many people as possible to be able to play our game, not just those with high end monster-pcs.
When it comes to collision-detection, there is a "brute force" method that can work for simple games: As long as there are few objects in the game world, it is possible to simply check every object against every other object. It's simple and it works. However, as the number of objects increases, the number of necessary computations rises exponentially. Every object added needs to be checked against every single existing object in the world. This could soon lead to performance problems if not addressed.
In order for the computer to not have to focus on everything at once, we handle this by using a construct known as spatial partitioning. Similar to a chessboard in design, the game world is simply split up into discrete boxes which can be used to simplify collision detection.
Objects are allocated into these boxes according to their position. Rather than focusing on each object at the same time, the system can first calculate which boxes are affected by a certain action and consequently limit its focus to the objects within them. For example: When objects are checked for their collision parameters, the physics engine only needs to check the boxes with which the current object could collide.
Asteroid to e4!
This system allows us to calculate all the awesome physics we want, without bogging down performance and killing your PC. But you don't have to take our word for it. Check out this demonstration:
But Crunchy Leaf wouldn't be Crunchy Leaf if we didn't try to do some weird and awesome stuff with our new found freedom.
Crushing Ice
Playing around with the physics system led to this experimental gravity gun that allows grabbing and shooting objects. It does feel quite fun and we are now working on how to fit it into the game's design.
We hope you enjoyed this look at the more technical aspects of Stars of Icarus. Let us know if you are interested in hearing more!
If you want to keep up to date, grab a hold of us on Facebook and Twitter.