You cannot have thousands of instances, all with physical properties and collisions and expect everything to work fine due to the fact that physics requires some pretty intensive calculations, so limit yourself and optimise where possible. You should limit the number of instances that are created, as well as the number of collisions and collision groups that the physics world has to deal with.This takes a bit of getting used to, so experiment with the physics functions and get to know how everything works before trying to integrate them into your project. for example, rather than set a speed and a direction for an instance, if it has been declared as being a fully simulated physical body, you would use a force or impulse to get it to move around in the game world, or if it is not physics enabled you will need to set the x an y positions yourself. The physics system replaces many of the normal instance functions.The physics system exists "apart" from the basic room and instance structure of GameMaker meaning that its timings and functions are not necessarily tied into the room speed and step order like everything else.There are a few things that you should note when working with the GameMaker physics world: In this way, with a few simple code and the correct room setup, you can create very complex interactions between objects and the world which will occur and resolve without you having to code for every single possible outcome. These coded "rules" will then govern the way everything in your game world interacts. It is more of a "passive" system where you define a series of properties for your objects in the game world, as well as the properties of the game world itself, before any collisions or interactions occur. The physics system works in a very different way to normal collisions. That's when you have to turn to the GameMaker physics system. This is fine for simple games, but when you have a large number of objects and have to code how they all react to different situations in the game world, it quickly becomes obvious that this system is just not enough. The "traditional" collision system (which GameMaker defaults to) is a "reactive" system, where you check for a collision and then react to that collision with code that you place in individual objects. The integration of a dedicated physics library to GameMaker means that you can now take control over all aspects of the physical behaviour of objects within your game world, particularly collisions and object interaction.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |