• Physics for Pits in Top-Down 2D Games

    Lately, I’ve been interested in making a game with 2D top-down platforming elements, with the ability to jump similar to The Legend of Zelda: Link’s Awakening. To do this, one of the problems I’ve needed to solve was how to model the physics of holes or pits. This post explores some realizations I made while attempting to tackle this problem, along with the resulting physics.

    Physics for Pits in Top-Down 2D Games
  • An Approach to Randomly Distributing Game Collectables

    At first glance, the problem of distributing game collectables throughout a cell-based procedurally generated map with predefined collectable spots may seem simple: for each collectable, simply draw a random collectable spot and assign the collectable to it. However, this approach is not without its pitfalls. For instance, if the collectable spot density throughout the map is non-uniform, the distributed collectables will also have a similar non-uniform density. Furthermore, a random distribution does nothing to prioritize placing treasures off the main path, in nooks or dead-ends, as an actual game designer might place them. To compensate for these shortcomings, rather than placing collectables purely at random, we can assign higher or lower weights to each collectable spot based on their desirability, then draw random spots based on these weights. This post presents an approach to allocating collectables based on such weights.

    An Approach to Randomly Distributing Game Collectables
  • Wire Sag-Tension Algorithm

    Sag-tension calculations are a significant aspect of transmission line design. Whether evaluating line clearances, structure design loads, or providing section stringing information to construction, sag-tension calculations must be performed. However, often, documents covering the process only present a high level concept of the variables involved without presenting a concrete or exact calculation algorithm. On occasion, the calculations are presented in old publications that do not cover more modern approaches and considerations. Or the exact details of the calculations are not presented for proprietary reasons, hidden within the design programs of the companies that developed them. This post is intended to present a complete algorithm for performing sag-tension calculations, laying out all of the equations necessary to perform the calculation. If you plan to implement the algorithm, a programmatic approach will almost certainly be required since iterative calculations are necessary.

    Wire Sag-Tension Algorithm
  • How to Use Jupyter Notebooks for GitHub Pages Posts

    Due to their ability to directly incorporate code and code-generated visualizations, Jupyter notebooks are an excellent tool for technical blogging. However, some extra steps are required to setup and convert Jupyter notebooks to a format that can be used by Jekyll, the site generator used by GitHub Pages. This post provides the steps necessary to prepare a Jupyter notebook for conversion to a markdown document that can be used by Jekyll. In addition, it provides a script by which all posts for a GitHub Pages website can be converted via automation.

    How to Use Jupyter Notebooks for GitHub Pages Posts
  • Minimum Distance Between Ellipses

    This post provides an approach for calculating the minimum distance between two ellipses using gradient descent to optimize the square distance equation between points on the ellipses.

    Minimum Distance Between Ellipses
  • Minimum Distance Between Ellipse and Point

    This post presents two iterative methods for finding the minimum distance between a point and ellipse. The first method (Method 1) uses gradient descent to optimize the square distance formula between the point and a point on the ellipse. Meanwhile, the second method (Method 2) uses Newton’s method to find the minima using the square distance formula’s derivative.

    Minimum Distance Between Ellipse and Point
  • An Approach to Weight-Based Battle AI

    There are a number of ways to implement combatant AI in RPG battle games such as Dragon Quest or Pokemon. However, one simple approach is to develop a list of probabilities for all actions that a combatant can take, then draw a random action based on these probabilities. In some games, such probability lists may have been explicitly specified by designers and remained static regardless of the actual state of the battle. While in other games, more advanced logic, perhaps even incorporating combo attacks over the course of turns, may have been employed. Whatever the approach, the number of unique takes on battle AI throughout games is wide and varied. Ultimately, the implementation perhaps comes down to what features the game developers felt was most important for the gameplay, as well as what was technically and economically feasible at the time.

    An Approach to Weight-Based Battle AI
  • 1
  • 2