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+ games with multiplayer and open world chunks? #1

Closed
WithinAmnesia opened this issue Feb 18, 2024 · 59 comments

Comments

@WithinAmnesia
Copy link

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.

https://jonathaneeckhout.itch.io/jdungeon For the goal right now it is easy to play this but imagine it has seamless chunk loading and unloading. As instead of the black world boundary a new chunk loads in seamlessly. What are your suggestions and thoughts?

Update: https://github.com/WithinAmnesia/ARPG/tree/ARPG-Infinite-Worlds Here is the 128x128 with 32x32 pixel tile chunk to test.

My initial testing seems to feel even faster combat with the 128x128 chunk. This 128x128 chunk has the same amount of entities as the 256x256 chunk. For I moved all of the entities over into the 128x128 chunk. This 128x128 chunk is a good test for using the Infinite-Worlds using the BinarySerializer for Godot 4.2+ from Theraot: https://gist.github.com/theraot/31515e28e2d8bfea33f6c6d5bcd852f6 . There needs to be some testing how to make the chunks seamlessly load and unload. https://gamedev.stackexchange.com/questions/209002/looking-for-help-godot-4-multiplayer-seamless-open-world-chunks

Test chunks link: WithinAmnesia/ARPG#15

I'm working on so candidates for the Godot 4+ Multiplayer Seamless Chunk System. I am looking through these ~500+ Github Godot .zip projects and seeing candidates to start to build up from. So far I have a few good candidates for Seamless Chunk System.
https://github.com/DennisSmuda/godot-chunking-system [2D Chunk Generator]
https://github.com/dllta/ChunkLoader [2D Chunk System]
https://github.com/michasng/voxel_game/tree/main [3D Voxel Generator]
https://github.com/pinkavat/GroveGenChunks [3D Seamless Chunks]

So I will soon need some more testing too lol and all feedback is welcome.

@sirarandor
Copy link
Owner

While I had at one point gotten the main TileMap of the world to sync across multiplayer, generate new tiles and sync them across all clients, the system quickly becomes large and unwieldy as the map went beyond 1,000,000 tiles. This resulted in slowing down Godot's performance substantially and requiring a great deal of RAM.

I'd heavily recommend storing chunks as files and only loading them when needed, and having the server or client pre-generate chunk files.

@WithinAmnesia
Copy link
Author

You've done this?

@WithinAmnesia
Copy link
Author

Mate I've been searching across github for so long and asking so many questions. Okay I got a lot of questions.

Okay so Can we figure out how to combine the best of the JDungeon demo stuff with your experience in multiplayer seamless chunk systems?

@WithinAmnesia
Copy link
Author

While I had at one point gotten the main TileMap of the world to sync across multiplayer, generate new tiles and sync them across all clients, the system quickly becomes large and unwieldy as the map went beyond 1,000,000 tiles. This resulted in slowing down Godot's performance substantially and requiring a great deal of RAM.

I'd heavily recommend storing chunks as files and only loading them when needed, and having the server or client pre-generate chunk files.

What about 128x128 32x32 pixel tile chunks? How can we do this with the ARPG demo that has been adjusted for multiplayer seamless chunk loading and unloading? this one: "Update: https://github.com/WithinAmnesia/ARPG/tree/ARPG-Infinite-Worlds Here is the 128x128 with 32x32 pixel tile chunk to test."? How to start: Run 3-4 instances in the debug -> run multiple instances. Then run the first instance as Gateway. The second instance should run as Server. The third instance as Client. Make an account then log in. The fourth and more instances can be for client multi-boxing testing and work the same as the third instance.

@WithinAmnesia
Copy link
Author

WithinAmnesia commented Feb 18, 2024

"I'd heavily recommend storing chunks as files and only loading them when needed, and having the server or client pre-generate chunk files."
How do we do this? I have been recommended to store the chunks as .tscn like the ARPG demo is a 128x128 with 32x32 pixel chunk? How can we get the .tscn scenes as chunks and have the server be connected where the entities load and upload with the chunks that seamlessly load and unload with them?

@sirarandor
Copy link
Owner

