Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can this work for Godot 4+ multiplayer open-world chunk system? #602

Closed
WithinAmnesia opened this issue Feb 20, 2024 · 12 comments
Closed

Can this work for Godot 4+ multiplayer open-world chunk system? #602

WithinAmnesia opened this issue Feb 20, 2024 · 12 comments
Labels

Comments

@WithinAmnesia
Copy link

I am doing a from scratch build now for the multiplayer chunk system. What should I do for the server and the data and chunk storage?
I have a few leads and some more thoughts and resources can be found here:
WithinAmnesia/ARPG#16 <Start fresh thread.
WithinAmnesia/ARPG#15 <Previous start thread.
It was suggested I build a from scratch Multiplayer seamless chunk system that eventually be put together where it can handle 2K-16K+ players on the same server. What should be done for a web deployment to also run on a browser? I was suggested to try and do a chunk storage system similar to Minecraft or Terraria where each chunk is stored individually and accessed by the server in communication with the player clients. What should be done to solve this chunk puzzle? All feedback is welcome.

@Zylann
Copy link
Owner

Zylann commented Feb 20, 2024

This project has a chunked terrain, though multiplayer is experimental at the moment. See https://voxel-tools.readthedocs.io/en/latest/multiplayer/
I don't know about deployment it a web browser. Builds should probably work if you do them yourself (see https://docs.godotengine.org/en/stable/contributing/development/compiling/compiling_for_web.html), but hasn't got much testing. I can see the appeal but it's probably the worst platform regarding performance of Godot exports. Threading support can be iffy and this module relies heavily on multi-threading.

@WithinAmnesia
Copy link
Author

This project has a chunked terrain, though multiplayer is experimental at the moment. See https://voxel-tools.readthedocs.io/en/latest/multiplayer/ I don't know about deployment it a web browser. Builds should probably work if you do them yourself (see https://docs.godotengine.org/en/stable/contributing/development/compiling/compiling_for_web.html), but hasn't got much testing. I can see the appeal but it's probably the worst platform regarding performance of Godot exports. Threading support can be iffy and this module relies heavily on multi-threading.

So we if we flatten this to 2D down down. and use the chunk data storage system. Would this save a lot of performance? Think of minecraft but its just 1 block tall a big pancake but its 2D top down and has chunks like how minecraft multiplayer works where the server stores all the chunk data on disk. The serve as the the block data as integers and the communicates to the server and the clients builds the world they see from the chunk resource data saved on the server. So that the whole world is not loaded all at once and many clients can be in a dynamic world at the same time hopefully with smooth performance. Also add in server authorization for moving around and chunk placement and security / anti-hacking etc.

@Zylann
Copy link
Owner

Zylann commented Feb 20, 2024

You can reduce vertical bounds down to 1 chunk (16 voxels tall) but no further. If you want 2D then you're going to miss the point of this engine. Probably you should roll your own thing.

@WithinAmnesia
Copy link
Author

Also this I should share. It is about how this 2D multiplayer minecraft Godot 3.5.3.NET project works for multiplayer with the server and client with chunk data; also its a good example for this an networking perhaps:
pvini07BR/mijocraft#2 (comment)
"...But as I can remember by far, the chunk system works like this: the chunk is actually a Custom Resource. It stores all the block IDs in a array, you can do it in a 2D array if you prefer. It's an array of integers basically, with the number 0 representing air block.

so, what the server and client sends between each other is just the chunk resource data. and the chunk mesh is actually built in the client based on the chunk resource data. that's it.

this chunk resource data can also be saved in disk to be loaded later..."

I'm trying to find working examples of seamless chunk systems that can support multiplayer.

@WithinAmnesia
Copy link
Author

You can reduce vertical bounds down to 1 chunk (16 voxels tall) but no further. If you want 2D then you're going to miss the point of this engine. Probably you should roll your own thing.

Well if your seamless chunk system is really good it might be worth looking at and a lot of people have used this system and I am curious about the networking / multiplayer for the chunk data storage is the same system as minecraft but 3D has more integers / numbers in each chunk vs. 2D.

@WithinAmnesia
Copy link
Author

Do you know of any working example close to this kind of 2D chunk system that is similar to minecraft and works online that is build with Godot? its a big puzzle but once solved it should help a lot of people.

@Zylann
Copy link
Owner

Zylann commented Feb 20, 2024

The thing is if all you want is a 2D chunks streaming system you'll have way less headaches doing your own and it will be more performant than trying to adapt the one from this project, which is quite complex and isn't really geared towards web-based multiplayer currently. The only "demo" I have with multiplayer is the "blocky game" part of this repo, and explanations in the link i sent earlier. I'm not actively working on mutiplayer right now as I have a lot of other things to do.

@WithinAmnesia
Copy link
Author

WithinAmnesia commented Feb 20, 2024

I am very grateful you care and I understand there are a lot of things to do. A lot of people love your work so I would imagine its a lot to keep on top of lol. Hey it's all good too just sharing some advice. As in I'm looking around and trying to find some projects to take working examples of and make my own thing in 2D. It's just I can't be picky with seamless chunk systems in Godot and especially the multiplayer ones for they are very rare and are to be treasured. I'm very grateful for any advice or and I read the links and any feedback is welcome.

@WithinAmnesia
Copy link
Author

Zylann/voxelgame#100 (comment) We figured it out! Now its phase 3 with trying to convert the working multiplayer dynamic seamless chunk system to top down 2D. We are onto the next puzzle to solve now: Zylann/voxelgame#101

@WithinAmnesia
Copy link
Author

You can reduce vertical bounds down to 1 chunk (16 voxels tall) but no further. If you want 2D then you're going to miss the point of this engine. Probably you should roll your own thing.

vertical bounds
Where is this? How can the voxel generation be tweaked in say Blockygame to generate a prototype where its a thin pancake to test data storage and start the tinkering process for a 2D conversion of the chunk system?

Probably you should roll your own thing.
I am but its more productive to reverse engineer the beautiful multiplayer dynamic open-world seamless chunk system here and be proficient in understanding its already working mechanics and systems and then get the Blockgame demo tweaked close to a 2D conversion and then do a full fresh build from scratch learning and actively comparing from a working prototype so the fresh build is learning from real world masters.

Is it possible to generate a chuck that is 1 block high by X by X blocks wide and long (for example 1 block high by 16 blocks wide and 16 blocks long) to do rough multiplayer flat / plane chunk data testing? Or how can these chunks generate with 1 block layer of dirt and the rest air so it 'looks like' 1 block high chunks / it looks like Minecraft creative where its just a thin pancake of 1 dirt block thick flat infinite chunks? Where are the parameters in Blockygame / Godot_Voxel to adjust this world generation? All feedback is welcome.

@WithinAmnesia
Copy link
Author

image
I've got this so far but I'm wondering in blocky game how to make it so the terrain generation is 1 dirt block on the bottom and 15 air blocks above it for data testing?

@WithinAmnesia
Copy link
Author

WithinAmnesia commented Feb 21, 2024

image
I figured out flat world generation.
voxelgame_flat_world_generation.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants