• Godot Help
  • Godot 4.2.1.NET+ Multiplayer Seamless Chunk System.

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:
https://github.com/WithinAmnesia/ARPG/discussions/16
https://github.com/WithinAmnesia/ARPG/discussions/15
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.

Bound2bCoding
"Chunking is probably a MUST for your project because it will be streamed from the servers to the client(s). I did not do a chunkless system with the web project. Actually, I streamed the data tile-by-tile, necessary because of the web-based design."
I will be using chunking moving forward now for sure this is great advice and it confirms a lot of ideas I had too but was not 100% certain of until your clarity provided.

"Think about it. If you tried to send the entire map to every player, it would probably kill performance."
Yes this explains my previous testing with big maps slowing down on JDungeon tests and it loaded everything up at once 1 one chunk. So the bigger the chunk the slower it was. 256x256 with 32x32 pixel tiles was around the limit for 10-99 ms combat latency in that previous example multiplayer set up.

"I would recommend that you spend some time with a sample web-based project and learn the basics of sending/receiving/processing packets of game data to a client. Then, you will learn what can and cannot be done. You can have millions of tiles in a database and only send what the user needs to see on their screen."
So I need to find a way to make something like Minecraft's multiplayer but for Godot then? Minecraft has a server that stores the chunk data and only loads and unloads what is around a connected client / player. The server also authorizes any changes that client makes to the server chunk data and stores the chunk data for the array of chunks. This is from what I have gathered so far briefly in how Minecraft's multiplayer is able to handle so many chunks and players at the same time on a server.

"You can have millions of tiles in a database and only send what the user needs to see on their screen. That would not be the same solution I demoed. Thanks for your interest in my game."
Your game looks really cool, I love the the theme of it too; I live in the woods and I relate to the setting quite a lot lol. I am wondering though about this "You can have millions of tiles in a database and only send what the user needs to see on their screen." How can this be done in C#? Is this just like Minecraft's multiplayer but in C#?

What would be a good start to this? I linked some Minecraft multiplayer Godot projects and asked their owners about how they are storing data from the chunks and what their thoughts are on this puzzle but they have not replied very much on this topic or implemented working examples to learn from. There is no documentation of this critical aspect fro Godot how to save and load chunk data for multiplayer from what I have found and I have been searching and I want to find some advice and learn from working things to better understand how things work too.

I am wondering how to do this chunk data solution found within Minecraft's multiplayer but in C#? For I don't have any fully working example to learn from and Minecraft is not open source and its written in Java mostly. Yet all the open source Minecraft clones do not seem to save or deal with the chunk data very well for multiplayer. So it puzzles myself what to do to save the chunk data for the server to read and write and send to the clients. What should I do for saving data from the chunks? What are your chunk data saving for server and client suggestions / insights?

I came across these though, both are from multiplayer Minecraft example projects on github:
3D Minecraft in Godot 4.2.1.NET+ from: https://github.com/Solicey/minecraft-made-with-godot/issues/1#issuecomment-1951569213
"Yes, my demo does include multiplayer and dynamic chunk loading. As for multiplayer function, I use remote procedure call APIs provided by Godot. For chunk loading, I use surface tools to generate new 3D mesh when chunks need to be updated. Not quite sure whether surface tools are suitable for your 2D project, if you are using tilemaps.

At 2024-02-17 02:59:51, "WithinAmnesia" @.***> wrote:

Test chunks link: https://github.com/WithinAmnesia/ARPG/discussions/15

I'm trying to find a way to seamless load and unload chunks for a 2D multiplayer game project to make an open world with a working server using Godot 4.2.1.NET.

How can this work for multiplayer and what is needed for this to potentially work? What options can be used for chunk loading and unloading seamlessly in Godot 4.2.1.NET? Please give feedback.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: @.***>"

................

Also this too which is in 2D but it runs in Godot 3.5.3.NET+ from: https://github.com/pvini07BR/mijocraft/issues/2#issuecomment-1953209200
" pvini07BR commented Feb 19, 2024 •

