r/learnprogramming • • Nov 03 '25

How do you effectively break down complex programming problems?

I've been learning programming for about a year and understand basic syntax and concepts, but I consistently struggle with breaking down larger problems into manageable pieces. When faced with a complex task like building a small application, I often find myself staring at a blank editor unsure where to begin. I've tried writing pseudocode and drawing diagrams, but still feel overwhelmed by the gap between understanding individual concepts and applying them to solve real problems. What specific techniques or approaches have helped you develop this skill? Do you start with the data structures, user interactions, or something else entirely? How do you identify the core components needed versus getting lost in edge cases too early? I'm particularly interested in practical strategies that helped you transition from tutorial-based learning to independent problem solving.

27 Upvotes

35 comments sorted by

View all comments

Show parent comment

2

u/AcademicFilmDude Nov 03 '25

I am following along and very much want to hear about your space sim!

1

u/InVultusSolis Nov 03 '25

Fair enough! So for my space sim engine, I am using C++ along with OpenGL ES and SDL for window handling, key binding, and sound manipulation. It is targeting the Raspberry Pi 400 as the reference system, so if it runs there, it'll run anywhere. So if memory serves, I undertook the following steps:

  • Get a database of nearby stars - distance and bearing to Earth, spectral class, etc. I think I started with about 100k stars. The glue code to do this in and of itself was a beast!
  • Do some math to convert the coordinates of all stars to cartesian coordinates relative to Sol, but coplanar with the galactic disc.
  • Store all of the above in a fast data store. I chose SQLite for easy editing.
  • Develop an algorithm to compute the skyboxes for space in whatever sector of the galaxy you're in. A unique skybox is generated for every 1/10th of a parsec you travel, except if you're within 1/2 parsec of a star. If that's the case, the boundary for a new skybox is calculated by your distance from the star. This algorithm involved some simple 3D versions of stuff I learned in high school geometry to convert the diff between two Cartesian coordinates into angles in degrees. And for computational simplicity I did a SQL query to only calculate the closest 1000 or so stars (but I could turn up the density).

The first time I started the program with the above.... it worked!! I saw familiar constellations when "centered" at 0,0,0, or the Sol system.

Then:

  • Develop a model loader. I was using basic Blender .obj output with texture data included, so I did that.
  • Create a generic 'Object' class, subclassed 'Ship' object from that. Programmed basic Newtonian physics on 'Object' objects such as position, orientation, velocity vectors, etc.
  • Create the concept of 'thrust' on my ship class as well as a viewpoint, including main thrusters, retro thrusters, hover thrusters, and RCS thrusters.
  • Create a "starlight" shader to add some light to my world, set the Sol star at 0,0,0, set my own distance at 1 AU from Sol.
  • Integrate Lua and a console using a pre-rolled console library so I could add things to my "universe" without having to recompile the program, and I could also control the objects I added.

At this point, I have full control over ships and can fly them around, but so far I actually only have designed the mesh and textures for one ship: the Trevia. It's the Toyota Tercel of space travel.

In-game view of the Trevia. Keep in mind that I definitely am planning for lights, mesh animation, etc - this is just the most stupid shape I could come up with at the drop of a hat to get things working.

Star map detailing local systems, I believe each grid unit is 1 parsec.

Early pass at starfield, facing the adjacent galactic arm. Positions of stars are accurate but I have tweaked the shader to display the stars quite a bit since then, a more accurate starfield can be seen in the "Trevia" picture above.