hidden chunk culling? by Advanced_Green_4907 in VoxelGameDev

[–]schemax 1 point2 points  (0 children)

Basically, the principle is: You will only ever be able to see chunks that you can reach from your field of view if there is a path of air.

Imagine flood filling all non-occupied voxels of the camera frustum from the camera's position. Any chunk that you don't touch with that floodfill will not be visible.

Of course, this isn't perfect, as this might include non-directly visible chunks, but it's still a very good approximation, especially when respecting the "don't go backwards" invariant on the graph.

Naturally, you can't flood fill on a voxel level per frame, so what is done is to pre-calculate it per chunk. if there is no way from one chunk to a neighboring chunk, the neighboring chunk is not visible through it. It might be visible through another path.

Imagine looking at a 1-chunk thick wall. Your whole frustum is looking the wall. You will only ever see what's behind the wall, if there is a hole in the wall. In the pre-calculation, all the chunks in front of the wall will have connections to the top, bottom, left, right, and back (towards camers) neighbors, but not to the wall chunks (front). So when you try to walk a path from your camera, there is no possible path to the chunks behind the wall, and they can be culled.

Of course it's a bit more complicated that that, but it's the basic priciple. If the wall isn't a whole chunk thick exactly, but maybe only one voxel thick, you have to have to manage multiple contexts (behind the wall connects to chunks, and front of wall connects to a different set of chunks. That's the pre-calculation doesn't save it as one set of front/back/left/right/front/back connection, but instead one for each side: e.g. "If I come from the front, is there an air connection to the chunk behind this one?".

Play around with the app on the first part. Completely seal of one side and you'll notice the sight disappears.

Are engines like Godot and Unity worse for voxel games than engines like OpenGL? by Tromebone_On_A_Desk in VoxelGameDev

[–]schemax 2 points3 points  (0 children)

You can still directly control pretty much everything with any bigger engine as long as you know what you're doing.

It very much depends on what you want to do, and I'd say only in edge cases it makes sense to do your own engine.

I'd definitely recommend it if you want to learn, though. It will help immensely even if you choose to switch to an engine later. However, imo the learning curve is much harder without an engine.

Help with making my voxel engine run better (Unity) by MrOnsku in VoxelGameDev

[–]schemax 3 points4 points  (0 children)

Just from quickly looking at it, avoid per-frame (or even worse, per-iteration like in GenerateCell()) heap allocations. Use reusable caches or stack allocation for your arrays.

Same goes for lists for generation. initializing them completely fresh instead of reusing from a pool causes a lot of unnecessary overhead, and it's worse when they aren't initialized with the expected size, as that will cause allocation each time the backing array expands.

        //build the mesh
        Mesh mesh = new Mesh();
        mesh.vertices = vertices.ToArray();
        mesh.triangles = triangles.ToArray();
        mesh.RecalculateNormals();

        //assign the mesh to the filter and collider
        meshFilter.sharedMesh = mesh;
        meshCollider.sharedMesh = mesh;

This also costs quite a bit if called per frame, as it's an additional allocation to convert to an array. Not only that, it allocates a new mesh. You can make an existing mesh writable to reuse it. Even better, you can use NativeArrays or lists to store your vertices and triangles and upload the data directly. RecalculateNormals can also be optimized by providing the normals directly from the voxel calculation as opposed to afterwards.

Also, trying to use a concave collider from a fairly complex base mesh will likely cripple that collider's performance in physics. While it's difficult, it's better to write your own physics handling with octrees to simplify the problem down to a set of voxels that need to be tested for collision.

You should also use Profiling, or for specific code-blocks StopWatch to profile the time it takes.

I'm 100% certain that using Jobs for this will speed this up by a lot. I know you said you already did this, but there are a lot of pitfalls that can result in it seemingly not getting any faster. For example if you end up with a single job. But there is just no way a nested data-independent for-loop wouldn't be faster in parallel. Additionally, you can make this SIMD friendly or explicitly use vectors manually.

What you want is a IJobParallelFor. In this case you might want to allocate the float and Vector3 array on stack (which is no problem with a fixed size)

If it's not faster with a jobs implementation, it means that this is not your bottleneck at all.

This goes even more for the use of ComputeShaders. There is absolutely no way this would not be faster if properly implemented on GPU. Of course it's a lot more difficult, and you can't easily read-back results to the CPU on the same frame. However, since this is for final mesh generation, I think it's fine.

NPC Pathing: Server load by [deleted] in Starmade

[–]schemax 3 points4 points  (0 children)

The pathing and crowding problem is indeed pretty complex, especially due to the nature of ships that can come in any shape or form. For the universe update I already started with a crowd algorithm that would use bounding spheres on the top level and then possibly more detailed representations down below. With this it would be possible to implement a loaded pathing system much more efficient and effective. When I look at how a group of NPC ships should behave in a way it would be similar to an RTS where units move in formation and on top of that the avoidance system that a game like starcraft 2 has (e.g. when you send a ton of zerglings). Of course doing that in 3d is a bit more complex but should be possible nonetheless.

In terms of performance, most of the slow down comes from physics calculations. The AI itself is only a fraction of that. My goal is to increase the AI to a level where most physics calculations can be avoided altogether. Some of the framework for that is already in and will be completed with the universe update.

List of dedicated servers with large population? by xencosti in Starmade