How can this be converted to work in Godot 4.2.1.NET? WithinAmnesia/ARPG#16 (comment) I have been searching for projects to learn from and yours is one of the only multiplayer minecraft godot demonstrations and and I cannot get it to run on Godot 4.2.1.NET with that uses the visual studio 2022 C# data. I have seen in the comment section of that video I linked it was for Godot 3 but a person converted it into Godot 4 remaking it: "Pinned by xen-42 @tumbleweb 1 year ago (edited) Doing this in Godot 4.0: Class renames include StaticBody -> StaticBody3D, MeshInstance -> MeshInstance3D, SpatialMaterial -> StandardMaterial3D Annotations including '@tool' instead of 'tool' At 3:40, change 'Mesh.new()' -> 'ArrayMesh.new()' to avoid a !static_body error. At 11:00, texture filtering is not set per-import anymore; in the material, go to 'Sampling' and change Filter to Nearest. At 11:50, setting texture filter via code might not be necessary.. Not entirely sure, couldn't complete this part (see below), but in any event, materials do not have flags to set anymore, now replacing them with different variable groups in the inspector.

First snag I couldn't catch was 16:00. The mesh would render fine but without the material. Godot spits out no errors at this point so its a bit difficult to tell what's going wrong. I'll check back another day.. >_>

PS. 39:20 Raycasts are enabled by default now :D"

Is there a similar process to convert this to work with Godot 4.2.1.NET+? Also how is the data saved and how does it work with the server? i have not been able to get this to run on Godot 4.2.1.NET to test it so I am still really curious as to how this all works. Any feedback is welcome.

look, i cant help you with every single detail, i have my business to do.

what i know is that translating GDScript code to C# isn't that hard. it uses the same names for the classes, functions, members and variables, except they are in PascalCase because that is the standard for C#.

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.

and as i said before, i wont update this project anymore, don't try to make it work in the newest versions. what you can do is checking the code of the project. it's right there, its all there.

i really encourage you to try to do your own solution to this. but you can also ask for help in the r/godot subreddit, in the forums, in the official godot discord server, etc... theres a whole community that can help you."

They reference the ability the store and save the chunk data and for the server to use the chunk data and also chunk arrays and how the server communicates with the clients. there is no documentation on this and a lot of these solutions these people invented by themselves or found somewhere I have yet to find too. What are your thoughts on all of this? What would you recommend I start doing first?

You say use chunks and also be careful with the server limits on chunks loaded by the clients (don't load all the map at once to save performance). "Actually, I streamed the data tile-by-tile, necessary because of the web-based design." What would this look like in C# in Godot 4.2.1.NET+ for you said it was in Java or another engine Unity perhaps and it was not shared / it was not pursued for various reasons. What should we do to solve this puzzle what should the chunks do with the data storage and how should the server data be handled? What examples come to mind and where should one look to find working solutions and examples that are open source to learn from?

You mention this: "Spend some time with a sample web-based project and learn the basics of sending/receiving/processing packets of game data to a client. Then, you will learn what can and cannot be done." What examples would you recommend that are appropriate of amount of clients in 2D? For some server and client solution examples are only for small servers and some are for larger community / bigger games too.

I wish to be kind and easy to talk with and I want to make sure I am not overloading or ask to many questions too so I may be kind. Thank you for caring as well. I am full of questions and I think if I get more progress I can share with you better examples and prototypes and ask better to answer questions that are more refined. Thank you for helping too it is very rare to find people like yourself and I treasure the real world skill proven knowledge you have and the skill and mastery of C# I greatly value. I wish to learn as much as I can from the real masters such as yourself and stay open minded and work hard. Please share your thoughts and suggestions. You have many insights and I am already learning a great deal with all of these greatly important areas. All feedback is welcome.

Hi, i videogame artist. I find your project interesting, but I have some questions. I think I can help you in the same. If you are interested we can talk about it.

Greetings.

My discord: aizanoth