Game maker studio 2 platformer
![game maker studio 2 platformer game maker studio 2 platformer](https://zackbellgames.files.wordpress.com/2014/10/test.gif)
- #Game maker studio 2 platformer full#
- #Game maker studio 2 platformer code#
- #Game maker studio 2 platformer professional#
When geometry is modified, compute which parts of the level are walkable and which are not, with some resolution (something similar to the dimensions of your agent might be good starting point).
#Game maker studio 2 platformer full#
This will not catch all use cases that you have - as you allow for full horizontal control - but might allow you to catch some common cases more quicklyĬonsider some kind of walkability grid instead of a link generation scheme. Try to pre-compute some jump trajectories ahead of time. This is mostly the same as what you're currently doing, but a bit more generic. This would allow you to severely limit how many platforms you're even trying to check. Limit the amount of comparisons you need to make by using a spatial data structure, like a quad tree. This is literally the only resource I've found.
![game maker studio 2 platformer game maker studio 2 platformer](https://3.bp.blogspot.com/-HAa_pJ007U8/U-4pYH46mEI/AAAAAAAADN8/xsJISoz0P7s/s1600/valdis.jpg)
I found this video, which describes a similar problem but which doesn't provide a good solution. Horizontal movement has no acceleration or inertia. Jumps are fixed height, unless you hit a ceiling. How would you determine, with complete reliability, whether it is possible for a character to jump from one platform to another, preferably without needing to simulate the whole jump?
#Game maker studio 2 platformer code#
However the more exceptions and special cases I add to the code the more convinced I am that the actual problem is in the jump simulation code, which brings me at long last to my question: By figuring out various ways to predict whether a jump is impossible I have managed to lower the number of expensive tests run by a whopping 33 (12%!). If I simply tried every possible combination of starting and destination platforms, I would need to run 17 * 16 = 272 tests. In an effort to speed things up, I've focused on the other important debugging number, the tests counter: 239. Heck, at this geometric time cost it might take years. If it scales this badly at a mere 17 platforms then it'll be a joke at the hundreds I need to support. The reason for this is obvious, the yellow text in the screen centre shows us how long it took to build the graph: over 24,000(!) simulated frames, each with attendant collision checks against every block - I literally just run the character's step event in a while loop so everything it would normally do to handle platformer movement in a frame it now does 24,000 times. The huge, glaring problem with this approach is that for a level of only 17 platforms (as shown above) it takes over a second to generate the node graph. Link lines are green at the origin and red at the destination. The light blue rectangles are just there to highlight where recognised platforms are, the actual platforms are the rows of grey boxes. In this example the mostly-concealed pink ghost in the lower right corner is trying to reach the black and white box. Linked platforms (Hyperlink because no rep.) This approach works, more or less, and produces a link structure that when visualised looks like this: If this attempt is successful, record the data necessary to replicate it in real time and move on to the next platform. If a link seems possible, place an ai_character instance on the starting platform and (within the current step event) simulate a jump attempt.ģ.a Repeat this jump attempt for each possible starting position on the starting platform. My current approach is, more or less, this:įor each platform consider each other platform in the level.įor each of those platforms, if it is obviously unreachable (due to being higher than the maximum jump height, for example) do not form a link and move on to next platform. Because of this, I need a way to dynamically figure out which platforms can be reached from which other platforms in order to build a node graph I can feed to A*.
#Game maker studio 2 platformer professional#
I'm working on a game (using Game Maker: Studio Professional v1.99.355) that needs to have both user-modifiable level geometry and AI pathfinding based on platformer physics.