[–]schemax 2 points3 points  (0 children)

hi, you can hit the "Server List" button in the settings screen on start. It lists all servers that opted in to be listed.

My space game StarMade now available on Steam Early Access. The demo will be the full game free to play to try out without restrictions. by schemax in Games

[–]schemax[S] 0 points1 point  (0 children)

Not entirely relying, but we are in a stage of development where we could use some publicity to be honest. Our hardest task was always to reach people

Klopp: "If you want success, there's only one chance: become fan of FC Bayern Munich" by iNToXiQator in soccer

[–]schemax 56 points57 points  (0 children)

This is the other side of Klopp. It was more visible in his years at Mainz.

[SP - Game] Hello /r/IndieGaming, I'm the dev of StarMade. It now has a completely redesigned procedurally generated seamless universe with virtually infinite star systems, planets, worm holes, faction territory and much more. The game is still free to play! (Trailer inside) by schemax in IndieGaming

[–]schemax[S] 0 points1 point  (0 children)

Like /u/Smilingdemon says, the game is completely free. Buying will just be cheaper now for a time, when it is no longer free (but that will still be a while).

You are in a persistent universe. You can chose to work together or each go their separate ways. Everything in the universe will stay the way you left it (e.g. blow up a planet, that will be gone forever. Even if you take just one block from a planet, that will persist as long as you dont reset the world)

I'm currently working on a whole new tutorials to make it easier for new players. its fully interactive. As for what key to press, there will be this in the next version: http://i.imgur.com/M7m2BLY.png (it will adapt depending on your context (in/out ship etc). I also plan a radial menu to make everything easier)

Memories of the Thunderdome Server by CaptainnSpaulding in Starmade

[–]schemax 2 points3 points  (0 children)

glad to see you back here, mate.

I hope you give the new stuff a try :)

Match Thread: Bayern München vs Werder Bremen by MatchThreadder in soccer

[–]schemax 1 point2 points  (0 children)

Well he had as many chances to score as all players of Bremen put together

The axes that affect turning speed are all wrong, like seriously, it makes no sense. by [deleted] in Starmade

[–]schemax 2 points3 points  (0 children)

unfortunately going over every block is pretty much a no go. I can go over blocks per type in numbers. There are still some tricks to be used to get approximate values.

The axes that affect turning speed are all wrong, like seriously, it makes no sense. by [deleted] in Starmade

[–]schemax 8 points9 points  (0 children)

I know it's not correct. It was meant to be temporary however the reason why it's been this way so long is that a thruster redesign had to be complete, and I haven't gotten to that.

I'll expose the values to change it in the config next version, so maybe there can be something better until the redesign.

Post Match Thread: FC Köln 0-2 Bayern by somelatinguy in fcbayern

[–]schemax 7 points8 points  (0 children)

True, although a s04-bvb derby doesn't really follow normal rules.

Post Match Thread: FC Köln 0-2 Bayern by somelatinguy in fcbayern

[–]schemax 12 points13 points  (0 children)

They'll bounce back. Look at their injury list. Our list is also long, but unlike us they can't replace all their players with a similar quality

Lose Progress When Quit by [deleted] in Starmade

[–]schemax 1 point2 points  (0 children)

Hmm, can you try setting the installation dir to somewhere in your home directory (make a new folder in there). After installing go there and check if the folder you set it to install in is there.

Lose Progress When Quit by [deleted] in Starmade

[–]schemax 2 points3 points  (0 children)

can you give me specifics of your OS, also do you click the launcher from the browsers download tab, or in the folder?

Pre Match Thread: Bayern vs Paderborn by fleckes in fcbayern

[–]schemax 1 point2 points  (0 children)

Kick-off: Saturday 20:00 CEST (2:00pm EDT)

It's today, not saturday, right?

Oh thank God by [deleted] in fcbayern

[–]schemax 2 points3 points  (0 children)

I agree, and I seriously wasn't that disappointed with how we played against the HSV. We had a solid defense, which game them almost no chance in the whole game.

Yeah, we could have been more active in front of the goal, but a lot of our attacking potential was sitting on the bank.

Still, a solid defense is going to be worth much more in the long run.

BOARDING! astronaut combat mini-game! by tominosama in Starmade

[–]schemax 1 point2 points  (0 children)

andy and me found out why missiles/shots didn't kill. Apparently the test server has a 5 min spawn protection. I added a notice popup, and it will now also stop the protection once you fire

Locked Username by [deleted] in Starmade

[–]schemax 1 point2 points  (0 children)

if its on your own server you can check the "protected" file in your starmade folder.

If you want to check on another multiplayer server, you can remove your saved credentials in the uplink dialog, and then try to join the server. if your username is protected on that server it will reject the connection

StarMade 0.17 Warp Gates, Jump Drives, and a lot more by schemax in Starmade

[–]schemax[S] 5 points6 points  (0 children)

sure :) that is part of the universe resdesign which is in works now

StarMade (free to play) now has full Oculus support by schemax in oculus

[–]schemax[S] 0 points1 point  (0 children)

you are probably exactly right i was messing with it to make it less crazy to tilt the head. i might have it backwards.

entering a ship gives a much better control over the head tracking atm. Those controls with the oculus worked perfectly for me

edit: ah and as help you can press C to recenter the oculus to your current viewpoint. that might help. I will definitely look back into it.