There were plans for correct Chunk filing (ref: Minecraft's way of handling chunk files) on paper, but I had lost the interest at that point. Programming for multiplayer is repetitive at best and downright mentally harmful at worst. However, With .NET libraries you can read/write to files that let you store binary data.

I haven't taken a look at the JDungeon demo, and my system was by no means "seamless", as it suffered from tiles being dropped seemingly at random, and issues with chunk (0,0) not loading for clients.

@WithinAmnesia
Copy link
Author

WithinAmnesia commented Feb 18, 2024

There were plans for correct Chunk filing (ref: Minecraft's way of handling chunk files) on paper, but I had lost the interest at that point. Programming for multiplayer is repetitive at best and downright mentally harmful at worst. However, With .NET libraries you can read/write to files that let you store binary data.

I haven't taken a look at the JDungeon demo, and my system was by no means "seamless", as it suffered from tiles being dropped seemingly at random, and issues with chunk (0,0) not loading for clients.

That's okay like we just have big chunks as scenes so it can be really manageable chunks like minecraft.

Binary! 1 sec I got a thing "BinarySerializer for Godot 4.2+ from Theraot: https://gist.github.com/theraot/31515e28e2d8bfea33f6c6d5bcd852f6 ." from Theraot is like a code piece for compressing and decompressing files / data back and from from server to client. It might help? With the binary stuff?

@WithinAmnesia
Copy link
Author

WithinAmnesia commented Feb 18, 2024

I haven't taken a look at the JDungeon demo, and my system was by no means "seamless", as it suffered from tiles being dropped seemingly at random, and issues with chunk (0,0) not loading for clients.
candidates for Seamless Chunk System.
https://github.com/DennisSmuda/godot-chunking-system [2D Chunk Generator]
https://github.com/dllta/ChunkLoader [2D Chunk System]
These two are working like the simple one with just the coloured squares is good enough like the chunks don't have to be small they can kinda large so the transition is easier to load in and like maybe only 4 chunks at a time would be loaded at the corners was recommended by Theraot and others in the Godot community.

@sirarandor
Copy link
Owner

Interesting. My system didn't send scenes, it just sent Dictionary {Vector2 : int} as the chunk data.

@WithinAmnesia
Copy link
Author

WithinAmnesia commented Feb 18, 2024

Interesting. My system didn't send scenes, it just sent Dictionary {Vector2 : int} as the chunk data.

What do you think? Can we do scenes? It would kind of be like mine craft's individual chunk data. If so we can get all the ARPG / JDungeon demos as scenes / chunks and load and unload them seamlessly hopefully. All we need is up to 4 of the 128x128 32x32 pixel tile chunk scenes loaded at one time (as in 4 at the corners would be the biggest test) at one time for the client and server to get along that its a great success.

@sirarandor
Copy link
Owner

I have absolutely no idea. Currently I am learning Wave Function Collapse for generating levels in my project Malun. The process you are suggesting could probably work, but I am unfortunately not in a position to help you write it.

And I wish I could share what I did, but it seems I have severely messed up luxterra's GitHub project.

@WithinAmnesia
Copy link
Author

WithinAmnesia commented Feb 18, 2024

I have absolutely no idea. Currently I am learning Wave Function Collapse for generating levels in my project Malun. The process you are suggesting could probably work, but I am unfortunately not in a position to help you write it.

And I wish I could share what I did, but it seems I have severely messed up luxterra's GitHub project.

Oh older versions! Are they there to help? https://github.com/sirarandor/lux-terra/commits/dev/

@WithinAmnesia
Copy link
Author

Also can I ask you questions and get some guidance?

@sirarandor
Copy link
Owner

If you wish to sort through the old versions that's perfectly fine, I can also go through some old local files to see if I have anything worth noting.

You can ask questions as well, but my response time varies and they may be completely incorrect.

@sirarandor
Copy link
Owner

I am by no means a good programmer, much less a passable game developer.

@WithinAmnesia
Copy link
Author

Interesting. My system didn't send scenes, it just sent Dictionary {Vector2 : int} as the chunk data.

How can I swap this for scenes?

@sirarandor
Copy link
Owner

I just kept everything in the same scene and added onto the ever-growing TileMap.

@WithinAmnesia
Copy link
Author

I am by no means a good programmer, much less a passable game developer.

Mate you are really good like what you did with multiplayer is like insane there sooooo many projects on here mate that are not even close to what you did.

@WithinAmnesia
Copy link
Author

I have searched high and low for multiplayer chunk systems for Godot and like literally I'm up to 500+ and this project has a working multiplayer test. Like literally less than 1 in 100 projects like even come come close to this.

@WithinAmnesia
Copy link
Author

I am mainly trying to find people like your yourself who are really skilled and like know how to solve these kinds of puzzles. I wish to do the work I just need some guidance too.

@WithinAmnesia
Copy link
Author

I just kept everything in the same scene and added onto the ever-growing TileMap.

Yes but you did that in Multiplayer. That is really not easy to find.

@sirarandor
Copy link
Owner

You should absolutely check out the PirateSoftware Discord server, it's full of a lot of helpful people that make games together.

@WithinAmnesia
Copy link
Author

What are your thoughts on loading multiple scene side by side to make chunks?

@WithinAmnesia
Copy link
Author

You should absolutely check out the PirateSoftware Discord server, it's full of a lot of helpful people that make games together.

Really, that's really helpful to hear. Strangely I never heard that one and I have been asking around. How can I join this and look for help?

@sirarandor
Copy link
Owner

What are your thoughts on loading multiple scene side by side to make chunks?

Terrifying. You'd have to correctly access each scene as Nodes whenever you wanted to do navigation, placing or breaking, or anything.

@sirarandor
Copy link
Owner

https://discord.com/invite/piratesoftware

Make sure to go to Channels & Roles to get yourself the right role in order to access the #godot channel.

@WithinAmnesia
Copy link
Author

WithinAmnesia commented Feb 18, 2024

What are your thoughts on loading multiple scene side by side to make chunks?

Terrifying. You'd have to correctly access each scene as Nodes whenever you wanted to do navigation, placing or breaking, or anything.

Wait you know a lot of things. My mind is really curious now. What do you know? Like so you can see in your mind's eye a path to explore on how to solve this really big puzzle? You can feel the challenge right? As like master artisan working on masterpiece? As like this is really rare mate.

@sirarandor
Copy link
Owner

Wait you know a lot of things. My mind is really curious now. What do you know? Like so you can see in your mind's eye a path to explore on how to solve this really big puzzle? you can feel the challenge right like master artesian working on masterpiece? like this is really rare mate.

I know that in my head I see a very scary looking scene that has a few hundred Chunk[number] Nodes that your script would have to manage accessing using String manipulation in your C# file.

@WithinAmnesia
Copy link
Author

WithinAmnesia commented Feb 18, 2024

Wait you know a lot of things. My mind is really curious now. What do you know? Like so you can see in your mind's eye a path to explore on how to solve this really big puzzle? you can feel the challenge right like master artesian working on masterpiece? like this is really rare mate.

I know that in my head I see a very scary looking scene that has a few hundred Chunk[number] Nodes that your script would have to manage accessing using String manipulation in your C# file.

Wait you know these things though? So as long as I don't over stress you or anything like that you can look at things and see what should done? This is really rare mate like I've been asking around so much high and low like every possible forum, thread and like tracking people down like and you just know these things like you can clearly see them in your mind. So I feel I have to like not waste this opportunity to learn. I have so many questions. I should be aiming to be good to talk with though.

@sirarandor
Copy link
Owner

You are a master coder? Mate that is super rare to find. II have so many questions.

Heh, I am by no means a master coder.

@WithinAmnesia
Copy link
Author

How should I describe this and question should my question look like?

I don't know the entire scope of your project so I'm not sure how to direct, that's something you'll need to work out on your end.

Oh okay the core of my question is how do we get the JDungeon stuff that runs on a scene for a chunk to work like individual chunks that can be seamlessly interconnected and load and unload like in minecraft chunk data?

@sirarandor
Copy link
Owner

sirarandor commented Feb 18, 2024

Oh okay the core of my question is how do we get the JDungeon stuff that runs on a scene for a chunk to work like individual chunks that can be seamlessly interconnected and load and unload like in minecraft chunk data?

You'll probably want to include some background to why you want the chunk loading done, showing how you're making a 2D multiplayer survival game, etc. but that sounds fine.

@WithinAmnesia
Copy link
Author

WithinAmnesia commented Feb 18, 2024

Okay so I was at the pirate software discord with godot and it was mixed results. The people knew things but they didn't want to look at the project and asked strange questions or like they'd rather ask 10 questions then test the demo and like take 2 seconds to look at the files and ask like why I am building games not like what should be done to solve x? Its good but like probably needs specialized experts who work with chunks. I didn't learn much and I was told maybe do an array of 2D tiles but like when I showed them the synchronizer files that handles the chunk stuff they like idk lost motivation? They are were really caught up in like server security at one point and monetization prioritizes idk. There are really helpful people there but its discord so bit by bit.

@sirarandor
Copy link
Owner

Okay so I was at the pirate software discord with godot and it was mixed results. The people knew things but they didn't want to look at the project and asked strange questions or like they'd rather ask 10 questions then test the demo and like take 2 seconds to look at the files and ask like why I am building games not like what should be done to solve x? Its good but like probably needs specialized experts who work with chunks. I didn't learn much and I was told maybe do an array of 2D tiles but like when I showed them the synchronizer files that handles the chunk stuff they like idk lost motivation? They are were really caught up in like server security at one point and monetization prioritizes idk. There are really helpful people there but its discord so bit by bit.

Yeah, the server is very security focused and no one wants to run something that could be potentially harmful. A lot of scams will ask people to download and test a game but it'll instead be a virus, so they're probably asking you things just to make sure you're not trying to scam them.

@sirarandor
Copy link
Owner

@WithinAmnesia
Copy link
Author

@WithinAmnesia
Copy link
Author

I really hope it works well. I'm just starting to test it now lol.

@WithinAmnesia
Copy link
Author

Its 3.XX hmmm I'm going to have to contact the dev and loook at other minecraft godot projects.

@WithinAmnesia
Copy link
Author

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?
WithinAmnesia/ARPG#16

@sirarandor
Copy link
Owner

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? WithinAmnesia/ARPG#16

You will probably want to plan out a process for generating, storing and syncing chunks across all clients. The more simple you can make whatever variable or struct you use for Chunks the better, as you're going to be using it a lot.

@WithinAmnesia
Copy link
Author

Update: 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.

@WithinAmnesia
Copy link
Author

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? WithinAmnesia/ARPG#16

You will probably want to plan out a process for generating, storing and syncing chunks across all clients. The more simple you can make whatever variable or struct you use for Chunks the better, as you're going to be using it a lot.

WithinAmnesia/ARPG#16 (comment)
"Leads and Suggestions:
Solicey/minecraft-made-with-godot#1 (Multiplayer Minecraft clone written in C# with Godot 4.2.1.NET)
...
xellu/xelcraft#6 (Multiplayer Planned Minecraft clone written in C# with Godot 4.2.1.NET)
...
hakanero/minecraft-clone#1 (Minecraft clone written in C# and GDscript with Godot 4.2.1.NET)
...
pvini07BR/mijocraft#2 (GDScript Multiplayer Minecraft in Godot 3.XX)
...
fanherbaty/crustycraft#1 (2D Minecraft with cave levels in Godot 4.2.1.NET+)
...
https://www.youtube.com/watch?v=LEZGrHyWNmQ + https://astruggletosurvivedevblog.blogspot.com/ (C# software engineer seamless large tile / chunk map that can possibly do multiplayer and browser support game)
...
#1 (Multiplayer expanding tile / chunk game with fog of war)"

@WithinAmnesia
Copy link
Author

I am in the process of collecting the best world chunk data examples from the open source community for Godot 4.2.1.NET+. I am bit by bit narrowing down the solution examples and putting things together to best manage the big game multiplayer seamless chunk data demands. Minecraft clones seem to be the bets inspiration for multiplayer data storage and sever communication solutions so far to learn from. What should I do and what are your suggestions and thoughts? All 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

How do we make the top down 2D multiplayer branch / version of this that can run on Godot 4.2.1.NET+ Compatibility and for online web / browser game hosting (so pretty much anything everything can play this power multiplayer seamless chunk system?

Requirements: A hand made and dynamic main over world map 100 areas combined with 1,024 x 1,024 tile map for an at least tile map size of 104,857,600 tiles with 16 x 16 pixel tiles at least. Perhaps double that with subterranean and interiors included to the total amount of tiles for a multiplayer seamless chunk system. The intended client / player / population / server size is to be ~2K to ~16K+ clients on one server. How can we convert the Blockygame multiplayer seamless chunk system for this forever free open source forever free goal?

My first thoughts are to get just to the basics and start from a stripped down 2D array. Yet I have to do this properly to keep the dynamic multiplayer seamless chunk system intact and future proof for 2.5D and 3D games; when they are ready to be made in subsequent order. I must seek guidance to do this properly and make a beautiful work for the community to be empowered with too for making massive multiplayer games. I call this whole open source forever free community dynamic multiplayer seamless chunk system Infinite Worlds.

@WithinAmnesia
Copy link
Author

WithinAmnesia commented Feb 22, 2024

I just got the Godot_Voxel with BlockyGame to generate a flat world for testing in multiplayer: WithinAmnesia/ARPG#16 (comment) The code for the flat world generator makes ~3 layers of grass (instead of just 1) and it might be a bit buggy but it works although I should have a simpler one like fill all with grass for example but I was not sure how to code that so i just made iterations and slowly got it to work for multiplayer). Each chunk is 16x16x16 blocks so I have to optimize that into 2D better. It works, it's just now I'm trying to figure out how to make it 2D and not 3D but its progress. I'm not sure how to start the 2D. There are some examples of minecraft in 2D with 2D arrays but I'm not sure how to get the 2D mode going and how to keep the chunk system together. It took a while to get the blocks to be flat and the code was a case of trial and error switching things on and off and adjusting values testing in multiplayer.

I am trying to not be bound to the special Godot_Voxel engine module / the special Godot Voxel engine so this solution can be used in regular Godot Engine 4.2.1.NET+ editors.

The big thing now is trying to get the 3D chunks into 2D chunks and then test in Compatibility mode. I have some examples that might help for a start but I'm not sure its super amazing at everything but they might help a bit to get a foothold of what to do next:
pvini07BR/mijocraft#2 (2D GDScript Multiplayer Minecraft in Godot 3.XX)
pvini07BR/mijocraft#3
pvini07BR/mijocraft#4
...
#1 (2D Multiplayer expanding tile / chunk game with fog of war) [Your game project]
...
KoBeWi/The-Soulhunter#2 (2D Godot 3.XX multiplayer chunk game)
...
fanherbaty/crustycraft#1 (2D Minecraft with cave levels in Godot 4.2.1.NET+)

What should the next step go? What are your thoughts and suggestions? Should I just keep tinkering away with the 4 2D multiplayer godot game demos and keep trying new things until something works with the 2D port of the multiplayer chunk system with Godot_Voxel? All feedback is welcome.

@WithinAmnesia
Copy link
Author

Zylann/voxelgame#101 (comment) Big 2D/3D hybrid progress update!

@sirarandor
Copy link
Owner

Zylann/voxelgame#101 (comment) Big 2D/3D hybrid progress update!

Ooh, that's very interesting.

@sirarandor
Copy link
Owner

I am in the process of collecting the best world chunk data examples from the open source community for Godot 4.2.1.NET+. I am bit by bit narrowing down the solution examples and putting things together to best manage the big game multiplayer seamless chunk data demands. Minecraft clones seem to be the bets inspiration for multiplayer data storage and sever communication solutions so far to learn from. What should I do and what are your suggestions and thoughts? All feedback is welcome.

I'd say that making a simple clone first is a good idea. Start from the basics and learn how systems work before implementing them for multiplayer.

@WithinAmnesia
Copy link
Author

Th multiplayer works in the blocky game demo for the godot_pixel. The next puzzle to solve is how to get entities with the chunk streaming system. Also item and player character storage. Then that's basically most of the big one solved. The world saves so as long as entities and player storage works like minecraft we are doing great.

@WithinAmnesia
Copy link
Author

Zylann/voxelgame#103 How can entities and player storage work for this demo? Are there any examples or prototypes?
Goal: Minecraft style entity and player storage system. Bonus account system.

How can entities and storage system like chests stored in chunk data like minecraft? Bonus for account linked storage like M.M.O. player inventory and banks / minecraft player account inventory with shulker boxes.

@WithinAmnesia
Copy link
Author

WithinAmnesia commented Mar 1, 2024

Do you have any free time to look at the code for this RPG Inventory from scratch tutorial and see how it can be translated / implemented with the Blockygame multiplayer demonstration? What should be done? What are your thoughts and suggestions? All feedback is welcome.
devloglogan/MultiplayerFPSTutorial#13
https://github.com/WithinAmnesia/ARPG/blob/ARPG-Infinite-Worlds/DevLogLogan%20RPG%20Inventory.zip
Here is the Blockygame demo too it needs the Godot_Voxel engine module to work: https://github.com/WithinAmnesia/ARPG/blob/ARPG-Infinite-Worlds/Infinite_Worlds_V.000.006.1.zip

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

No branches or pull requests

2 participants