top of page

2D N-body simulation

About

A 2D N-body simulation I made for an interview tech test, using Unreal, I created a simulation of 2D gravity between bodies of random masses.  

  • Role: Solo developer

  • Engine: Unreal 5.1

  • Language: C++

  • Development time: 3 days

My task was "Using Unreal’s data structures and game framework, implement an N-body Simulation as a real-time 2D visual experience", with a caveat "If a Body flies over the screen’s edge, it should teleport to the opposite edge and continue its motion, effectively “wrapping” around the game world and preventing any Bodies from disappearing."

​

To simulate 2D gravity I used the Newton's law of universal gravitation. You can find the code for this here.

​

To simulate wrapping each frame, when the velocity of a body updates, I check if it's X or Y coordinate is higher than the X or Y size of the field, setting the coordinate of the body back by the size of the field if the check returns true. You can find the code for this here.

​

There is one another solution in the project files, which used teleporters, I decided not to use it since it's slower, there are also ways to speed this simulation up, which I plan on exploring in the future.

Project Horizon Games

About

A survival shooter, codeveloped by me and Mahlon H as Project Horizon Games. In active development, check the website for up to date info.

  • Role: Lead programmer, generalist Unreal developer

  • Engine: Unreal 5.1

  • Language: Blueprints and C++

  • Development time: started March 20th

My main responsibility in the project is to write and implement gameplay and AI logic, manage epic game store packs make them work together. So far everything was done in blueprints but I plan to move some of the classes to C++ as the development of the game progresses.

bottom of page