[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Amateur game dev here, How difficult would it be to create a
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /sci/ - Science & Math

Thread replies: 21
Thread images: 2
Amateur game dev here,
How difficult would it be to create a simple model of the solar system ? I've only taken pre-calculus so far, but I did learn conic sections. I've been looking at Kepler's law of planetary motion, and I kind of understand the math, but I'm not quite sure how to implement it programmatically. Please share your precious knowledge with me.
>>
depends how simple you want it to be
>>
You need to solve a system of differential equations with initial conditions from the planets. You don't need more than Kepler's laws.
>>
Look up N-body simulation. But it really depends on how complex you want it,
>>
>>7680761
Well I can start with a 2d model and progress from there.
>>7680765
Cool, I'm checking that out on Khan academy.

Also, how cpu intensive is a 3d simulation? It would be cool if I could simulate a small asteroid belt, but I doubt that many objects would be viable.
>>
>>7680765
So why does he need to solve them?
>>
>>7680771
Remember that calculation time increases with square of number of particles. Which means that it becomes quickly very computationally demanding.

2D model is good to start with, and good for the solar system
>>
>>7680782
Kepler's laws don't tell you the positions of bodies, only their acceleration. A simple solution exists for 2 bodies only.
>>
And by Kepler's law I mean Newton's law of gravitation. :^ )
>>
>>7680793

He could just simplify it by just calculating each planet's elliptical orbit around the sun.
>>
>>7680806
That's too easy :)
>>
>>7680759
Nasa's GMAT tool is open source and models n body orbital dynamics, aerodynamic forces, and radiation pressure.

Orbiter, open source game, does n-body, not sure about drag & rad pressure.

If you're doing it to learn, awesome. If you need it for a project then recycle.
>>
Shouldn't be that hard, all you need is analytical solution of the 3-body problem which you can easily solve by hand
>>
Just do verlet integration
>>
>>7680759
You do it by setting up a simple simulation of particles obeying newtonian laws, if your initial positions velocities and masses are correct you will have your solar system running in no time.

Basically you avoid calculating what is supposed to happen and instead just put initial rules in place which causes things to unfold by themselves.
>>
>>7680759
Extremely easy. The positions of planetary bodies don't really disturb each other very much, so you can just calculate the two-body solution, put each object on rails in an elliptical path (the orbital parameters for all solar system bodies are publicly available, if you're simulating our solar system particularly), and get 99% accuracy.

You can then do n-body numerical simulations based on, say, the three strongest gravitational fields to get the motions of asteroids, satellites, other small objects, etc. These you can just assume have negligible gravitational pull, so the difficulty of simulation will only go up linearly with the number of bodies.
>>
Best to use a spherical coordinate system instead of a Cartesian one for a project like this.
>>
Reasonably easy as long as you don't need it to be perfectly accurate over the long term. Such models are always chaotic.

Grab a copy of Numerical Recipes.

https://en.wikipedia.org/wiki/Temporal_discretization
https://en.wikipedia.org/wiki/Numerical_methods_for_ordinary_differential_equations
>>
>>7680881

>MATLAB

I fucking hate engineers fuck. Fuck matlab. Who the fuck uses a proprietary language.grfghneoihehirwgh
>>
>>7681567
>>Who the fuck uses a proprietary language
apparently NASA. It's ok mate, I hate it too. Perhaps it will work in Octave?
>>
File: literallymagic.jpg (33 KB, 346x499) Image search: [Google]
literallymagic.jpg
33 KB, 346x499
>>7681113

this
Thread replies: 21
Thread images: 2

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.