One of the biggest differences between this game and others is how it loads and saves levels. The game is played on a single level, so updates to code and graphics are really easy to do. When the player walks off the side of the screen, it remembers his X and Y position, as well as which level he has moved to. It then clears the screen and loads up all of the objects within in the next level from an array.
As well as making it easy to change the code and stuff, this allows the levels to be TOTALLY destructible. In fact, up until 1.36 the walls could be blown up, but I removed them and redid them because I got a BAD OBJECT for them, and because they were made using a very slow process of rendering, which I'll explain below.
SLOW PROCESS
All objects have an invisible base object, which stores all of the information about the object. Every 00:01 seconds, and the object is close enough to the player, it creates a picture of itself and a shadow of itself. Every 00:01 add 1 to calue B of the picture and shadow, when Value B is greater than 2, destroy.
PROBLEM: It slows down the computer when there are too many objects on screen. However, it is still the way that moving objects are drawn, because the fast process doesn't work with them.
FAST PROCESS
As soon as objects are close enough to be viewed, create a shadow and picture. If they're too far away to be seen, destroy again.
PROBLEM: Can't update damage models, can't be used with moving objects.
NEW EXPERIMENTAL METHOD
Same as the fast Process, only every time the object moves / is damaged, it creates an object that deletes the current picture and shadow and replaces it with a new one.
PROBLEM: Can't update objects which are in the air because they won't be touching the base object... though I could create the updater thing at the correct height to tag the picture of the objects and hope that it works, but it probably won't because it'll get confused with objects of the same type that are just lying around further up screen.
It sounds horribly complicated, but when you've got huge play area with thousands of objects, it will KILL the computer unless you optimize it as much as possible. So far I'm pleased with what I've done, though for the destruction update I really will have to find a new way of drawing the objects.
|