- #1
Bob65536
- 5
- 0
I am writing a browser based multiplayer game. The basic idea is that you are the leader of a very advanced spacefaring civilization. Your objective is to gather resources and develop your technology further. You gather resources by mining stars. The more stars you control, the more resources you have available. Everyone plays in the same galaxy and fights with each other to control as many stars as possible. The galaxy was artificially created by an even more advanced race, that also ensures game play fairness.
The galaxy is a dwarf starburst galaxy that will start with about a million objects (stars, black holes, neutron stars, etc.). More galaxies can be added later depending on the number of players. The galaxy will evolve over time with stars dying and new stars being created. My objective is to make a galaxy that is as realistic as possible given practical limitations on computational resources and development time. One i7 computer should be able to run the galactic simulation and act as a server for 100 players.
I'm not very knowledgeable when it comes to astronomy and astrophysics. Most of my knowledge comes from reading every article related to astronomy on Wikipedia last night. So I'm going to layout my plan for simulating a small galaxy and let people poke holes in it, or provide any alternatives.
The galaxy is discretized into squares. Each square has a certain density of interstellar dust. The galaxy is initialized by creating a galactic boundary and creating a distribution of interstellar material inside that boundary.
I have written a small program that generates a random boundary and initial distribution. Here is when it looks like. Brighter areas have a higher density of matter. The circle indicates the center of mass where I will place a supermassive black hole.
[PLAIN]http://i.min.us/jmlgwY.png
The movement of interstellar dust will be approximated by a fluid mechanics simulation. The assumptions of compressible inviscid flow should work well. I plan on using the fluid dynamics algorithm described in http://scannapieco.asu.edu/finite_diff2.pdf .
However, we have to add gravity or diffusion will make for a strange galaxy. So after each iteration of the CFD, the universal gravitation equation is applied between adjacent cells to update the mean velocity of the fluid. This should create an equilibrium so diffusion isn't a problem, although the universal gravitational constant may have to be modified to make sure is equilibriates where I want it to.
In the interstellar dust simlution, I am ignoring most of the affect stars have on it. This includes thermal effects, solar wind, and gravitational attraction. The only way stars affect it is by novas. If there is a nova in a cell, it will add internal energy to the fluid and increase its density. This will cause a shockwave to propagate through the interstellar medium.
Shockwaves in turn can create new stars. Determining whether or not the dust starts forming into a star is a function of the magnitude of the pressure wave and the density of the dust in a cell. I will set some sort of minimal density and pressure change. If both quantities are above the threshold, then
[tex]P\rho \geq c[/tex] will cause a star to be created.
Where P is the pressure difference over a fixed period of time and rho is the density of dust in a cell. The constant c is empirically determined. The value is chosen so that star creation isn't too common or not common enough.
Only a single star is created in a cell at a time. The location of the star is a random point inside the cell. The mass of the star is found by subtracting all of the dust in a fixed radius around a star. The percent area of this circle that overlaps a cell is the percent of mass that cell donates to the star.
When the star is created, another small shockwave is set off. If there is enough matter nearby another star will be created. This will help make sure there are multi-star system. The radius that star creation consumes has to be determined so that the size and distribution of stars appears realistic.
The star effective temperature, radius, luminosity, color, and lifetime is determined by its mass. It will be linearly interpolated from the table below with a little bit of randomness thrown in.
Mass, radius, and luminosity are relative to the sun. The color of the star is the color of a black body with the effective temperature of the star. A table of colors is found at http://www.vendian.org/mncharity/dir3/blackbody/UnstableURLs/bbr_color.html.
The last column has the number of real time days that a star lives. I could not make it proportional to the actual time for gameplay reasons. One star shouldn't last 3000 times longer than another. If you average it out, it is about 42 million years of simulated time per real world hour.
I initially wanted stars to move around the galaxy based on gravitational influence, but I decided against it for gameplay reasons. A star will remain in the same location it was created until it dies.
When a star dies it turns into a white dwarf, neutron star, quark star, or black hole. This is determined by its mass.
Eventually more and more of the mass in the galaxy will be converted into these end products. Players with sufficient technology will be able to mine white dwarves, but the others are unusable.
When there are too many black holes and neutron stars, the super advanced alien race that created the galaxy will renew it by annihilating all dead stars with antimatter. They will then add an equivalent mass to the nearby interstellar medium. The shockwaves and new matter will trigger the creation of new stars.
So that's my plan. I would appreciate any comments or improvements. Thanks.
The galaxy is a dwarf starburst galaxy that will start with about a million objects (stars, black holes, neutron stars, etc.). More galaxies can be added later depending on the number of players. The galaxy will evolve over time with stars dying and new stars being created. My objective is to make a galaxy that is as realistic as possible given practical limitations on computational resources and development time. One i7 computer should be able to run the galactic simulation and act as a server for 100 players.
I'm not very knowledgeable when it comes to astronomy and astrophysics. Most of my knowledge comes from reading every article related to astronomy on Wikipedia last night. So I'm going to layout my plan for simulating a small galaxy and let people poke holes in it, or provide any alternatives.
The galaxy is discretized into squares. Each square has a certain density of interstellar dust. The galaxy is initialized by creating a galactic boundary and creating a distribution of interstellar material inside that boundary.
I have written a small program that generates a random boundary and initial distribution. Here is when it looks like. Brighter areas have a higher density of matter. The circle indicates the center of mass where I will place a supermassive black hole.
[PLAIN]http://i.min.us/jmlgwY.png
The movement of interstellar dust will be approximated by a fluid mechanics simulation. The assumptions of compressible inviscid flow should work well. I plan on using the fluid dynamics algorithm described in http://scannapieco.asu.edu/finite_diff2.pdf .
However, we have to add gravity or diffusion will make for a strange galaxy. So after each iteration of the CFD, the universal gravitation equation is applied between adjacent cells to update the mean velocity of the fluid. This should create an equilibrium so diffusion isn't a problem, although the universal gravitational constant may have to be modified to make sure is equilibriates where I want it to.
In the interstellar dust simlution, I am ignoring most of the affect stars have on it. This includes thermal effects, solar wind, and gravitational attraction. The only way stars affect it is by novas. If there is a nova in a cell, it will add internal energy to the fluid and increase its density. This will cause a shockwave to propagate through the interstellar medium.
Shockwaves in turn can create new stars. Determining whether or not the dust starts forming into a star is a function of the magnitude of the pressure wave and the density of the dust in a cell. I will set some sort of minimal density and pressure change. If both quantities are above the threshold, then
[tex]P\rho \geq c[/tex] will cause a star to be created.
Where P is the pressure difference over a fixed period of time and rho is the density of dust in a cell. The constant c is empirically determined. The value is chosen so that star creation isn't too common or not common enough.
Only a single star is created in a cell at a time. The location of the star is a random point inside the cell. The mass of the star is found by subtracting all of the dust in a fixed radius around a star. The percent area of this circle that overlaps a cell is the percent of mass that cell donates to the star.
When the star is created, another small shockwave is set off. If there is enough matter nearby another star will be created. This will help make sure there are multi-star system. The radius that star creation consumes has to be determined so that the size and distribution of stars appears realistic.
The star effective temperature, radius, luminosity, color, and lifetime is determined by its mass. It will be linearly interpolated from the table below with a little bit of randomness thrown in.
Code:
Class Min Temp Max Temp Min Mass Max Mass Min Rad Max Rad Min Lum Max Lum Lifetime [years] Lifetime [days]
O 33000 16 6.6 30000 1.00E+06
B 10,500 30,000 2.1 16 1.8 6.6 25 30,000 3.00E+07 3.000
A 7,500 10,000 1.4 2.1 1.4 1.8 5 25 4.00E+08 13.746
F 6,000 7,200 1.04 1.4 1.15 1.4 1.5 5 4.00E+09 21.806
G 5,500 6,000 0.8 1.04 0.96 1.15 0.6 1.5 1.00E+10 23.821
K 4,000 5,250 0.45 0.8 0.7 0.96 0.08 0.6 6.00E+10 28.657
M 2,600 3,850 0.45 0.2 0.7 0.2 0.08 0.02 1.00E+11 30.000
The last column has the number of real time days that a star lives. I could not make it proportional to the actual time for gameplay reasons. One star shouldn't last 3000 times longer than another. If you average it out, it is about 42 million years of simulated time per real world hour.
I initially wanted stars to move around the galaxy based on gravitational influence, but I decided against it for gameplay reasons. A star will remain in the same location it was created until it dies.
When a star dies it turns into a white dwarf, neutron star, quark star, or black hole. This is determined by its mass.
Code:
Min Mass Max Mass
White Dwarf 0 1.4
Neutron Star 1.4 4
Quark Star 1.5 1.8
Black Hole 4
Eventually more and more of the mass in the galaxy will be converted into these end products. Players with sufficient technology will be able to mine white dwarves, but the others are unusable.
When there are too many black holes and neutron stars, the super advanced alien race that created the galaxy will renew it by annihilating all dead stars with antimatter. They will then add an equivalent mass to the nearby interstellar medium. The shockwaves and new matter will trigger the creation of new stars.
So that's my plan. I would appreciate any comments or improvements. Thanks.
Last edited by a moderator: