Shanes Curries Blog

Return to Blog directory



New JavaScript Game: Blackhole Run (Beta Version 1.15) a 2D game based on space physics.

04/02/25 by Mr Shane Currie | Charles Sturt Student

This is a technical document requiring technical expertise to understand.

In todays article I demonstrate a new JavaScript game that I am working on, the game is called Blackhole Run and the purpose of the game is to collect as much fuel as you can from a black hole and transport the fuel back to the blue planet without falling in to the black hole or crashing in to the blue planet.

This game is in beta version, meaning that its not yet complete and I am planing on including new features in the game in the future. I am making this game as I am interested in learning more about space physics, and as someone who learns by a hands on approach I find this game a great way to learn about the mathematical principles that explain mass, gravity and blackholes.

To demo the beta version of the game, click on the link below. I have optimised this game to work on both computer and mobile phone screens. The principle of the game is simple. Collect fuel from the black hole. This is accomplished by getting close enough to the black hole to collect fuel without falling in. Then you must safely transport that fuel back by safely landing on the blue planet at a specified speed.

Click Here to Play the Demo of Blackhole Run V1.15

The mathematical principals included in this game are as follows: The empirical massradius relationship, Schwarzschild radius formula & Newtons law. The empirical mas-relationship was used to determine the mass of a planet based on its radius (how big the planet is) the Schwarzschild formula was used to determine the point of no return (Aka event horizon) radius for the black hole and Newtons law was used to calculate the gravitational force. By reverse engineering these mathematical algorithms, I will be able to increase my understanding of space physics

I am no mathematician, so GenAI was used for creating the framework for this program and calculating the mathematical principals. But this was not a simple copy and paste job. Creating this program involved multiple versions, research of mathematical principals and my own customisation of the code. Basically, I used GenAI the same way that an accountant would use a calculator. Providing GenAI the correct prompts is key.

Furthermore, by using GenAI in this personal project of mine (I dont use Gen AI for my university projects, I like to write my own assignments) I have shown that GenAI can be used more for then just discussing politics. GenAI was not designed to be a politician. Besides discussing politics with GenAI is boring, its more fun to use GenAI for creating JavaScript games.

This game was designed for educational purposes, and for learning JavaScript. The full code for this game is available on GitHub (I will include the link below). There are detailed comments included in the code. Highlighting where values can be changed to alter the gameplay.

Blackhole Run Github repostory

Want to increase the distance between the black hole and the blue planet, you can edit the X and Y coordinates (for this version, keep the black hole and the planet on the same Y axis). Want to change the mass of the black hole or the blue planet and study the gravitational effects, or give your ship more stating fuel or increase its propulsion speed? You can simply modify the values in the code. Distances in this game are measured in pixels.

Keep an eye out on my blog for future versions of this game, I plan to implement more gameplay features in the future. I am considering including space pirates in the game where the player can receive payments in a bounty for taking down space pirates. Also other features such as upgrades to the blue planet when it receives fuel and ship upgrades.

I also want to include better pathfinding, currently the Bresenhams algorithm is being used. The players ship basically travels in a straight line (Via an X,Y Axis) between the blackhole and the blue planet. I would like to include the A-Star or Dijkstras algorithm for better pathfinding so the players ship does not get lost in space.

Also, I want to include a feature where the black hole collects space junk and this increases the mas of the black hole. This will make gameplay even more challenging as the player will need to be aware of changes in the Schwarzschild radius when collecting fuel.

Overall, I have a few features to implement that will keep me busy during the upcoming winter.

Known bugs in V1.15 This section will include known bugs in the game

Bug (B1): When the player falls in to the black hole, the game will restart with the player placed in a random location in space. Workaround: press the reset button to reposition the ship on the correct X, Y Axis.

Disclaimer: This is an open source JavaScript game, I give permission for persons to freely download, share and modify this game for their own purposes. Persons however do not have permission to profit from this game, this game is for educational purposes.


Have a game suggestion or like to report a bug, contact the developer at info@shanescomputing.com.au