Guide to implementing 2D platformers (2012)
The guide outlines four methods for implementing 2D platformers, focusing on tile-based systems, their mechanics, and the importance of collision detection, while inviting community feedback for improvement.
Read original articleThis guide aims to provide a comprehensive overview of implementing 2D platformers, categorizing various methods along with their strengths and weaknesses. The author identifies four primary implementation types, starting with the simplest, tile-based (pure), where character movement is restricted to tiles, making it suitable for puzzle games but limiting for action-based platformers. The second type, tile-based (smooth), allows for free movement while still using a tilemap for collision detection, making it popular for action games due to its flexibility and ease of implementation. The guide discusses the mechanics of each type, including how character movement is calculated, collision detection, and the handling of slopes and one-way platforms. The author emphasizes the importance of understanding these systems to create engaging gameplay experiences and invites feedback to enhance the guide further. The information is derived from reverse engineering game behaviors rather than direct code analysis, which may lead to discrepancies in the actual implementation.
- The guide categorizes four main methods for implementing 2D platformers.
- Tile-based (pure) systems restrict character movement to tiles, suitable for puzzle games.
- Tile-based (smooth) systems allow for free movement and are favored in action platformers.
- Collision detection and handling of slopes and one-way platforms are crucial for gameplay mechanics.
- The author encourages community feedback to improve the guide's comprehensiveness.
Related
2D Game Development: From Zero to Hero
The book "2D Game Development: From Zero To Hero" by Penaz is a free, evolving resource for aspiring game developers, offering tips, multiple programming languages, and encouraging community contributions.
Isometric Projection in Game Development
Isometric projection is vital in game development, offering a unique visual style with 120-degree angles. It contrasts with orthographic and perspective projections, enabling both retro and modern games to simulate 3D environments.
Isometric Tutorials
Clint Bellanger's article series on isometric game development covers tiles, mathematical formulas, Blender tutorials, and practical applications like treasure piles, catering to both beginners and advanced developers.
Sort, sweep, and prune: Collision detection algorithms
The sweep-and-prune algorithm enhances collision detection in video games by reducing checks through sorting, achieving an average time complexity of O(n + m), improving performance over naive methods.
Ask HN: Platform for 11 year old to create video games?
Several game development platforms suit children's interests and skill levels, including Scratch, GameMaker Studio, Unity, and Construct 3, each offering varying degrees of complexity and user-friendly interfaces.
Guide to implementing 2D platformers (2012) - https://news.ycombinator.com/item?id=31450218 - May 2022 (37 comments)
A guide to implementing 2D platformers - https://news.ycombinator.com/item?id=10202275 - Sept 2015 (32 comments)
The guide to implementing 2D platformers - https://news.ycombinator.com/item?id=4065033 - June 2012 (2 comments)
The Guide to Implementing 2D Platformers - https://news.ycombinator.com/item?id=4005883 - May 2012 (2 comments)
> Character movement is limited to tiles, so you can never stand halfway between two tiles.
[…]
> Examples: Prince of Persia
That is absolutely false. You can stand on any pixel in Prince of Persia. It’s when I find stupid errors like these that I start to question the entire article they appear in.
Yeah, acceleration is essentially infinite.
https://tasvideos.org/GameResources/NES/Rockman/Data
When moving horizontally there's very small lag at the start and then he accelerates to full speed pretty much instantly.
When moving vertically by jumping, his speed is straight up set to some constant. There is downwards deceleration by gravity though, leading to "fall faster" tricks:
https://tasvideos.org/GameResources/NES/Rockman#FallingFaste...
But something always bugs me about that - we know the closest edge of the closest obstacle, we know the vector of the player’s motion, by all accounts we should be able to calculate the point of contact in one go without doing any substeps.
And yet, doing it in one pass always seems to result in a myriad of edge cases (literal!) that break the whole thing, unless you do heavy preprocessing, converting your tiles to a graph of lined surfaces, etc etc.
Related
2D Game Development: From Zero to Hero
The book "2D Game Development: From Zero To Hero" by Penaz is a free, evolving resource for aspiring game developers, offering tips, multiple programming languages, and encouraging community contributions.
Isometric Projection in Game Development
Isometric projection is vital in game development, offering a unique visual style with 120-degree angles. It contrasts with orthographic and perspective projections, enabling both retro and modern games to simulate 3D environments.
Isometric Tutorials
Clint Bellanger's article series on isometric game development covers tiles, mathematical formulas, Blender tutorials, and practical applications like treasure piles, catering to both beginners and advanced developers.
Sort, sweep, and prune: Collision detection algorithms
The sweep-and-prune algorithm enhances collision detection in video games by reducing checks through sorting, achieving an average time complexity of O(n + m), improving performance over naive methods.
Ask HN: Platform for 11 year old to create video games?
Several game development platforms suit children's interests and skill levels, including Scratch, GameMaker Studio, Unity, and Construct 3, each offering varying degrees of complexity and user-friendly interfaces.