Golf Simulator
TLDR: Golf simulation software built for my Pennstate Capstone project. Completed without using external libraries (except SFML for 2D primitives), it includes custom physics and 3D rendering engines built from scratch. Ported to JavaScript, you can check out a live web demo here.
My Role:
Software Engineer (Solo Project)
Stack:
c++
SFML
Visual Studio
Microsoft C++ testing framework
Design tools: Balsamiq draw.io
Project Overview
Mission Statement
In the modern age of golf, numbers and data play a more important role in athletic performance than ever before. Our mission is to create a user-friendly golf simulation software designed for instructors, fitters, and golf enthusiasts. We aim to provide a practical and engaging platform for practicing, receiving instruction, and fine-tuning equipment through simulated shots.
Initial Research
With existing launch monitors and simulation systems in mind I went to research what is already on the market and what each product offered. I researched numerous options available on the market including their costs, specifications and reviews. I then compiled the most relevant information into cards.
*My project only involved the software component, but for academic research purposes I treated it as a full product.
Target Users
My ideal target users fall into three categories:
Serious Golfer
Golf Fitter
Golf Coach/Instructor
Personas
With the user profiles and interview information I constructed personas and journey maps.
Requirement Specification
With the initial research and personas well defined, we are ready to specify the requirements for the software component of our product.
Simulation Realism and Accuracy:Ideation
With the requirements well defined, I have an idea of what we need the system and UI to look like. To help flesh out the product, we begin with some basic, high level technical and design ideation. This includes a basic wireframe:
... and a domain model in UML notation:
Development & Testing
Development begins with the creation of a sprint backlog based on requirements.
The log was translated into a KANBAN board on Jira. Development was then conducted in an AGILE cycle of coding, testing and re-assessing to update the board during each sprint.
I began with a proof of concept, building a basic projectile physics engine. Then started incorporating additional factors such as air resistance, wind, altitude, temperature and magnus effect (from spin).
The output was plotted to console and graphed numerous different scenarios using excel to visualize them.
Once I had acceptable results with the physics engine, I began working on my custom 3D rendering engine to display the data in-app. I researched and constructed basic perspective projection equations to convert from 3D simulation space (x,y,z) to 2D screen space (x,y) pixels. I used SFML to draw the triangle primitives, lines and text. Due to clipping and back-face culling limitations, in confined the camera to a plane that would give them optimal viewing.
Putting it all together from there was simple. The shot simulation already generates a 3D coordinate for each 10th of a seconds, I merely have to project the coordinates to 2D and connect the dots. The wireframe for the ground is generated by a 3-dimensional nested loop that creates the vertices of our triangle primitives. Then we just re-calculate our rotation/projection and update the frame as needed.
Testing was integrated into the project using Visual Studio's built-in c++ testing suite. During each sprint I would create the relevant unit and acceptance tests to monitor progress. Running the full test suite would insure successful integration of new functions and components.
Finally, the UI was integrated into the window to allow the user full control over the parameters and ability to update them in real time. For the purposes of this project I worked under the assumption that software combined with hardware components to update shot data, however that was beyond the scope of this one semester project. For demonstration purposes I also ported the engine to JavaScript after completion.
Final Product & Reflection
The finished product, while limited in scope due to academic time constraints, was successfully developed and has multiple advantages over other simulators:
Superior Climate Simulation:
Ability to control wind speed, wind direction, temperature, and altitude. Each with a realistic impact on the simulation.
Direct Input:
Input shot data manually to test a shot under different conditions.
Customizable club data:
Edit custom club data including loft, optimal smash factor, spin rating and much more. Allowing the user to account for any type of equipment.
Final Thoughts
I would consider the project to be well planned, managed, and generally successful. Most importantly, all acceptance test for our requirement specifications were passed. However, it wasn't without hiccups along the way and there is always room for improvement. The main difficulty of the project was the time constraint of performing UX design and a software development cycle within one semester, and obviously certain concessions needed to be made to make the timeframe feasible. For example, my highest priority was getting accurate ballflight trajectories and distances; this meant the concession of a fully developed ball-turf interaction to predict rollout more accurately. The 3D engine also lacks advanced clipping and optimization techniques. Overall, I believe that I made the correct concessions to produce the best product I could within the given constraints.