I need some advice for getting the best use of Edyn in my space game. #107
Replies: 10 comments 6 replies
-
I imagine this would require modifying the internals of the engine so it can support simulating virtually infinite worlds. One thing I have spent some time thinking about but have not implemented yet is origin shift, but that is not enough in this case. One solution I can think of is splitting space into cubes where each cube has its own broadphase tree and the center is the virtual origin. All calculations are done in its object space. This would allow you to still use a single registry and the whole thing would be transparent. Perhaps the value stored in |
Beta Was this translation helpful? Give feedback.
-
Unfortunately there's not a lot of info out there, space sims that take real distances into account are fairly niche. Origin shift on its own is adequate for a single player game but starts to fall apart with multiplayer. I know some people create a new physics "world" for each virtual origin but that seems like a lot of overhead. I agree the For my galaxy container I use an octree optimized for range searching. It stores all of the static objects ( stars, space stations, etc ) and allows me to quickly find what is within a specified distance of a given point. I could easily add virtual origins to it and do a nearest neighbor search to find the closest virtual origin to a ship or whatever. |
Beta Was this translation helpful? Give feedback.
-
Space is something of massive scale and great sparsity, so we have to leverage levels of detail and hierarchical space partitioning. Levels of detail means running separate simulations for each level of the universe, such as one simulation for galaxies, one simulation for each solar system in each galaxy, one simulation for each planet in each solar system, and finally, one simulation that happens at the highest level of detail at the surface of each planet and each space ship/station. Each simulation runs at a scale that is adequate for the size of the objects being simulated. At the correct scale, these objects could be simulated just fine as rigid bodies in Edyn with gravitational forces between them, and even collisions. I am not sure if it is accurate enough though to maintain stable orbits. Probably yes if you use a very low fixed delta time. Space partition can be used to locate these entities in space, such as a dynamic bounding volume tree, which is what Edyn already uses. Simulating these individual objects in the universe with gravitational forces seems simple enough. The interesting part is simulating the relatively small stuff such as space ships, stations, asteroids… this is where you’d need to shift origin and maybe employ a multilevel space partitioning, perhaps using an octree with integral coordinates where each point represents a sector of 4km^3. Every small object has a It gets interesting when you’re actually descending into the highest level of detail which would be landing on the surface of a planet. I imagine you’d not simulate the surface of a planet like just a spherical object centered at the planet’s position. Instead, you’d simulate individual chunks which could be kinematic objects that have their trajectory derived from the position and orientation of the planet they belong to. The contents of the chunk would likely be generated procedurally so I guess each chunk would simply have the inputs to pass to the procedural terrain and city generator and when the chunk is needed it would generate the triangle mesh and so on. Just a bit of brainstorming… |
Beta Was this translation helpful? Give feedback.
-
I agree with everything above. In my case I wasn't planning on doing any n-body gravitational simulations for planets and other orbiting bodies to keep the computation down and the stability up. I use density wave theory to procedurally generate spiral galaxies. I wrote a solar system generator that creates a procedural solar system from a random seed stored for each star. Orbital elements are precalculated using Kepler's laws to speed the computation for orbital position as a function of time at runtime. My thought was to trigger this whenever a ship gets close enough to it to matter, it can then be kept and cached or discarded when the last ship leaves. I agree, the small stuff is where it gets interesting, anything player controlled does need to have n-body gravity applied, etc. While I would love to support landing on planets, in reality this is a one man show and I am not getting any younger. I am trying to scale back to reasonable limits. Don't tempt me :) |
Beta Was this translation helpful? Give feedback.
-
Simulating an entire galaxy is definitely intense, but it seems reasonable at a much lower scale than real galaxies. Having the ability to do the full trip from the surface of one planet to another would be incredible to achieve, and it seems like a reasonable thing with multiple levels of detail. But you also have to consider the visual/rendering aspects of this, which might be more complex than the physics itself. It all sounds reasonable, it's just a whole lot of work and it's complex to organize everything. Then also considering networking and distributed simulation... it sounds very sexy and tempting but it certainly is a whole lot of work. |
Beta Was this translation helpful? Give feedback.
-
Have you used Edyn with Yojimbo? I think I am getting some conflicts with Yojimbo's serialization macros. |
Beta Was this translation helpful? Give feedback.
-
Looks like Yojimbo uses a bunch of macros for serialization:
Some of these conflict with Edyn ( |
Beta Was this translation helpful? Give feedback.
-
Going to try ENet |
Beta Was this translation helpful? Give feedback.
-
Got ENet up and going! What integrator does Edyn use? |
Beta Was this translation helpful? Give feedback.
-
What are the rules of thumb regarding physics update rate on the client vs the server? |
Beta Was this translation helpful? Give feedback.
-
I am working on a client/server space exploration/adventure game using libyojimbo. Space is BIG, I am using high precision numbers to store my positions. To deal with this I am planning on using spatial rebasing of the origin when two or more objects are close enough to interact with each other, for example a ship approaches a planet, so that I can convert the coordinates to double precision with a 'virtual' origin. My dilemma stems from when this occurs in two locations very far away from each other. From the physics side I see two ways to handle this:
The second option seems to be a cleaner path but would require the server to send client messages based on collision filter along with, or instead of, the client AABB. It would also limit me to 64 "groups" as I believe that's how many collision filter bits there are. This I can live with.
Thoughts? Is there a better way?
Beta Was this translation helpful? Give feedback.
All reactions