How do you create a simulation program?

Started by
6 comments, last by nobodynews 13 years, 4 months ago
I realize this is a very broad subject but is there a good reference that talks about the general design and structure of a simulation program? Google didn't give me anything useful..
"Spending your life waiting for the messiah to come save the world is like waiting around for the straight piece to come in Tetris...even if it comes, by that time you've accumulated a mountain of shit so high that you're fucked no matter what you do. "
Advertisement
That's probably too general. Depends on what you're simulating and whether it needs to be real-time or not.
Too general. What do you want to simulate?

Almost every program, especially games, have an aspect of simulation in them -- you create them, or any other 'simulation program' just like you would any other kind of program. You decide what problem you need to solve or what goal you want to accomplish, you break the problem down into tasks which you can model within whatever programming paradigm you want to employ, and you accomplish those tasks.
Well i've recently been asked by a friend to create a simulation of a car engine. Problem is, he didn't seem to know more than that. All he said was that he wanted the program to calculate all sorts of stuff like velocity, torque and heat output.

So let's say i want to create a simulation of a car engine. How is that usually done? What should i expect the user to input? And once i do get the input, it's just a matter of solving some equations right?
"Spending your life waiting for the messiah to come save the world is like waiting around for the straight piece to come in Tetris...even if it comes, by that time you've accumulated a mountain of shit so high that you're fucked no matter what you do. "
Usually?
You look into the problem. Google/Wiki/engineering books/etc. It is called "literate research"
What input the program requires is kind of arbitrary...maybe you should get a better idea of what he wants.
Quote:Original post by Waaayoff
And once i do get the input, it's just a matter of solving some equations right?


Its not about solving the equations. Its about finding the right equations to solve...

Quote:Original post by Waaayoff
Well i've recently been asked by a friend to create a simulation of a car engine. Problem is, he didn't seem to know more than that. All he said was that he wanted the program to calculate all sorts of stuff like velocity, torque and heat output.

So let's say i want to create a simulation of a car engine. How is that usually done? What should i expect the user to input? And once i do get the input, it's just a matter of solving some equations right?
You might wish to look into existing products that kind of do what you're suggesting. These will let you know at least what kinds of things the user will want to do with your products. This company for example seems to make software that can do this kind of thing.

Additionally you'll want to study mechanical engineering to learn how to do this kind of thing. If you don't want to go to school to do it I suggest finding some math books (calculus is generally a prerequisite) and then move on to newtonian physics which will probably be enough to do this (as opposed to more modern physics taking into account relativity and quantum behavior). After that you will have the background to study statics, dynamics, thermodynamics, materials, fluids, etc into greater depth than will be provided by a physics book. I also recommend some statistical knowledge as statistics are often used to help guide simulation (eg monte carlo simulation).

C++: A Dialog | C++0x Features: Part1 (lambdas, auto, static_assert) , Part 2 (rvalue references) , Part 3 (decltype) | Write Games | Fix Your Timestep!

This topic is closed to new replies.

Advertisement